1 ; RUN: opt -load-store-vectorizer %s -S | FileCheck %s
2 ; RUN: opt -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' %s -S | FileCheck %s
4 ; Check that setting wrapping flags after a SCEV node is created
5 ; does not invalidate "sorted by complexity" invariant for
6 ; operands of commutative and associative SCEV operators.
8 target triple = "x86_64--"
10 @global_value0 = external constant i32
11 @global_value1 = external constant i32
12 @other_value = external global float
13 @a = external global float
14 @b = external global float
15 @c = external global float
16 @d = external global float
17 @plus1 = external global i32
18 @cnd = external global i8
20 ; Function Attrs: nounwind
21 define void @main() local_unnamed_addr #0 {
22 ; CHECK-LABEL: @main()
23 ; CHECK: [[PTR:%[0-9]+]] = bitcast float* %preheader.load0.address to <2 x float>*
24 ; CHECK: = load <2 x float>, <2 x float>* [[PTR]]
25 ; CHECK-LABEL: for.body23:
27 %tmp = load i32, i32* @global_value0, !range !0
28 %tmp2 = load i32, i32* @global_value1
29 %and.i.i = and i32 %tmp2, 2
30 %add.nuw.nsw.i.i = add nuw nsw i32 %and.i.i, 0
31 %mul.i.i = shl nuw nsw i32 %add.nuw.nsw.i.i, 1
32 %and6.i.i = and i32 %tmp2, 3
33 %and9.i.i = and i32 %tmp2, 4
34 %add.nuw.nsw10.i.i = add nuw nsw i32 %and6.i.i, %and9.i.i
35 %conv3.i42.i = add nuw nsw i32 %mul.i.i, 1
36 %reass.add346.7 = add nuw nsw i32 %add.nuw.nsw10.i.i, 56
37 %reass.mul347.7 = mul nuw nsw i32 %tmp, %reass.add346.7
38 %add7.i.7 = add nuw nsw i32 %reass.mul347.7, 0
39 %preheader.address0.idx = add nuw nsw i32 %add7.i.7, %mul.i.i
40 %preheader.address0.idx.zext = zext i32 %preheader.address0.idx to i64
41 %preheader.load0.address = getelementptr inbounds float, float* @other_value, i64 %preheader.address0.idx.zext
42 %preheader.load0. = load float, float* %preheader.load0.address, align 4, !tbaa !1
43 %common.address.idx = add nuw nsw i32 %add7.i.7, %conv3.i42.i
44 %preheader.header.common.address.idx.zext = zext i32 %common.address.idx to i64
45 %preheader.load1.address = getelementptr inbounds float, float* @other_value, i64 %preheader.header.common.address.idx.zext
46 %preheader.load1. = load float, float* %preheader.load1.address, align 4, !tbaa !1
49 for.body23: ; preds = %for.body23, %entry
50 %loop.header.load0.address = getelementptr inbounds float, float* @other_value, i64 %preheader.header.common.address.idx.zext
51 %loop.header.load0. = load float, float* %loop.header.load0.address, align 4, !tbaa !1
52 %reass.mul343.7 = mul nuw nsw i32 %reass.add346.7, 72
53 %add7.i286.7.7 = add nuw nsw i32 %reass.mul343.7, 56
54 %add9.i288.7.7 = add nuw nsw i32 %add7.i286.7.7, %mul.i.i
55 %loop.header.address1.idx = add nuw nsw i32 %add9.i288.7.7, 1
56 %loop.header.address1.idx.zext = zext i32 %loop.header.address1.idx to i64
57 %loop.header.load1.address = getelementptr inbounds float, float* @other_value, i64 %loop.header.address1.idx.zext
58 %loop.header.load1. = load float, float* %loop.header.load1.address, align 4, !tbaa !1
59 store float %preheader.load0., float* @a, align 4, !tbaa !1
60 store float %preheader.load1., float* @b, align 4, !tbaa !1
61 store float %loop.header.load0., float* @c, align 4, !tbaa !1
62 store float %loop.header.load1., float* @d, align 4, !tbaa !1
63 %loaded.cnd = load i8, i8* @cnd
64 %condition = trunc i8 %loaded.cnd to i1
65 br i1 %condition, label %for.body23, label %exit
71 attributes #0 = { nounwind }
73 !0 = !{i32 0, i32 65536}
75 !2 = !{!"float", !3, i64 0}
76 !3 = !{!"omnipotent char", !4, i64 0}
77 !4 = !{!"Simple C++ TBAA"}