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