1 ; RUN: opt -passes=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: = load <2 x float>, ptr %preheader.load0.address
24 ; CHECK-LABEL: for.body23:
26 %tmp = load i32, ptr @global_value0, !range !0
27 %tmp2 = load i32, ptr @global_value1
28 %and.i.i = and i32 %tmp2, 2
29 %add.nuw.nsw.i.i = add nuw nsw i32 %and.i.i, 0
30 %mul.i.i = shl nuw nsw i32 %add.nuw.nsw.i.i, 1
31 %and6.i.i = and i32 %tmp2, 3
32 %and9.i.i = and i32 %tmp2, 4
33 %add.nuw.nsw10.i.i = add nuw nsw i32 %and6.i.i, %and9.i.i
34 %conv3.i42.i = add nuw nsw i32 %mul.i.i, 1
35 %reass.add346.7 = add nuw nsw i32 %add.nuw.nsw10.i.i, 56
36 %reass.mul347.7 = mul nuw nsw i32 %tmp, %reass.add346.7
37 %add7.i.7 = add nuw nsw i32 %reass.mul347.7, 0
38 %preheader.address0.idx = add nuw nsw i32 %add7.i.7, %mul.i.i
39 %preheader.address0.idx.zext = zext i32 %preheader.address0.idx to i64
40 %preheader.load0.address = getelementptr inbounds float, ptr @other_value, i64 %preheader.address0.idx.zext
41 %preheader.load0. = load float, ptr %preheader.load0.address, align 4, !tbaa !1
42 %common.address.idx = add nuw nsw i32 %add7.i.7, %conv3.i42.i
43 %preheader.header.common.address.idx.zext = zext i32 %common.address.idx to i64
44 %preheader.load1.address = getelementptr inbounds float, ptr @other_value, i64 %preheader.header.common.address.idx.zext
45 %preheader.load1. = load float, ptr %preheader.load1.address, align 4, !tbaa !1
48 for.body23: ; preds = %for.body23, %entry
49 %loop.header.load0.address = getelementptr inbounds float, ptr @other_value, i64 %preheader.header.common.address.idx.zext
50 %loop.header.load0. = load float, ptr %loop.header.load0.address, align 4, !tbaa !1
51 %reass.mul343.7 = mul nuw nsw i32 %reass.add346.7, 72
52 %add7.i286.7.7 = add nuw nsw i32 %reass.mul343.7, 56
53 %add9.i288.7.7 = add nuw nsw i32 %add7.i286.7.7, %mul.i.i
54 %loop.header.address1.idx = add nuw nsw i32 %add9.i288.7.7, 1
55 %loop.header.address1.idx.zext = zext i32 %loop.header.address1.idx to i64
56 %loop.header.load1.address = getelementptr inbounds float, ptr @other_value, i64 %loop.header.address1.idx.zext
57 %loop.header.load1. = load float, ptr %loop.header.load1.address, align 4, !tbaa !1
58 store float %preheader.load0., ptr @a, align 4, !tbaa !1
59 store float %preheader.load1., ptr @b, align 4, !tbaa !1
60 store float %loop.header.load0., ptr @c, align 4, !tbaa !1
61 store float %loop.header.load1., ptr @d, align 4, !tbaa !1
62 %loaded.cnd = load i8, ptr @cnd
63 %condition = trunc i8 %loaded.cnd to i1
64 br i1 %condition, label %for.body23, label %exit
70 attributes #0 = { nounwind }
72 !0 = !{i32 0, i32 65536}
74 !2 = !{!"float", !3, i64 0}
75 !3 = !{!"omnipotent char", !4, i64 0}
76 !4 = !{!"Simple C++ TBAA"}