; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instcombine -S | FileCheck %s 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" ; A multi-dimensional array in a nested loop doing vector stores that ; aren't yet aligned. Instcombine can understand the addressing in the ; Nice case to prove 16 byte alignment. In the Awkward case, the inner ; array dimension is not even, so the stores to it won't always be ; aligned. Instcombine should prove alignment in exactly one of the two ; stores. @Nice = global [1001 x [20000 x double]] zeroinitializer, align 32 @Awkward = global [1001 x [20001 x double]] zeroinitializer, align 32 define void @foo() nounwind { ; CHECK-LABEL: @foo( ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[BB7_OUTER:%.*]] ; CHECK: bb7.outer: ; CHECK-NEXT: [[I:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVAR_NEXT26:%.*]], [[BB11:%.*]] ] ; CHECK-NEXT: br label [[BB1:%.*]] ; CHECK: bb1: ; CHECK-NEXT: [[J:%.*]] = phi i64 [ 0, [[BB7_OUTER]] ], [ [[INDVAR_NEXT:%.*]], [[BB1]] ] ; CHECK-NEXT: [[T4:%.*]] = getelementptr [1001 x [20000 x double]], [1001 x [20000 x double]]* @Nice, i64 0, i64 [[I]], i64 [[J]] ; CHECK-NEXT: [[Q:%.*]] = bitcast double* [[T4]] to <2 x double>* ; CHECK-NEXT: store <2 x double> zeroinitializer, <2 x double>* [[Q]], align 16 ; CHECK-NEXT: [[S4:%.*]] = getelementptr [1001 x [20001 x double]], [1001 x [20001 x double]]* @Awkward, i64 0, i64 [[I]], i64 [[J]] ; CHECK-NEXT: [[R:%.*]] = bitcast double* [[S4]] to <2 x double>* ; CHECK-NEXT: store <2 x double> zeroinitializer, <2 x double>* [[R]], align 8 ; CHECK-NEXT: [[INDVAR_NEXT]] = add i64 [[J]], 2 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVAR_NEXT]], 556 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[BB11]], label [[BB1]] ; CHECK: bb11: ; CHECK-NEXT: [[INDVAR_NEXT26]] = add i64 [[I]], 1 ; CHECK-NEXT: [[EXITCOND27:%.*]] = icmp eq i64 [[INDVAR_NEXT26]], 991 ; CHECK-NEXT: br i1 [[EXITCOND27]], label [[RETURN_SPLIT:%.*]], label [[BB7_OUTER]] ; CHECK: return.split: ; CHECK-NEXT: ret void ; entry: br label %bb7.outer bb7.outer: %i = phi i64 [ 0, %entry ], [ %indvar.next26, %bb11 ] br label %bb1 bb1: %j = phi i64 [ 0, %bb7.outer ], [ %indvar.next, %bb1 ] %t4 = getelementptr [1001 x [20000 x double]], [1001 x [20000 x double]]* @Nice, i64 0, i64 %i, i64 %j %q = bitcast double* %t4 to <2 x double>* store <2 x double>, <2 x double>* %q, align 8 %s4 = getelementptr [1001 x [20001 x double]], [1001 x [20001 x double]]* @Awkward, i64 0, i64 %i, i64 %j %r = bitcast double* %s4 to <2 x double>* store <2 x double>, <2 x double>* %r, align 8 %indvar.next = add i64 %j, 2 %exitcond = icmp eq i64 %indvar.next, 556 br i1 %exitcond, label %bb11, label %bb1 bb11: %indvar.next26 = add i64 %i, 1 %exitcond27 = icmp eq i64 %indvar.next26, 991 br i1 %exitcond27, label %return.split, label %bb7.outer return.split: ret void }