1 ; RUN: opt < %s -instcombine -S | grep "align 16" | count 1 2 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" 3 4 ; A multi-dimensional array in a nested loop doing vector stores that 5 ; aren't yet aligned. Instcombine can understand the addressing in the 6 ; Nice case to prove 16 byte alignment. In the Awkward case, the inner 7 ; array dimension is not even, so the stores to it won't always be 8 ; aligned. Instcombine should prove alignment in exactly one of the two 9 ; stores. 10 11 @Nice = global [1001 x [20000 x double]] zeroinitializer, align 32 12 @Awkward = global [1001 x [20001 x double]] zeroinitializer, align 32 13 14 define void @foo() nounwind { 15 entry: 16 br label %bb7.outer 17 18 bb7.outer: 19 %i = phi i64 [ 0, %entry ], [ %indvar.next26, %bb11 ] 20 br label %bb1 21 22 bb1: 23 %j = phi i64 [ 0, %bb7.outer ], [ %indvar.next, %bb1 ] 24 25 %t4 = getelementptr [1001 x [20000 x double]], [1001 x [20000 x double]]* @Nice, i64 0, i64 %i, i64 %j 26 %q = bitcast double* %t4 to <2 x double>* 27 store <2 x double><double 0.0, double 0.0>, <2 x double>* %q, align 8 28 29 %s4 = getelementptr [1001 x [20001 x double]], [1001 x [20001 x double]]* @Awkward, i64 0, i64 %i, i64 %j 30 %r = bitcast double* %s4 to <2 x double>* 31 store <2 x double><double 0.0, double 0.0>, <2 x double>* %r, align 8 32 33 %indvar.next = add i64 %j, 2 34 %exitcond = icmp eq i64 %indvar.next, 556 35 br i1 %exitcond, label %bb11, label %bb1 36 37 bb11: 38 %indvar.next26 = add i64 %i, 1 39 %exitcond27 = icmp eq i64 %indvar.next26, 991 40 br i1 %exitcond27, label %return.split, label %bb7.outer 41 42 return.split: 43 ret void 44 } 45