summaryrefslogtreecommitdiff
path: root/test/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/BasicAA/intrinsics.ll7
-rw-r--r--test/Analysis/BasicAA/invariant_load.ll29
-rw-r--r--test/Analysis/BasicAA/phi-spec-order.ll71
-rw-r--r--test/Analysis/BasicAA/phi-speculation.ll65
-rw-r--r--test/Analysis/BasicAA/pure-const-dce.ll9
-rw-r--r--test/Analysis/CostModel/ARM/cast.ll547
-rw-r--r--test/Analysis/CostModel/ARM/gep.ll43
-rw-r--r--test/Analysis/CostModel/ARM/insertelement.ll46
-rw-r--r--test/Analysis/CostModel/ARM/lit.local.cfg6
-rw-r--r--test/Analysis/CostModel/ARM/select.ll67
-rw-r--r--test/Analysis/CostModel/ARM/shuffle.ll40
-rw-r--r--test/Analysis/CostModel/PowerPC/insert_extract.ll16
-rw-r--r--test/Analysis/CostModel/PowerPC/lit.local.cfg6
-rw-r--r--test/Analysis/CostModel/PowerPC/load_store.ll34
-rw-r--r--test/Analysis/CostModel/X86/arith.ll90
-rw-r--r--test/Analysis/CostModel/X86/cast.ll89
-rw-r--r--test/Analysis/CostModel/X86/cmp.ll44
-rw-r--r--test/Analysis/CostModel/X86/gep.ll40
-rw-r--r--test/Analysis/CostModel/X86/i32.ll4
-rw-r--r--test/Analysis/CostModel/X86/intrinsic-cost.ll32
-rw-r--r--test/Analysis/CostModel/X86/load_store.ll64
-rw-r--r--test/Analysis/CostModel/X86/testshiftashr.ll531
-rw-r--r--test/Analysis/CostModel/X86/testshiftlshr.ll530
-rw-r--r--test/Analysis/CostModel/X86/testshiftshl.ll530
-rw-r--r--test/Analysis/CostModel/X86/tiny.ll2
-rw-r--r--test/Analysis/CostModel/X86/vectorized-loop.ll11
-rw-r--r--test/Analysis/CostModel/no_info.ll5
-rw-r--r--test/Analysis/DependenceAnalysis/Banerjee.ll152
-rw-r--r--test/Analysis/DependenceAnalysis/Coupled.ll329
-rw-r--r--test/Analysis/DependenceAnalysis/ExactRDIV.ll402
-rw-r--r--test/Analysis/DependenceAnalysis/ExactSIV.ll252
-rw-r--r--test/Analysis/DependenceAnalysis/GCD.ll158
-rw-r--r--test/Analysis/DependenceAnalysis/Preliminary.ll644
-rw-r--r--test/Analysis/DependenceAnalysis/Propagating.ll302
-rw-r--r--test/Analysis/DependenceAnalysis/Separability.ll188
-rw-r--r--test/Analysis/DependenceAnalysis/StrongSIV.ll330
-rw-r--r--test/Analysis/DependenceAnalysis/SymbolicRDIV.ll357
-rw-r--r--test/Analysis/DependenceAnalysis/SymbolicSIV.ll271
-rw-r--r--test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll186
-rw-r--r--test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll168
-rw-r--r--test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll168
-rw-r--r--test/Analysis/DependenceAnalysis/ZIV.ll39
-rw-r--r--test/Analysis/Dominators/invoke.ll2
-rw-r--r--test/Analysis/Profiling/lit.local.cfg15
-rw-r--r--test/Analysis/RegionInfo/20100809_bb_not_in_domtree.ll2
-rw-r--r--test/Analysis/RegionInfo/block_sort.ll1
-rw-r--r--test/Analysis/RegionInfo/cond_loop.ll1
-rw-r--r--test/Analysis/RegionInfo/condition_complicated.ll1
-rw-r--r--test/Analysis/RegionInfo/condition_complicated_2.ll1
-rw-r--r--test/Analysis/RegionInfo/condition_forward_edge.ll1
-rw-r--r--test/Analysis/RegionInfo/condition_same_exit.ll1
-rw-r--r--test/Analysis/RegionInfo/condition_simple.ll1
-rw-r--r--test/Analysis/RegionInfo/exit_in_condition.ll1
-rw-r--r--test/Analysis/RegionInfo/infinite_loop.ll1
-rw-r--r--test/Analysis/RegionInfo/infinite_loop_2.ll1
-rw-r--r--test/Analysis/RegionInfo/infinite_loop_3.ll1
-rw-r--r--test/Analysis/RegionInfo/infinite_loop_4.ll1
-rw-r--r--test/Analysis/RegionInfo/loop_with_condition.ll1
-rw-r--r--test/Analysis/RegionInfo/loops_1.ll1
-rw-r--r--test/Analysis/RegionInfo/loops_2.ll1
-rw-r--r--test/Analysis/RegionInfo/mix_1.ll1
-rw-r--r--test/Analysis/RegionInfo/nested_loops.ll1
-rw-r--r--test/Analysis/RegionInfo/next.ll1
-rw-r--r--test/Analysis/RegionInfo/paper.ll1
-rw-r--r--test/Analysis/RegionInfo/two_loops_same_header.ll1
-rw-r--r--test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll4
-rw-r--r--test/Analysis/ScalarEvolution/2011-03-09-ExactNoMaxBECount.ll2
-rw-r--r--test/Analysis/ScalarEvolution/fold.ll2
-rw-r--r--test/Analysis/ScalarEvolution/scev-invalid.ll34
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll20
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll5
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/placement-tbaa.ll104
72 files changed, 5717 insertions, 1397 deletions
diff --git a/test/Analysis/BasicAA/intrinsics.ll b/test/Analysis/BasicAA/intrinsics.ll
index 59725cfded05..c1cf587204cf 100644
--- a/test/Analysis/BasicAA/intrinsics.ll
+++ b/test/Analysis/BasicAA/intrinsics.ll
@@ -7,7 +7,7 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-
; CHECK: define <8 x i16> @test0(i8* noalias %p, i8* noalias %q, <8 x i16> %y) {
; CHECK-NEXT: entry:
-; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) nounwind
+; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) [[ATTR:#[0-9]+]]
; CHECK-NEXT: call void @llvm.arm.neon.vst1.v8i16(i8* %q, <8 x i16> %y, i32 16)
; CHECK-NEXT: %c = add <8 x i16> %a, %a
define <8 x i16> @test0(i8* noalias %p, i8* noalias %q, <8 x i16> %y) {
@@ -22,7 +22,7 @@ entry:
; CHECK: define <8 x i16> @test1(i8* %p, <8 x i16> %y) {
; CHECK-NEXT: entry:
; CHECK-NEXT: %q = getelementptr i8* %p, i64 16
-; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) nounwind
+; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) [[ATTR]]
; CHECK-NEXT: call void @llvm.arm.neon.vst1.v8i16(i8* %q, <8 x i16> %y, i32 16)
; CHECK-NEXT: %c = add <8 x i16> %a, %a
define <8 x i16> @test1(i8* %p, <8 x i16> %y) {
@@ -37,3 +37,6 @@ entry:
declare <8 x i16> @llvm.arm.neon.vld1.v8i16(i8*, i32) nounwind readonly
declare void @llvm.arm.neon.vst1.v8i16(i8*, <8 x i16>, i32) nounwind
+
+; CHECK: attributes #0 = { nounwind readonly }
+; CHECK: attributes [[ATTR]] = { nounwind }
diff --git a/test/Analysis/BasicAA/invariant_load.ll b/test/Analysis/BasicAA/invariant_load.ll
new file mode 100644
index 000000000000..cd6ddb92d210
--- /dev/null
+++ b/test/Analysis/BasicAA/invariant_load.ll
@@ -0,0 +1,29 @@
+; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
+
+; The input *.ll is obtained by manually annotating "invariant.load" to the
+; two loads. With "invariant.load" metadata, the second load is redundant.
+;
+; int foo(int *p, char *q) {
+; *q = (char)*p;
+; return *p + 1;
+; }
+
+define i32 @foo(i32* nocapture %p, i8* nocapture %q) {
+entry:
+ %0 = load i32* %p, align 4, !tbaa !0, !invariant.load !3
+ %conv = trunc i32 %0 to i8
+ store i8 %conv, i8* %q, align 1, !tbaa !1
+ %1 = load i32* %p, align 4, !tbaa !0, !invariant.load !3
+ %add = add nsw i32 %1, 1
+ ret i32 %add
+
+; CHECK: foo
+; CHECK: %0 = load i32* %p
+; CHECK: store i8 %conv, i8* %q,
+; CHECK: %add = add nsw i32 %0, 1
+}
+
+!0 = metadata !{metadata !"int", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA"}
+!3 = metadata !{}
diff --git a/test/Analysis/BasicAA/phi-spec-order.ll b/test/Analysis/BasicAA/phi-spec-order.ll
new file mode 100644
index 000000000000..27d47bcd5bf3
--- /dev/null
+++ b/test/Analysis/BasicAA/phi-spec-order.ll
@@ -0,0 +1,71 @@
+target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-bgq-linux"
+; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
+
+@X = external global [16000 x double], align 32
+@Y = external global [16000 x double], align 32
+
+define signext i32 @s000() nounwind {
+entry:
+ br label %for.cond2.preheader
+
+for.cond2.preheader: ; preds = %for.end, %entry
+ %nl.018 = phi i32 [ 0, %entry ], [ %inc9, %for.end ]
+ br label %for.body4
+
+for.body4: ; preds = %for.body4, %for.cond2.preheader
+ %lsr.iv4 = phi [16000 x double]* [ %i11, %for.body4 ], [ bitcast (double* getelementptr inbounds ([16000 x double]* @Y, i64 0, i64 8)
+ to [16000 x double]*), %for.cond2.preheader ]
+ %lsr.iv1 = phi [16000 x double]* [ %i10, %for.body4 ], [ @X, %for.cond2.preheader ]
+
+; CHECK: NoAlias:{{[ \t]+}}[16000 x double]* %lsr.iv1, [16000 x double]* %lsr.iv4
+
+ %lsr.iv = phi i32 [ %lsr.iv.next, %for.body4 ], [ 16000, %for.cond2.preheader ]
+ %lsr.iv46 = bitcast [16000 x double]* %lsr.iv4 to <4 x double>*
+ %lsr.iv12 = bitcast [16000 x double]* %lsr.iv1 to <4 x double>*
+ %scevgep11 = getelementptr <4 x double>* %lsr.iv46, i64 -2
+ %i6 = load <4 x double>* %scevgep11, align 32, !tbaa !0
+ %add = fadd <4 x double> %i6, <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>
+ store <4 x double> %add, <4 x double>* %lsr.iv12, align 32, !tbaa !0
+ %scevgep10 = getelementptr <4 x double>* %lsr.iv46, i64 -1
+ %i7 = load <4 x double>* %scevgep10, align 32, !tbaa !0
+ %add.4 = fadd <4 x double> %i7, <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>
+ %scevgep9 = getelementptr <4 x double>* %lsr.iv12, i64 1
+ store <4 x double> %add.4, <4 x double>* %scevgep9, align 32, !tbaa !0
+ %i8 = load <4 x double>* %lsr.iv46, align 32, !tbaa !0
+ %add.8 = fadd <4 x double> %i8, <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>
+ %scevgep8 = getelementptr <4 x double>* %lsr.iv12, i64 2
+ store <4 x double> %add.8, <4 x double>* %scevgep8, align 32, !tbaa !0
+ %scevgep7 = getelementptr <4 x double>* %lsr.iv46, i64 1
+ %i9 = load <4 x double>* %scevgep7, align 32, !tbaa !0
+ %add.12 = fadd <4 x double> %i9, <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>
+ %scevgep3 = getelementptr <4 x double>* %lsr.iv12, i64 3
+ store <4 x double> %add.12, <4 x double>* %scevgep3, align 32, !tbaa !0
+
+; CHECK: NoAlias:{{[ \t]+}}<4 x double>* %scevgep11, <4 x double>* %scevgep7
+; CHECK: NoAlias:{{[ \t]+}}<4 x double>* %scevgep10, <4 x double>* %scevgep7
+; CHECK: NoAlias:{{[ \t]+}}<4 x double>* %scevgep7, <4 x double>* %scevgep9
+; CHECK: NoAlias:{{[ \t]+}}<4 x double>* %scevgep11, <4 x double>* %scevgep3
+; CHECK: NoAlias:{{[ \t]+}}<4 x double>* %scevgep10, <4 x double>* %scevgep3
+; CHECK: NoAlias:{{[ \t]+}}<4 x double>* %scevgep3, <4 x double>* %scevgep9
+
+ %lsr.iv.next = add i32 %lsr.iv, -16
+ %scevgep = getelementptr [16000 x double]* %lsr.iv1, i64 0, i64 16
+ %i10 = bitcast double* %scevgep to [16000 x double]*
+ %scevgep5 = getelementptr [16000 x double]* %lsr.iv4, i64 0, i64 16
+ %i11 = bitcast double* %scevgep5 to [16000 x double]*
+ %exitcond.15 = icmp eq i32 %lsr.iv.next, 0
+ br i1 %exitcond.15, label %for.end, label %for.body4
+
+for.end: ; preds = %for.body4
+ %inc9 = add nsw i32 %nl.018, 1
+ %exitcond = icmp eq i32 %inc9, 400000
+ br i1 %exitcond, label %for.end10, label %for.cond2.preheader
+
+for.end10: ; preds = %for.end
+ ret i32 0
+}
+
+!0 = metadata !{metadata !"double", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA"}
diff --git a/test/Analysis/BasicAA/phi-speculation.ll b/test/Analysis/BasicAA/phi-speculation.ll
index 21c65929862f..5e1e118d9855 100644
--- a/test/Analysis/BasicAA/phi-speculation.ll
+++ b/test/Analysis/BasicAA/phi-speculation.ll
@@ -4,9 +4,9 @@ target datalayout =
; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
; ptr_phi and ptr2_phi do not alias.
+; CHECK: test_noalias_1
; CHECK: NoAlias: i32* %ptr2_phi, i32* %ptr_phi
-
-define i32 @test_noalias(i32* %ptr2, i32 %count, i32* %coeff) {
+define i32 @test_noalias_1(i32* %ptr2, i32 %count, i32* %coeff) {
entry:
%ptr = getelementptr inbounds i32* %ptr2, i64 1
br label %while.body
@@ -31,3 +31,64 @@ while.body:
the_exit:
ret i32 %add
}
+
+; CHECK: test_noalias_2
+; CHECK: NoAlias: i32* %ptr_outer_phi, i32* %ptr_outer_phi2
+; CHECK: NoAlias: i32* %ptr2_phi, i32* %ptr_phi
+define i32 @test_noalias_2(i32* %ptr2, i32 %count, i32* %coeff) {
+entry:
+ %ptr = getelementptr inbounds i32* %ptr2, i64 1
+ br label %outer.while.header
+
+outer.while.header:
+ %ptr_outer_phi = phi i32* [%ptr_inc_outer, %outer.while.backedge], [ %ptr, %entry]
+ %ptr_outer_phi2 = phi i32* [%ptr2_inc_outer, %outer.while.backedge], [ %ptr2, %entry]
+ %num.outer = phi i32 [ %count, %entry ], [ %dec.outer, %outer.while.backedge ]
+ br label %while.body
+
+while.body:
+ %num = phi i32 [ %count, %outer.while.header ], [ %dec, %while.body ]
+ %ptr_phi = phi i32* [ %ptr_outer_phi, %outer.while.header ], [ %ptr_inc, %while.body ]
+ %ptr2_phi = phi i32* [ %ptr_outer_phi2, %outer.while.header ], [ %ptr2_inc, %while.body ]
+ %result.09 = phi i32 [ 0 , %outer.while.header ], [ %add, %while.body ]
+ %dec = add nsw i32 %num, -1
+ %0 = load i32* %ptr_phi, align 4
+ store i32 %0, i32* %ptr2_phi, align 4
+ %1 = load i32* %coeff, align 4
+ %2 = load i32* %ptr_phi, align 4
+ %mul = mul nsw i32 %1, %2
+ %add = add nsw i32 %mul, %result.09
+ %tobool = icmp eq i32 %dec, 0
+ %ptr_inc = getelementptr inbounds i32* %ptr_phi, i64 1
+ %ptr2_inc = getelementptr inbounds i32* %ptr2_phi, i64 1
+ br i1 %tobool, label %outer.while.backedge, label %while.body
+
+outer.while.backedge:
+ %ptr_inc_outer = getelementptr inbounds i32* %ptr_phi, i64 1
+ %ptr2_inc_outer = getelementptr inbounds i32* %ptr2_phi, i64 1
+ %dec.outer = add nsw i32 %num.outer, -1
+ %br.cond = icmp eq i32 %dec.outer, 0
+ br i1 %br.cond, label %the_exit, label %outer.while.header
+
+the_exit:
+ ret i32 %add
+}
+
+; CHECK: test_noalias_3
+; CHECK: MayAlias: i8* %ptr2_phi, i8* %ptr_phi
+define i32 @test_noalias_3(i8* noalias %x, i8* noalias %y, i8* noalias %z,
+ i32 %count) {
+entry:
+ br label %while.body
+
+while.body:
+ %num = phi i32 [ %count, %entry ], [ %dec, %while.body ]
+ %ptr_phi = phi i8* [ %x, %entry ], [ %z, %while.body ]
+ %ptr2_phi = phi i8* [ %y, %entry ], [ %ptr_phi, %while.body ]
+ %dec = add nsw i32 %num, -1
+ %tobool = icmp eq i32 %dec, 0
+ br i1 %tobool, label %the_exit, label %while.body
+
+the_exit:
+ ret i32 1
+}
diff --git a/test/Analysis/BasicAA/pure-const-dce.ll b/test/Analysis/BasicAA/pure-const-dce.ll
index 266e607b21a4..e48992860a60 100644
--- a/test/Analysis/BasicAA/pure-const-dce.ll
+++ b/test/Analysis/BasicAA/pure-const-dce.ll
@@ -4,11 +4,11 @@
; CHECK: @test
; CHECK: entry
-; CHECK: %tmp0 = call i32 @TestConst(i32 5) readnone
-; CHECK-NEXT: %tmp1 = call i32 @TestPure(i32 6) readonly
+; CHECK: %tmp0 = call i32 @TestConst(i32 5) [[READNONE:#[0-9]+]]
+; CHECK-NEXT: %tmp1 = call i32 @TestPure(i32 6) [[READONLY:#[0-9]+]]
; CHECK-NEXT: %tmp2 = call i32 @TestNone(i32 7)
; CHECK-NEXT: store i32 1, i32* @g
-; CHECK-NEXT: %tmp5 = call i32 @TestPure(i32 6) readonly
+; CHECK-NEXT: %tmp5 = call i32 @TestPure(i32 6) [[READONLY]]
; CHECK-NEXT: %tmp7 = call i32 @TestNone(i32 7)
; CHECK-NEXT: %tmp8 = call i32 @TestNone(i32 7)
; CHECK-NEXT: %sum0 = add i32 %tmp0, %tmp1
@@ -49,3 +49,6 @@ declare i32 @TestConst(i32) readnone
declare i32 @TestPure(i32) readonly
declare i32 @TestNone(i32)
+
+; CHECK: attributes [[READNONE]] = { readnone }
+; CHECK: attributes [[READONLY]] = { readonly }
diff --git a/test/Analysis/CostModel/ARM/cast.ll b/test/Analysis/CostModel/ARM/cast.ll
new file mode 100644
index 000000000000..ba9d84cf3e23
--- /dev/null
+++ b/test/Analysis/CostModel/ARM/cast.ll
@@ -0,0 +1,547 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=cortex-a8 | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+target triple = "thumbv7-apple-ios6.0.0"
+
+define i32 @casts() {
+
+ ; -- scalars --
+ ; CHECK: cost of 1 {{.*}} sext
+ %r0 = sext i1 undef to i8
+ ; CHECK: cost of 1 {{.*}} zext
+ %r1 = zext i1 undef to i8
+ ; CHECK: cost of 1 {{.*}} sext
+ %r2 = sext i1 undef to i16
+ ; CHECK: cost of 1 {{.*}} zext
+ %r3 = zext i1 undef to i16
+ ; CHECK: cost of 1 {{.*}} sext
+ %r4 = sext i1 undef to i32
+ ; CHECK: cost of 1 {{.*}} zext
+ %r5 = zext i1 undef to i32
+ ; CHECK: cost of 1 {{.*}} sext
+ %r6 = sext i1 undef to i64
+ ; CHECK: cost of 1 {{.*}} zext
+ %r7 = zext i1 undef to i64
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r8 = trunc i8 undef to i1
+ ; CHECK: cost of 1 {{.*}} sext
+ %r9 = sext i8 undef to i16
+ ; CHECK: cost of 1 {{.*}} zext
+ %r10 = zext i8 undef to i16
+ ; CHECK: cost of 1 {{.*}} sext
+ %r11 = sext i8 undef to i32
+ ; CHECK: cost of 1 {{.*}} zext
+ %r12 = zext i8 undef to i32
+ ; CHECK: cost of 1 {{.*}} sext
+ %r13 = sext i8 undef to i64
+ ; CHECK: cost of 1 {{.*}} zext
+ %r14 = zext i8 undef to i64
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r15 = trunc i16 undef to i1
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r16 = trunc i16 undef to i8
+ ; CHECK: cost of 1 {{.*}} sext
+ %r17 = sext i16 undef to i32
+ ; CHECK: cost of 1 {{.*}} zext
+ %r18 = zext i16 undef to i32
+ ; CHECK: cost of 2 {{.*}} sext
+ %r19 = sext i16 undef to i64
+ ; CHECK: cost of 1 {{.*}} zext
+ %r20 = zext i16 undef to i64
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r21 = trunc i32 undef to i1
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r22 = trunc i32 undef to i8
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r23 = trunc i32 undef to i16
+ ; CHECK: cost of 1 {{.*}} sext
+ %r24 = sext i32 undef to i64
+ ; CHECK: cost of 1 {{.*}} zext
+ %r25 = zext i32 undef to i64
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r26 = trunc i64 undef to i1
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r27 = trunc i64 undef to i8
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r28 = trunc i64 undef to i16
+ ; CHECK: cost of 0 {{.*}} trunc
+ %r29 = trunc i64 undef to i32
+
+ ; -- floating point conversions --
+ ; Moves between scalar and NEON registers.
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r30 = fptoui float undef to i1
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r31 = fptosi float undef to i1
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r32 = fptoui float undef to i8
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r33 = fptosi float undef to i8
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r34 = fptoui float undef to i16
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r35 = fptosi float undef to i16
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r36 = fptoui float undef to i32
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r37 = fptosi float undef to i32
+ ; CHECK: cost of 10 {{.*}} fptoui
+ %r38 = fptoui float undef to i64
+ ; CHECK: cost of 10 {{.*}} fptosi
+ %r39 = fptosi float undef to i64
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r40 = fptoui double undef to i1
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r41 = fptosi double undef to i1
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r42 = fptoui double undef to i8
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r43 = fptosi double undef to i8
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r44 = fptoui double undef to i16
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r45 = fptosi double undef to i16
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r46 = fptoui double undef to i32
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r47 = fptosi double undef to i32
+ ; Function call
+ ; CHECK: cost of 10 {{.*}} fptoui
+ %r48 = fptoui double undef to i64
+ ; CHECK: cost of 10 {{.*}} fptosi
+ %r49 = fptosi double undef to i64
+
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r50 = sitofp i1 undef to float
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r51 = uitofp i1 undef to float
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r52 = sitofp i1 undef to double
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r53 = uitofp i1 undef to double
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r54 = sitofp i8 undef to float
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r55 = uitofp i8 undef to float
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r56 = sitofp i8 undef to double
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r57 = uitofp i8 undef to double
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r58 = sitofp i16 undef to float
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r59 = uitofp i16 undef to float
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r60 = sitofp i16 undef to double
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r61 = uitofp i16 undef to double
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r62 = sitofp i32 undef to float
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r63 = uitofp i32 undef to float
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r64 = sitofp i32 undef to double
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r65 = uitofp i32 undef to double
+ ; Function call
+ ; CHECK: cost of 10 {{.*}} sitofp
+ %r66 = sitofp i64 undef to float
+ ; CHECK: cost of 10 {{.*}} uitofp
+ %r67 = uitofp i64 undef to float
+ ; CHECK: cost of 10 {{.*}} sitofp
+ %r68 = sitofp i64 undef to double
+ ; CHECK: cost of 10 {{.*}} uitofp
+ %r69 = uitofp i64 undef to double
+
+ ; CHECK: cost of 3 {{.*}} sext
+ %r70 = sext <8 x i8> undef to <8 x i32>
+ ; CHECK: cost of 6 {{.*}} sext
+ %r71 = sext <16 x i8> undef to <16 x i32>
+ ; CHECK: cost of 3 {{.*}} zext
+ %r72 = zext <8 x i8> undef to <8 x i32>
+ ; CHECK: cost of 6 {{.*}} zext
+ %r73 = zext <16 x i8> undef to <16 x i32>
+
+ ; CHECK: cost of 7 {{.*}} sext
+ %rext_0 = sext <8 x i8> undef to <8 x i64>
+ ; CHECK: cost of 7 {{.*}} zext
+ %rext_1 = zext <8 x i8> undef to <8 x i64>
+ ; CHECK: cost of 6 {{.*}} sext
+ %rext_2 = sext <8 x i16> undef to <8 x i64>
+ ; CHECK: cost of 6 {{.*}} zext
+ %rext_3 = zext <8 x i16> undef to <8 x i64>
+ ; CHECK: cost of 3 {{.*}} sext
+ %rext_4 = sext <4 x i16> undef to <4 x i64>
+ ; CHECK: cost of 3 {{.*}} zext
+ %rext_5 = zext <4 x i16> undef to <4 x i64>
+
+ ; Vector cast cost of instructions lowering the cast to the stack.
+ ; CHECK: cost of 19 {{.*}} trunc
+ %r74 = trunc <8 x i32> undef to <8 x i8>
+ ; CHECK: cost of 38 {{.*}} trunc
+ %r75 = trunc <16 x i32> undef to <16 x i8>
+
+ ; Floating point truncation costs.
+ ; CHECK: cost of 1 {{.*}} fptrunc double
+ %r80 = fptrunc double undef to float
+ ; CHECK: cost of 2 {{.*}} fptrunc <2 x double
+ %r81 = fptrunc <2 x double> undef to <2 x float>
+ ; CHECK: cost of 4 {{.*}} fptrunc <4 x double
+ %r82 = fptrunc <4 x double> undef to <4 x float>
+ ; CHECK: cost of 8 {{.*}} fptrunc <8 x double
+ %r83 = fptrunc <8 x double> undef to <8 x float>
+ ; CHECK: cost of 16 {{.*}} fptrunc <16 x double
+ %r84 = fptrunc <16 x double> undef to <16 x float>
+
+ ; Floating point extension costs.
+ ; CHECK: cost of 1 {{.*}} fpext float
+ %r85 = fpext float undef to double
+ ; CHECK: cost of 2 {{.*}} fpext <2 x float
+ %r86 = fpext <2 x float> undef to <2 x double>
+ ; CHECK: cost of 4 {{.*}} fpext <4 x float
+ %r87 = fpext <4 x float> undef to <4 x double>
+ ; CHECK: cost of 8 {{.*}} fpext <8 x float
+ %r88 = fpext <8 x float> undef to <8 x double>
+ ; CHECK: cost of 16 {{.*}} fpext <16 x float
+ %r89 = fpext <16 x float> undef to <16 x double>
+
+ ;; Floating point to integer vector casts.
+ ; CHECK: cost of 1 {{.*}} fptoui
+ %r90 = fptoui <2 x float> undef to <2 x i1>
+ ; CHECK: cost of 1 {{.*}} fptosi
+ %r91 = fptosi <2 x float> undef to <2 x i1>
+ ; CHECK: cost of 1 {{.*}} fptoui
+ %r92 = fptoui <2 x float> undef to <2 x i8>
+ ; CHECK: cost of 1 {{.*}} fptosi
+ %r93 = fptosi <2 x float> undef to <2 x i8>
+ ; CHECK: cost of 1 {{.*}} fptoui
+ %r94 = fptoui <2 x float> undef to <2 x i16>
+ ; CHECK: cost of 1 {{.*}} fptosi
+ %r95 = fptosi <2 x float> undef to <2 x i16>
+ ; CHECK: cost of 1 {{.*}} fptoui
+ %r96 = fptoui <2 x float> undef to <2 x i32>
+ ; CHECK: cost of 1 {{.*}} fptosi
+ %r97 = fptosi <2 x float> undef to <2 x i32>
+ ; CHECK: cost of 24 {{.*}} fptoui
+ %r98 = fptoui <2 x float> undef to <2 x i64>
+ ; CHECK: cost of 24 {{.*}} fptosi
+ %r99 = fptosi <2 x float> undef to <2 x i64>
+
+ ; CHECK: cost of 8 {{.*}} fptoui
+ %r100 = fptoui <2 x double> undef to <2 x i1>
+ ; CHECK: cost of 8 {{.*}} fptosi
+ %r101 = fptosi <2 x double> undef to <2 x i1>
+ ; CHECK: cost of 8 {{.*}} fptoui
+ %r102 = fptoui <2 x double> undef to <2 x i8>
+ ; CHECK: cost of 8 {{.*}} fptosi
+ %r103 = fptosi <2 x double> undef to <2 x i8>
+ ; CHECK: cost of 8 {{.*}} fptoui
+ %r104 = fptoui <2 x double> undef to <2 x i16>
+ ; CHECK: cost of 8 {{.*}} fptosi
+ %r105 = fptosi <2 x double> undef to <2 x i16>
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r106 = fptoui <2 x double> undef to <2 x i32>
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r107 = fptosi <2 x double> undef to <2 x i32>
+ ; CHECK: cost of 24 {{.*}} fptoui
+ %r108 = fptoui <2 x double> undef to <2 x i64>
+ ; CHECK: cost of 24 {{.*}} fptosi
+ %r109 = fptosi <2 x double> undef to <2 x i64>
+
+ ; CHECK: cost of 16 {{.*}} fptoui
+ %r110 = fptoui <4 x float> undef to <4 x i1>
+ ; CHECK: cost of 16 {{.*}} fptosi
+ %r111 = fptosi <4 x float> undef to <4 x i1>
+ ; CHECK: cost of 3 {{.*}} fptoui
+ %r112 = fptoui <4 x float> undef to <4 x i8>
+ ; CHECK: cost of 3 {{.*}} fptosi
+ %r113 = fptosi <4 x float> undef to <4 x i8>
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r114 = fptoui <4 x float> undef to <4 x i16>
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r115 = fptosi <4 x float> undef to <4 x i16>
+ ; CHECK: cost of 1 {{.*}} fptoui
+ %r116 = fptoui <4 x float> undef to <4 x i32>
+ ; CHECK: cost of 1 {{.*}} fptosi
+ %r117 = fptosi <4 x float> undef to <4 x i32>
+ ; CHECK: cost of 48 {{.*}} fptoui
+ %r118 = fptoui <4 x float> undef to <4 x i64>
+ ; CHECK: cost of 48 {{.*}} fptosi
+ %r119 = fptosi <4 x float> undef to <4 x i64>
+
+ ; CHECK: cost of 16 {{.*}} fptoui
+ %r120 = fptoui <4 x double> undef to <4 x i1>
+ ; CHECK: cost of 16 {{.*}} fptosi
+ %r121 = fptosi <4 x double> undef to <4 x i1>
+ ; CHECK: cost of 16 {{.*}} fptoui
+ %r122 = fptoui <4 x double> undef to <4 x i8>
+ ; CHECK: cost of 16 {{.*}} fptosi
+ %r123 = fptosi <4 x double> undef to <4 x i8>
+ ; CHECK: cost of 16 {{.*}} fptoui
+ %r124 = fptoui <4 x double> undef to <4 x i16>
+ ; CHECK: cost of 16 {{.*}} fptosi
+ %r125 = fptosi <4 x double> undef to <4 x i16>
+ ; CHECK: cost of 16 {{.*}} fptoui
+ %r126 = fptoui <4 x double> undef to <4 x i32>
+ ; CHECK: cost of 16 {{.*}} fptosi
+ %r127 = fptosi <4 x double> undef to <4 x i32>
+ ; CHECK: cost of 48 {{.*}} fptoui
+ %r128 = fptoui <4 x double> undef to <4 x i64>
+ ; CHECK: cost of 48 {{.*}} fptosi
+ %r129 = fptosi <4 x double> undef to <4 x i64>
+
+ ; CHECK: cost of 32 {{.*}} fptoui
+ %r130 = fptoui <8 x float> undef to <8 x i1>
+ ; CHECK: cost of 32 {{.*}} fptosi
+ %r131 = fptosi <8 x float> undef to <8 x i1>
+ ; CHECK: cost of 32 {{.*}} fptoui
+ %r132 = fptoui <8 x float> undef to <8 x i8>
+ ; CHECK: cost of 32 {{.*}} fptosi
+ %r133 = fptosi <8 x float> undef to <8 x i8>
+ ; CHECK: cost of 4 {{.*}} fptoui
+ %r134 = fptoui <8 x float> undef to <8 x i16>
+ ; CHECK: cost of 4 {{.*}} fptosi
+ %r135 = fptosi <8 x float> undef to <8 x i16>
+ ; CHECK: cost of 2 {{.*}} fptoui
+ %r136 = fptoui <8 x float> undef to <8 x i32>
+ ; CHECK: cost of 2 {{.*}} fptosi
+ %r137 = fptosi <8 x float> undef to <8 x i32>
+ ; CHECK: cost of 96 {{.*}} fptoui
+ %r138 = fptoui <8 x float> undef to <8 x i64>
+ ; CHECK: cost of 96 {{.*}} fptosi
+ %r139 = fptosi <8 x float> undef to <8 x i64>
+
+ ; CHECK: cost of 32 {{.*}} fptoui
+ %r140 = fptoui <8 x double> undef to <8 x i1>
+ ; CHECK: cost of 32 {{.*}} fptosi
+ %r141 = fptosi <8 x double> undef to <8 x i1>
+ ; CHECK: cost of 32 {{.*}} fptoui
+ %r142 = fptoui <8 x double> undef to <8 x i8>
+ ; CHECK: cost of 32 {{.*}} fptosi
+ %r143 = fptosi <8 x double> undef to <8 x i8>
+ ; CHECK: cost of 32 {{.*}} fptoui
+ %r144 = fptoui <8 x double> undef to <8 x i16>
+ ; CHECK: cost of 32 {{.*}} fptosi
+ %r145 = fptosi <8 x double> undef to <8 x i16>
+ ; CHECK: cost of 32 {{.*}} fptoui
+ %r146 = fptoui <8 x double> undef to <8 x i32>
+ ; CHECK: cost of 32 {{.*}} fptosi
+ %r147 = fptosi <8 x double> undef to <8 x i32>
+ ; CHECK: cost of 96 {{.*}} fptoui
+ %r148 = fptoui <8 x double> undef to <8 x i64>
+ ; CHECK: cost of 96 {{.*}} fptosi
+ %r149 = fptosi <8 x double> undef to <8 x i64>
+
+ ; CHECK: cost of 64 {{.*}} fptoui
+ %r150 = fptoui <16 x float> undef to <16 x i1>
+ ; CHECK: cost of 64 {{.*}} fptosi
+ %r151 = fptosi <16 x float> undef to <16 x i1>
+ ; CHECK: cost of 64 {{.*}} fptoui
+ %r152 = fptoui <16 x float> undef to <16 x i8>
+ ; CHECK: cost of 64 {{.*}} fptosi
+ %r153 = fptosi <16 x float> undef to <16 x i8>
+ ; CHECK: cost of 8 {{.*}} fptoui
+ %r154 = fptoui <16 x float> undef to <16 x i16>
+ ; CHECK: cost of 8 {{.*}} fptosi
+ %r155 = fptosi <16 x float> undef to <16 x i16>
+ ; CHECK: cost of 4 {{.*}} fptoui
+ %r156 = fptoui <16 x float> undef to <16 x i32>
+ ; CHECK: cost of 4 {{.*}} fptosi
+ %r157 = fptosi <16 x float> undef to <16 x i32>
+ ; CHECK: cost of 192 {{.*}} fptoui
+ %r158 = fptoui <16 x float> undef to <16 x i64>
+ ; CHECK: cost of 192 {{.*}} fptosi
+ %r159 = fptosi <16 x float> undef to <16 x i64>
+
+ ; CHECK: cost of 64 {{.*}} fptoui
+ %r160 = fptoui <16 x double> undef to <16 x i1>
+ ; CHECK: cost of 64 {{.*}} fptosi
+ %r161 = fptosi <16 x double> undef to <16 x i1>
+ ; CHECK: cost of 64 {{.*}} fptoui
+ %r162 = fptoui <16 x double> undef to <16 x i8>
+ ; CHECK: cost of 64 {{.*}} fptosi
+ %r163 = fptosi <16 x double> undef to <16 x i8>
+ ; CHECK: cost of 64 {{.*}} fptoui
+ %r164 = fptoui <16 x double> undef to <16 x i16>
+ ; CHECK: cost of 64 {{.*}} fptosi
+ %r165 = fptosi <16 x double> undef to <16 x i16>
+ ; CHECK: cost of 64 {{.*}} fptoui
+ %r166 = fptoui <16 x double> undef to <16 x i32>
+ ; CHECK: cost of 64 {{.*}} fptosi
+ %r167 = fptosi <16 x double> undef to <16 x i32>
+ ; CHECK: cost of 192 {{.*}} fptoui
+ %r168 = fptoui <16 x double> undef to <16 x i64>
+ ; CHECK: cost of 192 {{.*}} fptosi
+ %r169 = fptosi <16 x double> undef to <16 x i64>
+
+ ; CHECK: cost of 8 {{.*}} uitofp
+ %r170 = uitofp <2 x i1> undef to <2 x float>
+ ; CHECK: cost of 8 {{.*}} sitofp
+ %r171 = sitofp <2 x i1> undef to <2 x float>
+ ; CHECK: cost of 3 {{.*}} uitofp
+ %r172 = uitofp <2 x i8> undef to <2 x float>
+ ; CHECK: cost of 3 {{.*}} sitofp
+ %r173 = sitofp <2 x i8> undef to <2 x float>
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r174 = uitofp <2 x i16> undef to <2 x float>
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r175 = sitofp <2 x i16> undef to <2 x float>
+ ; CHECK: cost of 1 {{.*}} uitofp
+ %r176 = uitofp <2 x i32> undef to <2 x float>
+ ; CHECK: cost of 1 {{.*}} sitofp
+ %r177 = sitofp <2 x i32> undef to <2 x float>
+ ; CHECK: cost of 24 {{.*}} uitofp
+ %r178 = uitofp <2 x i64> undef to <2 x float>
+ ; CHECK: cost of 24 {{.*}} sitofp
+ %r179 = sitofp <2 x i64> undef to <2 x float>
+
+ ; CHECK: cost of 8 {{.*}} uitofp
+ %r180 = uitofp <2 x i1> undef to <2 x double>
+ ; CHECK: cost of 8 {{.*}} sitofp
+ %r181 = sitofp <2 x i1> undef to <2 x double>
+ ; CHECK: cost of 4 {{.*}} uitofp
+ %r182 = uitofp <2 x i8> undef to <2 x double>
+ ; CHECK: cost of 4 {{.*}} sitofp
+ %r183 = sitofp <2 x i8> undef to <2 x double>
+ ; CHECK: cost of 3 {{.*}} uitofp
+ %r184 = uitofp <2 x i16> undef to <2 x double>
+ ; CHECK: cost of 3 {{.*}} sitofp
+ %r185 = sitofp <2 x i16> undef to <2 x double>
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r186 = uitofp <2 x i32> undef to <2 x double>
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r187 = sitofp <2 x i32> undef to <2 x double>
+ ; CHECK: cost of 24 {{.*}} uitofp
+ %r188 = uitofp <2 x i64> undef to <2 x double>
+ ; CHECK: cost of 24 {{.*}} sitofp
+ %r189 = sitofp <2 x i64> undef to <2 x double>
+
+ ; CHECK: cost of 3 {{.*}} uitofp
+ %r190 = uitofp <4 x i1> undef to <4 x float>
+ ; CHECK: cost of 3 {{.*}} sitofp
+ %r191 = sitofp <4 x i1> undef to <4 x float>
+ ; CHECK: cost of 3 {{.*}} uitofp
+ %r192 = uitofp <4 x i8> undef to <4 x float>
+ ; CHECK: cost of 3 {{.*}} sitofp
+ %r193 = sitofp <4 x i8> undef to <4 x float>
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r194 = uitofp <4 x i16> undef to <4 x float>
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r195 = sitofp <4 x i16> undef to <4 x float>
+ ; CHECK: cost of 1 {{.*}} uitofp
+ %r196 = uitofp <4 x i32> undef to <4 x float>
+ ; CHECK: cost of 1 {{.*}} sitofp
+ %r197 = sitofp <4 x i32> undef to <4 x float>
+ ; CHECK: cost of 48 {{.*}} uitofp
+ %r198 = uitofp <4 x i64> undef to <4 x float>
+ ; CHECK: cost of 48 {{.*}} sitofp
+ %r199 = sitofp <4 x i64> undef to <4 x float>
+
+ ; CHECK: cost of 16 {{.*}} uitofp
+ %r200 = uitofp <4 x i1> undef to <4 x double>
+ ; CHECK: cost of 16 {{.*}} sitofp
+ %r201 = sitofp <4 x i1> undef to <4 x double>
+ ; CHECK: cost of 16 {{.*}} uitofp
+ %r202 = uitofp <4 x i8> undef to <4 x double>
+ ; CHECK: cost of 16 {{.*}} sitofp
+ %r203 = sitofp <4 x i8> undef to <4 x double>
+ ; CHECK: cost of 16 {{.*}} uitofp
+ %r204 = uitofp <4 x i16> undef to <4 x double>
+ ; CHECK: cost of 16 {{.*}} sitofp
+ %r205 = sitofp <4 x i16> undef to <4 x double>
+ ; CHECK: cost of 16 {{.*}} uitofp
+ %r206 = uitofp <4 x i32> undef to <4 x double>
+ ; CHECK: cost of 16 {{.*}} sitofp
+ %r207 = sitofp <4 x i32> undef to <4 x double>
+ ; CHECK: cost of 48 {{.*}} uitofp
+ %r208 = uitofp <4 x i64> undef to <4 x double>
+ ; CHECK: cost of 48 {{.*}} sitofp
+ %r209 = sitofp <4 x i64> undef to <4 x double>
+
+ ; CHECK: cost of 32 {{.*}} uitofp
+ %r210 = uitofp <8 x i1> undef to <8 x float>
+ ; CHECK: cost of 32 {{.*}} sitofp
+ %r211 = sitofp <8 x i1> undef to <8 x float>
+ ; CHECK: cost of 32 {{.*}} uitofp
+ %r212 = uitofp <8 x i8> undef to <8 x float>
+ ; CHECK: cost of 32 {{.*}} sitofp
+ %r213 = sitofp <8 x i8> undef to <8 x float>
+ ; CHECK: cost of 4 {{.*}} uitofp
+ %r214 = uitofp <8 x i16> undef to <8 x float>
+ ; CHECK: cost of 4 {{.*}} sitofp
+ %r215 = sitofp <8 x i16> undef to <8 x float>
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %r216 = uitofp <8 x i32> undef to <8 x float>
+ ; CHECK: cost of 2 {{.*}} sitofp
+ %r217 = sitofp <8 x i32> undef to <8 x float>
+ ; CHECK: cost of 96 {{.*}} uitofp
+ %r218 = uitofp <8 x i64> undef to <8 x float>
+ ; CHECK: cost of 96 {{.*}} sitofp
+ %r219 = sitofp <8 x i64> undef to <8 x float>
+
+ ; CHECK: cost of 32 {{.*}} uitofp
+ %r220 = uitofp <8 x i1> undef to <8 x double>
+ ; CHECK: cost of 32 {{.*}} sitofp
+ %r221 = sitofp <8 x i1> undef to <8 x double>
+ ; CHECK: cost of 32 {{.*}} uitofp
+ %r222 = uitofp <8 x i8> undef to <8 x double>
+ ; CHECK: cost of 32 {{.*}} sitofp
+ %r223 = sitofp <8 x i8> undef to <8 x double>
+ ; CHECK: cost of 32 {{.*}} uitofp
+ %r224 = uitofp <8 x i16> undef to <8 x double>
+ ; CHECK: cost of 32 {{.*}} sitofp
+ %r225 = sitofp <8 x i16> undef to <8 x double>
+ ; CHECK: cost of 32 {{.*}} uitofp
+ %r226 = uitofp <8 x i16> undef to <8 x double>
+ ; CHECK: cost of 32 {{.*}} sitofp
+ %r227 = sitofp <8 x i16> undef to <8 x double>
+ ; CHECK: cost of 96 {{.*}} uitofp
+ %r228 = uitofp <8 x i64> undef to <8 x double>
+ ; CHECK: cost of 96 {{.*}} sitofp
+ %r229 = sitofp <8 x i64> undef to <8 x double>
+
+ ; CHECK: cost of 64 {{.*}} uitofp
+ %r230 = uitofp <16 x i1> undef to <16 x float>
+ ; CHECK: cost of 64 {{.*}} sitofp
+ %r231 = sitofp <16 x i1> undef to <16 x float>
+ ; CHECK: cost of 64 {{.*}} uitofp
+ %r232 = uitofp <16 x i8> undef to <16 x float>
+ ; CHECK: cost of 64 {{.*}} sitofp
+ %r233 = sitofp <16 x i8> undef to <16 x float>
+ ; CHECK: cost of 8 {{.*}} uitofp
+ %r234 = uitofp <16 x i16> undef to <16 x float>
+ ; CHECK: cost of 8 {{.*}} sitofp
+ %r235 = sitofp <16 x i16> undef to <16 x float>
+ ; CHECK: cost of 4 {{.*}} uitofp
+ %r236 = uitofp <16 x i32> undef to <16 x float>
+ ; CHECK: cost of 4 {{.*}} sitofp
+ %r237 = sitofp <16 x i32> undef to <16 x float>
+ ; CHECK: cost of 192 {{.*}} uitofp
+ %r238 = uitofp <16 x i64> undef to <16 x float>
+ ; CHECK: cost of 192 {{.*}} sitofp
+ %r239 = sitofp <16 x i64> undef to <16 x float>
+
+ ; CHECK: cost of 64 {{.*}} uitofp
+ %r240 = uitofp <16 x i1> undef to <16 x double>
+ ; CHECK: cost of 64 {{.*}} sitofp
+ %r241 = sitofp <16 x i1> undef to <16 x double>
+ ; CHECK: cost of 64 {{.*}} uitofp
+ %r242 = uitofp <16 x i8> undef to <16 x double>
+ ; CHECK: cost of 64 {{.*}} sitofp
+ %r243 = sitofp <16 x i8> undef to <16 x double>
+ ; C4ECK: cost of 64 {{.*}} uitofp
+ %r244 = uitofp <16 x i16> undef to <16 x double>
+ ; CHECK: cost of 64 {{.*}} sitofp
+ %r245 = sitofp <16 x i16> undef to <16 x double>
+ ; CHECK: cost of 64 {{.*}} uitofp
+ %r246 = uitofp <16 x i16> undef to <16 x double>
+ ; CHECK: cost of 64 {{.*}} sitofp
+ %r247 = sitofp <16 x i16> undef to <16 x double>
+ ; CHECK: cost of 192 {{.*}} uitofp
+ %r248 = uitofp <16 x i64> undef to <16 x double>
+ ; CHECK: cost of 192 {{.*}} sitofp
+ %r249 = sitofp <16 x i64> undef to <16 x double>
+
+ ;CHECK: cost of 0 {{.*}} ret
+ ret i32 undef
+}
+
diff --git a/test/Analysis/CostModel/ARM/gep.ll b/test/Analysis/CostModel/ARM/gep.ll
new file mode 100644
index 000000000000..a63b87d2ad11
--- /dev/null
+++ b/test/Analysis/CostModel/ARM/gep.ll
@@ -0,0 +1,43 @@
+; RUN: opt -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=swift < %s | FileCheck %s
+
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+target triple = "thumbv7-apple-ios6.0.0"
+
+define void @test_geps() {
+ ; Cost of scalar integer geps should be one. We can't always expect it to be
+ ; folded into the instruction addressing mode.
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds i8*
+ %a0 = getelementptr inbounds i8* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds i16*
+ %a1 = getelementptr inbounds i16* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds i32*
+ %a2 = getelementptr inbounds i32* undef, i32 0
+
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds i64*
+ %a3 = getelementptr inbounds i64* undef, i32 0
+
+ ; Cost of scalar floating point geps should be one. We cannot fold the address
+ ; computation.
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds float*
+ %a4 = getelementptr inbounds float* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds double*
+ %a5 = getelementptr inbounds double* undef, i32 0
+
+
+ ; Cost of vector geps should be one. We cannot fold the address computation.
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x i8>*
+ %a7 = getelementptr inbounds <4 x i8>* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x i16>*
+ %a8 = getelementptr inbounds <4 x i16>* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x i32>*
+ %a9 = getelementptr inbounds <4 x i32>* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x i64>*
+ %a10 = getelementptr inbounds <4 x i64>* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x float>*
+ %a11 = getelementptr inbounds <4 x float>* undef, i32 0
+;CHECK: cost of 1 for instruction: {{.*}} getelementptr inbounds <4 x double>*
+ %a12 = getelementptr inbounds <4 x double>* undef, i32 0
+
+
+ ret void
+}
diff --git a/test/Analysis/CostModel/ARM/insertelement.ll b/test/Analysis/CostModel/ARM/insertelement.ll
new file mode 100644
index 000000000000..f951b08f9baa
--- /dev/null
+++ b/test/Analysis/CostModel/ARM/insertelement.ll
@@ -0,0 +1,46 @@
+; RUN: opt -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=swift < %s | FileCheck %s
+
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+target triple = "thumbv7-apple-ios6.0.0"
+
+; Multiple insert elements from loads into d subregisters are expensive on swift
+; due to renaming constraints.
+%T_i8v = type <8 x i8>
+%T_i8 = type i8
+; CHECK: insertelement_i8
+define void @insertelement_i8(%T_i8* %saddr,
+ %T_i8v* %vaddr) {
+ %v0 = load %T_i8v* %vaddr
+ %v1 = load %T_i8* %saddr
+;CHECK: estimated cost of 3 for {{.*}} insertelement <8 x i8>
+ %v2 = insertelement %T_i8v %v0, %T_i8 %v1, i32 1
+ store %T_i8v %v2, %T_i8v* %vaddr
+ ret void
+}
+
+
+%T_i16v = type <4 x i16>
+%T_i16 = type i16
+; CHECK: insertelement_i16
+define void @insertelement_i16(%T_i16* %saddr,
+ %T_i16v* %vaddr) {
+ %v0 = load %T_i16v* %vaddr
+ %v1 = load %T_i16* %saddr
+;CHECK: estimated cost of 3 for {{.*}} insertelement <4 x i16>
+ %v2 = insertelement %T_i16v %v0, %T_i16 %v1, i32 1
+ store %T_i16v %v2, %T_i16v* %vaddr
+ ret void
+}
+
+%T_i32v = type <2 x i32>
+%T_i32 = type i32
+; CHECK: insertelement_i32
+define void @insertelement_i32(%T_i32* %saddr,
+ %T_i32v* %vaddr) {
+ %v0 = load %T_i32v* %vaddr
+ %v1 = load %T_i32* %saddr
+;CHECK: estimated cost of 3 for {{.*}} insertelement <2 x i32>
+ %v2 = insertelement %T_i32v %v0, %T_i32 %v1, i32 1
+ store %T_i32v %v2, %T_i32v* %vaddr
+ ret void
+}
diff --git a/test/Analysis/CostModel/ARM/lit.local.cfg b/test/Analysis/CostModel/ARM/lit.local.cfg
new file mode 100644
index 000000000000..cb77b09ef4ad
--- /dev/null
+++ b/test/Analysis/CostModel/ARM/lit.local.cfg
@@ -0,0 +1,6 @@
+config.suffixes = ['.ll', '.c', '.cpp']
+
+targets = set(config.root.targets_to_build.split())
+if not 'ARM' in targets:
+ config.unsupported = True
+
diff --git a/test/Analysis/CostModel/ARM/select.ll b/test/Analysis/CostModel/ARM/select.ll
new file mode 100644
index 000000000000..34ed1eefdaf4
--- /dev/null
+++ b/test/Analysis/CostModel/ARM/select.ll
@@ -0,0 +1,67 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=swift | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+target triple = "thumbv7-apple-ios6.0.0"
+
+; CHECK: casts
+define void @casts() {
+ ; Scalar values
+ ; CHECK: cost of 1 {{.*}} select
+ %v1 = select i1 undef, i8 undef, i8 undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v2 = select i1 undef, i16 undef, i16 undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v3 = select i1 undef, i32 undef, i32 undef
+ ; CHECK: cost of 2 {{.*}} select
+ %v4 = select i1 undef, i64 undef, i64 undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v5 = select i1 undef, float undef, float undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v6 = select i1 undef, double undef, double undef
+
+ ; Vector values
+ ; CHECK: cost of 1 {{.*}} select
+ %v7 = select <2 x i1> undef, <2 x i8> undef, <2 x i8> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v8 = select <4 x i1> undef, <4 x i8> undef, <4 x i8> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v9 = select <8 x i1> undef, <8 x i8> undef, <8 x i8> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v10 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
+
+ ; CHECK: cost of 1 {{.*}} select
+ %v11 = select <2 x i1> undef, <2 x i16> undef, <2 x i16> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v12 = select <4 x i1> undef, <4 x i16> undef, <4 x i16> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v13 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
+ ; CHECK: cost of 40 {{.*}} select
+ %v13b = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
+
+ ; CHECK: cost of 1 {{.*}} select
+ %v14 = select <2 x i1> undef, <2 x i32> undef, <2 x i32> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v15 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
+ ; CHECK: cost of 41 {{.*}} select
+ %v15b = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
+ ; CHECK: cost of 82 {{.*}} select
+ %v15c = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
+
+ ; CHECK: cost of 1 {{.*}} select
+ %v16 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
+ ; CHECK: cost of 19 {{.*}} select
+ %v16a = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
+ ; CHECK: cost of 50 {{.*}} select
+ %v16b = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
+ ; CHECK: cost of 100 {{.*}} select
+ %v16c = select <16 x i1> undef, <16 x i64> undef, <16 x i64> undef
+
+ ; CHECK: cost of 1 {{.*}} select
+ %v17 = select <2 x i1> undef, <2 x float> undef, <2 x float> undef
+ ; CHECK: cost of 1 {{.*}} select
+ %v18 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
+
+ ; CHECK: cost of 1 {{.*}} select
+ %v19 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
+
+ ret void
+}
diff --git a/test/Analysis/CostModel/ARM/shuffle.ll b/test/Analysis/CostModel/ARM/shuffle.ll
new file mode 100644
index 000000000000..c92d66880464
--- /dev/null
+++ b/test/Analysis/CostModel/ARM/shuffle.ll
@@ -0,0 +1,40 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=swift | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
+target triple = "thumbv7-apple-ios6.0.0"
+
+; CHECK: shuffle
+define void @shuffle() {
+
+
+ ;; Reverse shuffles should be lowered to vrev and possibly a vext (for
+ ;; quadwords)
+
+ ; Vector values
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v7 = shufflevector <2 x i8> undef, <2 x i8>undef, <2 x i32> <i32 1, i32 0>
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v8 = shufflevector <4 x i8> undef, <4 x i8>undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v9 = shufflevector <8 x i8> undef, <8 x i8>undef, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
+ ; CHECK: cost of 2 {{.*}} shuffle
+ %v10 = shufflevector <16 x i8> undef, <16 x i8>undef, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
+
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v11 = shufflevector <2 x i16> undef, <2 x i16>undef, <2 x i32> <i32 1, i32 0>
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v12 = shufflevector <4 x i16> undef, <4 x i16>undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
+ ; CHECK: cost of 2 {{.*}} shuffle
+ %v13 = shufflevector <8 x i16> undef, <8 x i16>undef, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
+
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v14 = shufflevector <2 x i32> undef, <2 x i32>undef, <2 x i32> <i32 1, i32 0>
+ ; CHECK: cost of 2 {{.*}} shuffle
+ %v15 = shufflevector <4 x i32> undef, <4 x i32>undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
+
+ ; CHECK: cost of 1 {{.*}} shuffle
+ %v16 = shufflevector <2 x float> undef, <2 x float>undef, <2 x i32> <i32 1, i32 0>
+ ; CHECK: cost of 2 {{.*}} shuffle
+ %v17 = shufflevector <4 x float> undef, <4 x float>undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
+
+ ret void
+}
diff --git a/test/Analysis/CostModel/PowerPC/insert_extract.ll b/test/Analysis/CostModel/PowerPC/insert_extract.ll
new file mode 100644
index 000000000000..f51963d56fde
--- /dev/null
+++ b/test/Analysis/CostModel/PowerPC/insert_extract.ll
@@ -0,0 +1,16 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s
+target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+define i32 @insert(i32 %arg) {
+ ; CHECK: cost of 13 {{.*}} insertelement
+ %x = insertelement <4 x i32> undef, i32 %arg, i32 0
+ ret i32 undef
+}
+
+define i32 @extract(<4 x i32> %arg) {
+ ; CHECK: cost of 13 {{.*}} extractelement
+ %x = extractelement <4 x i32> %arg, i32 0
+ ret i32 %x
+}
+
diff --git a/test/Analysis/CostModel/PowerPC/lit.local.cfg b/test/Analysis/CostModel/PowerPC/lit.local.cfg
new file mode 100644
index 000000000000..4019eca0bb88
--- /dev/null
+++ b/test/Analysis/CostModel/PowerPC/lit.local.cfg
@@ -0,0 +1,6 @@
+config.suffixes = ['.ll', '.c', '.cpp']
+
+targets = set(config.root.targets_to_build.split())
+if not 'PowerPC' in targets:
+ config.unsupported = True
+
diff --git a/test/Analysis/CostModel/PowerPC/load_store.ll b/test/Analysis/CostModel/PowerPC/load_store.ll
new file mode 100644
index 000000000000..c77cce955abf
--- /dev/null
+++ b/test/Analysis/CostModel/PowerPC/load_store.ll
@@ -0,0 +1,34 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s
+target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+define i32 @stores(i32 %arg) {
+
+ ; CHECK: cost of 1 {{.*}} store
+ store i8 undef, i8* undef, align 4
+ ; CHECK: cost of 1 {{.*}} store
+ store i16 undef, i16* undef, align 4
+ ; CHECK: cost of 1 {{.*}} store
+ store i32 undef, i32* undef, align 4
+ ; CHECK: cost of 2 {{.*}} store
+ store i64 undef, i64* undef, align 4
+ ; CHECK: cost of 4 {{.*}} store
+ store i128 undef, i128* undef, align 4
+
+ ret i32 undef
+}
+define i32 @loads(i32 %arg) {
+ ; CHECK: cost of 1 {{.*}} load
+ load i8* undef, align 4
+ ; CHECK: cost of 1 {{.*}} load
+ load i16* undef, align 4
+ ; CHECK: cost of 1 {{.*}} load
+ load i32* undef, align 4
+ ; CHECK: cost of 2 {{.*}} load
+ load i64* undef, align 4
+ ; CHECK: cost of 4 {{.*}} load
+ load i128* undef, align 4
+
+ ret i32 undef
+}
+
diff --git a/test/Analysis/CostModel/X86/arith.ll b/test/Analysis/CostModel/X86/arith.ll
index 37cca8d54067..85b442533f41 100644
--- a/test/Analysis/CostModel/X86/arith.ll
+++ b/test/Analysis/CostModel/X86/arith.ll
@@ -1,4 +1,6 @@
; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=core2 | FileCheck %s --check-prefix=SSE3
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=core-avx2 | FileCheck %s --check-prefix=AVX2
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
@@ -14,7 +16,7 @@ define i32 @add(i32 %arg) {
%D = add <4 x i64> undef, undef
;CHECK: cost of 8 {{.*}} add
%E = add <8 x i64> undef, undef
- ;CHECK: cost of 1 {{.*}} ret
+ ;CHECK: cost of 0 {{.*}} ret
ret i32 undef
}
@@ -28,11 +30,41 @@ define i32 @xor(i32 %arg) {
%C = xor <2 x i64> undef, undef
;CHECK: cost of 1 {{.*}} xor
%D = xor <4 x i64> undef, undef
- ;CHECK: cost of 1 {{.*}} ret
+ ;CHECK: cost of 0 {{.*}} ret
ret i32 undef
}
+; CHECK: mul
+define void @mul() {
+ ; A <2 x i32> gets expanded to a <2 x i64> vector.
+ ; A <2 x i64> vector multiply is implemented using
+ ; 3 PMULUDQ and 2 PADDS and 4 shifts.
+ ;CHECK: cost of 9 {{.*}} mul
+ %A0 = mul <2 x i32> undef, undef
+ ;CHECK: cost of 9 {{.*}} mul
+ %A1 = mul <2 x i64> undef, undef
+ ;CHECK: cost of 18 {{.*}} mul
+ %A2 = mul <4 x i64> undef, undef
+ ret void
+}
+
+; SSE3: sse3mull
+define void @sse3mull() {
+ ; SSE3: cost of 6 {{.*}} mul
+ %A0 = mul <4 x i32> undef, undef
+ ret void
+ ; SSE3: avx2mull
+}
+
+; AVX2: avx2mull
+define void @avx2mull() {
+ ; AVX2: cost of 9 {{.*}} mul
+ %A0 = mul <4 x i64> undef, undef
+ ret void
+ ; AVX2: fmul
+}
+; CHECK: fmul
define i32 @fmul(i32 %arg) {
;CHECK: cost of 1 {{.*}} fmul
%A = fmul <4 x float> undef, undef
@@ -40,3 +72,57 @@ define i32 @fmul(i32 %arg) {
%B = fmul <8 x float> undef, undef
ret i32 undef
}
+
+; AVX: shift
+; AVX2: shift
+define void @shift() {
+ ; AVX: cost of 2 {{.*}} shl
+ ; AVX2: cost of 1 {{.*}} shl
+ %A0 = shl <4 x i32> undef, undef
+ ; AVX: cost of 2 {{.*}} shl
+ ; AVX2: cost of 1 {{.*}} shl
+ %A1 = shl <2 x i64> undef, undef
+
+ ; AVX: cost of 2 {{.*}} lshr
+ ; AVX2: cost of 1 {{.*}} lshr
+ %B0 = lshr <4 x i32> undef, undef
+ ; AVX: cost of 2 {{.*}} lshr
+ ; AVX2: cost of 1 {{.*}} lshr
+ %B1 = lshr <2 x i64> undef, undef
+
+ ; AVX: cost of 2 {{.*}} ashr
+ ; AVX2: cost of 1 {{.*}} ashr
+ %C0 = ashr <4 x i32> undef, undef
+ ; AVX: cost of 6 {{.*}} ashr
+ ; AVX2: cost of 20 {{.*}} ashr
+ %C1 = ashr <2 x i64> undef, undef
+
+ ret void
+}
+
+; AVX: avx2shift
+; AVX2: avx2shift
+define void @avx2shift() {
+ ; AVX: cost of 2 {{.*}} shl
+ ; AVX2: cost of 1 {{.*}} shl
+ %A0 = shl <8 x i32> undef, undef
+ ; AVX: cost of 2 {{.*}} shl
+ ; AVX2: cost of 1 {{.*}} shl
+ %A1 = shl <4 x i64> undef, undef
+
+ ; AVX: cost of 2 {{.*}} lshr
+ ; AVX2: cost of 1 {{.*}} lshr
+ %B0 = lshr <8 x i32> undef, undef
+ ; AVX: cost of 2 {{.*}} lshr
+ ; AVX2: cost of 1 {{.*}} lshr
+ %B1 = lshr <4 x i64> undef, undef
+
+ ; AVX: cost of 2 {{.*}} ashr
+ ; AVX2: cost of 1 {{.*}} ashr
+ %C0 = ashr <8 x i32> undef, undef
+ ; AVX: cost of 12 {{.*}} ashr
+ ; AVX2: cost of 40 {{.*}} ashr
+ %C1 = ashr <4 x i64> undef, undef
+
+ ret void
+}
diff --git a/test/Analysis/CostModel/X86/cast.ll b/test/Analysis/CostModel/X86/cast.ll
index 75c97a781e7f..b69b3bf6304c 100644
--- a/test/Analysis/CostModel/X86/cast.ll
+++ b/test/Analysis/CostModel/X86/cast.ll
@@ -28,7 +28,7 @@ define i32 @add(i32 %arg) {
;CHECK: cost of 0 {{.*}} trunc
%H = trunc i32 undef to i1
- ;CHECK: cost of 1 {{.*}} ret
+ ;CHECK: cost of 0 {{.*}} ret
ret i32 undef
}
@@ -44,6 +44,10 @@ define i32 @zext_sext(<8 x i1> %in) {
%B = zext <8 x i16> undef to <8 x i32>
;CHECK: cost of 1 {{.*}} sext
%C = sext <4 x i32> undef to <4 x i64>
+ ;CHECK: cost of 6 {{.*}} sext
+ %C1 = sext <4 x i8> undef to <4 x i64>
+ ;CHECK: cost of 6 {{.*}} sext
+ %C2 = sext <4 x i16> undef to <4 x i64>
;CHECK: cost of 1 {{.*}} zext
%D = zext <4 x i32> undef to <4 x i64>
@@ -59,7 +63,7 @@ define i32 @zext_sext(<8 x i1> %in) {
ret i32 undef
}
-define i32 @masks(<8 x i1> %in) {
+define i32 @masks8(<8 x i1> %in) {
;CHECK: cost of 6 {{.*}} zext
%Z = zext <8 x i1> %in to <8 x i32>
;CHECK: cost of 9 {{.*}} sext
@@ -67,3 +71,84 @@ define i32 @masks(<8 x i1> %in) {
ret i32 undef
}
+define i32 @masks4(<4 x i1> %in) {
+ ;CHECK: cost of 8 {{.*}} sext
+ %S = sext <4 x i1> %in to <4 x i64>
+ ret i32 undef
+}
+
+define void @sitofp4(<4 x i1> %a, <4 x i8> %b, <4 x i16> %c, <4 x i32> %d) {
+ ; CHECK: cost of 3 {{.*}} sitofp
+ %A1 = sitofp <4 x i1> %a to <4 x float>
+ ; CHECK: cost of 3 {{.*}} sitofp
+ %A2 = sitofp <4 x i1> %a to <4 x double>
+
+ ; CHECK: cost of 3 {{.*}} sitofp
+ %B1 = sitofp <4 x i8> %b to <4 x float>
+ ; CHECK: cost of 3 {{.*}} sitofp
+ %B2 = sitofp <4 x i8> %b to <4 x double>
+
+ ; CHECK: cost of 3 {{.*}} sitofp
+ %C1 = sitofp <4 x i16> %c to <4 x float>
+ ; CHECK: cost of 3 {{.*}} sitofp
+ %C2 = sitofp <4 x i16> %c to <4 x double>
+
+ ; CHECK: cost of 1 {{.*}} sitofp
+ %D1 = sitofp <4 x i32> %d to <4 x float>
+ ; CHECK: cost of 1 {{.*}} sitofp
+ %D2 = sitofp <4 x i32> %d to <4 x double>
+ ret void
+}
+
+define void @sitofp8(<8 x i1> %a, <8 x i8> %b, <8 x i16> %c, <8 x i32> %d) {
+ ; CHECK: cost of 8 {{.*}} sitofp
+ %A1 = sitofp <8 x i1> %a to <8 x float>
+
+ ; CHECK: cost of 8 {{.*}} sitofp
+ %B1 = sitofp <8 x i8> %b to <8 x float>
+
+ ; CHECK: cost of 5 {{.*}} sitofp
+ %C1 = sitofp <8 x i16> %c to <8 x float>
+
+ ; CHECK: cost of 1 {{.*}} sitofp
+ %D1 = sitofp <8 x i32> %d to <8 x float>
+ ret void
+}
+
+define void @uitofp4(<4 x i1> %a, <4 x i8> %b, <4 x i16> %c, <4 x i32> %d) {
+ ; CHECK: cost of 7 {{.*}} uitofp
+ %A1 = uitofp <4 x i1> %a to <4 x float>
+ ; CHECK: cost of 7 {{.*}} uitofp
+ %A2 = uitofp <4 x i1> %a to <4 x double>
+
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %B1 = uitofp <4 x i8> %b to <4 x float>
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %B2 = uitofp <4 x i8> %b to <4 x double>
+
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %C1 = uitofp <4 x i16> %c to <4 x float>
+ ; CHECK: cost of 2 {{.*}} uitofp
+ %C2 = uitofp <4 x i16> %c to <4 x double>
+
+ ; CHECK: cost of 6 {{.*}} uitofp
+ %D1 = uitofp <4 x i32> %d to <4 x float>
+ ; CHECK: cost of 6 {{.*}} uitofp
+ %D2 = uitofp <4 x i32> %d to <4 x double>
+ ret void
+}
+
+define void @uitofp8(<8 x i1> %a, <8 x i8> %b, <8 x i16> %c, <8 x i32> %d) {
+ ; CHECK: cost of 6 {{.*}} uitofp
+ %A1 = uitofp <8 x i1> %a to <8 x float>
+
+ ; CHECK: cost of 5 {{.*}} uitofp
+ %B1 = uitofp <8 x i8> %b to <8 x float>
+
+ ; CHECK: cost of 5 {{.*}} uitofp
+ %C1 = uitofp <8 x i16> %c to <8 x float>
+
+ ; CHECK: cost of 9 {{.*}} uitofp
+ %D1 = uitofp <8 x i32> %d to <8 x float>
+ ret void
+}
diff --git a/test/Analysis/CostModel/X86/cmp.ll b/test/Analysis/CostModel/X86/cmp.ll
index f868bd18b54f..713b3742e920 100644
--- a/test/Analysis/CostModel/X86/cmp.ll
+++ b/test/Analysis/CostModel/X86/cmp.ll
@@ -1,41 +1,55 @@
-; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck --check-prefix=AVX1 %s
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=core-avx2 | FileCheck --check-prefix=AVX2 %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
define i32 @cmp(i32 %arg) {
; -- floats --
- ;CHECK: cost of 1 {{.*}} fcmp
+ ;AVX1: cost of 1 {{.*}} fcmp
+ ;AVX2: cost of 1 {{.*}} fcmp
%A = fcmp olt <2 x float> undef, undef
- ;CHECK: cost of 1 {{.*}} fcmp
+ ;AVX1: cost of 1 {{.*}} fcmp
+ ;AVX2: cost of 1 {{.*}} fcmp
%B = fcmp olt <4 x float> undef, undef
- ;CHECK: cost of 1 {{.*}} fcmp
+ ;AVX1: cost of 1 {{.*}} fcmp
+ ;AVX2: cost of 1 {{.*}} fcmp
%C = fcmp olt <8 x float> undef, undef
- ;CHECK: cost of 1 {{.*}} fcmp
+ ;AVX1: cost of 1 {{.*}} fcmp
+ ;AVX2: cost of 1 {{.*}} fcmp
%D = fcmp olt <2 x double> undef, undef
- ;CHECK: cost of 1 {{.*}} fcmp
+ ;AVX1: cost of 1 {{.*}} fcmp
+ ;AVX2: cost of 1 {{.*}} fcmp
%E = fcmp olt <4 x double> undef, undef
; -- integers --
- ;CHECK: cost of 1 {{.*}} icmp
+ ;AVX1: cost of 1 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%F = icmp eq <16 x i8> undef, undef
- ;CHECK: cost of 1 {{.*}} icmp
+ ;AVX1: cost of 1 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%G = icmp eq <8 x i16> undef, undef
- ;CHECK: cost of 1 {{.*}} icmp
+ ;AVX1: cost of 1 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%H = icmp eq <4 x i32> undef, undef
- ;CHECK: cost of 1 {{.*}} icmp
+ ;AVX1: cost of 1 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%I = icmp eq <2 x i64> undef, undef
- ;CHECK: cost of 4 {{.*}} icmp
+ ;AVX1: cost of 4 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%J = icmp eq <4 x i64> undef, undef
- ;CHECK: cost of 4 {{.*}} icmp
+ ;AVX1: cost of 4 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%K = icmp eq <8 x i32> undef, undef
- ;CHECK: cost of 4 {{.*}} icmp
+ ;AVX1: cost of 4 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%L = icmp eq <16 x i16> undef, undef
- ;CHECK: cost of 4 {{.*}} icmp
+ ;AVX1: cost of 4 {{.*}} icmp
+ ;AVX2: cost of 1 {{.*}} icmp
%M = icmp eq <32 x i8> undef, undef
- ;CHECK: cost of 1 {{.*}} ret
+ ;CHECK: cost of 0 {{.*}} ret
ret i32 undef
}
diff --git a/test/Analysis/CostModel/X86/gep.ll b/test/Analysis/CostModel/X86/gep.ll
new file mode 100644
index 000000000000..877184a3eaa8
--- /dev/null
+++ b/test/Analysis/CostModel/X86/gep.ll
@@ -0,0 +1,40 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+
+define void @test_geps() {
+ ; Cost of should be zero. We expect it to be folded into
+ ; the instruction addressing mode.
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds i8*
+ %a0 = getelementptr inbounds i8* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds i16*
+ %a1 = getelementptr inbounds i16* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds i32*
+ %a2 = getelementptr inbounds i32* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds i64*
+ %a3 = getelementptr inbounds i64* undef, i32 0
+
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds float*
+ %a4 = getelementptr inbounds float* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds double*
+ %a5 = getelementptr inbounds double* undef, i32 0
+
+ ; Vector geps should also have zero cost.
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds <4 x i8>*
+ %a7 = getelementptr inbounds <4 x i8>* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds <4 x i16>*
+ %a8 = getelementptr inbounds <4 x i16>* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds <4 x i32>*
+ %a9 = getelementptr inbounds <4 x i32>* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds <4 x i64>*
+ %a10 = getelementptr inbounds <4 x i64>* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds <4 x float>*
+ %a11 = getelementptr inbounds <4 x float>* undef, i32 0
+;CHECK: cost of 0 for instruction: {{.*}} getelementptr inbounds <4 x double>*
+ %a12 = getelementptr inbounds <4 x double>* undef, i32 0
+
+
+ ret void
+}
diff --git a/test/Analysis/CostModel/X86/i32.ll b/test/Analysis/CostModel/X86/i32.ll
index 4015e0b1eef4..c2dce762a091 100644
--- a/test/Analysis/CostModel/X86/i32.ll
+++ b/test/Analysis/CostModel/X86/i32.ll
@@ -1,8 +1,6 @@
; RUN: opt < %s -cost-model -analyze -mtriple=i386 -mcpu=corei7-avx | FileCheck %s
-
-;CHECK: cost of 2 {{.*}} add
-;CHECK: cost of 1 {{.*}} ret
+;CHECK: cost of 0 {{.*}} ret
define i32 @no_info(i32 %arg) {
%e = add i64 undef, undef
ret i32 undef
diff --git a/test/Analysis/CostModel/X86/intrinsic-cost.ll b/test/Analysis/CostModel/X86/intrinsic-cost.ll
new file mode 100644
index 000000000000..e235a36222a7
--- /dev/null
+++ b/test/Analysis/CostModel/X86/intrinsic-cost.ll
@@ -0,0 +1,32 @@
+; RUN: opt -S -mtriple=x86_64-apple-darwin -mcpu=core2 -cost-model -analyze < %s | FileCheck %s -check-prefix=CORE2
+; RUN: opt -S -mtriple=x86_64-apple-darwin -mcpu=corei7 -cost-model -analyze < %s | FileCheck %s -check-prefix=COREI7
+
+; If SSE4.1 roundps instruction is available it is cheap to lower, otherwise
+; it'll be scalarized into calls which are expensive.
+define void @test1(float* nocapture %f) nounwind {
+vector.ph:
+ br label %vector.body
+
+vector.body: ; preds = %vector.body, %vector.ph
+ %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
+ %0 = getelementptr inbounds float* %f, i64 %index
+ %1 = bitcast float* %0 to <4 x float>*
+ %wide.load = load <4 x float>* %1, align 4
+ %2 = call <4 x float> @llvm.ceil.v4f32(<4 x float> %wide.load)
+ store <4 x float> %2, <4 x float>* %1, align 4
+ %index.next = add i64 %index, 4
+ %3 = icmp eq i64 %index.next, 1024
+ br i1 %3, label %for.end, label %vector.body
+
+for.end: ; preds = %vector.body
+ ret void
+
+; CORE2: Printing analysis 'Cost Model Analysis' for function 'test1':
+; CORE2: Cost Model: Found an estimated cost of 400 for instruction: %2 = call <4 x float> @llvm.ceil.v4f32(<4 x float> %wide.load)
+
+; COREI7: Printing analysis 'Cost Model Analysis' for function 'test1':
+; COREI7: Cost Model: Found an estimated cost of 1 for instruction: %2 = call <4 x float> @llvm.ceil.v4f32(<4 x float> %wide.load)
+
+}
+
+declare <4 x float> @llvm.ceil.v4f32(<4 x float>) nounwind readnone
diff --git a/test/Analysis/CostModel/X86/load_store.ll b/test/Analysis/CostModel/X86/load_store.ll
new file mode 100644
index 000000000000..4195b1d879a1
--- /dev/null
+++ b/test/Analysis/CostModel/X86/load_store.ll
@@ -0,0 +1,64 @@
+; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.8.0"
+
+define i32 @stores(i32 %arg) {
+
+ ;CHECK: cost of 1 {{.*}} store
+ store i8 undef, i8* undef, align 4
+ ;CHECK: cost of 1 {{.*}} store
+ store i16 undef, i16* undef, align 4
+ ;CHECK: cost of 1 {{.*}} store
+ store i32 undef, i32* undef, align 4
+ ;CHECK: cost of 1 {{.*}} store
+ store i64 undef, i64* undef, align 4
+ ;CHECK: cost of 2 {{.*}} store
+ store i128 undef, i128* undef, align 4
+
+ ;CHECK: cost of 1 {{.*}} store
+ store <4 x i16> undef, <4 x i16>* undef, align 4
+ ;CHECK: cost of 1 {{.*}} store
+ store <4 x i32> undef, <4 x i32>* undef, align 4
+ ;CHECK: cost of 2 {{.*}} store
+ store <4 x i64> undef, <4 x i64>* undef, align 4
+
+ ;CHECK: cost of 1 {{.*}} store
+ store <8 x i16> undef, <8 x i16>* undef, align 4
+ ;CHECK: cost of 2 {{.*}} store
+ store <8 x i32> undef, <8 x i32>* undef, align 4
+ ;CHECK: cost of 4 {{.*}} store
+ store <8 x i64> undef, <8 x i64>* undef, align 4
+
+ ret i32 undef
+}
+define i32 @loads(i32 %arg) {
+ ;CHECK: cost of 1 {{.*}} load
+ load i8* undef, align 4
+ ;CHECK: cost of 1 {{.*}} load
+ load i16* undef, align 4
+ ;CHECK: cost of 1 {{.*}} load
+ load i32* undef, align 4
+ ;CHECK: cost of 1 {{.*}} load
+ load i64* undef, align 4
+ ;CHECK: cost of 2 {{.*}} load
+ load i128* undef, align 4
+
+ ;CHECK: cost of 1 {{.*}} load
+ load <2 x i32>* undef, align 4
+ ;CHECK: cost of 1 {{.*}} load
+ load <4 x i32>* undef, align 4
+ ;CHECK: cost of 2 {{.*}} load
+ load <8 x i32>* undef, align 4
+
+
+ ;CHECK: cost of 1 {{.*}} load
+ load <2 x i64>* undef, align 4
+ ;CHECK: cost of 2 {{.*}} load
+ load <4 x i64>* undef, align 4
+ ;CHECK: cost of 4 {{.*}} load
+ load <8 x i64>* undef, align 4
+
+ ret i32 undef
+}
+
diff --git a/test/Analysis/CostModel/X86/testshiftashr.ll b/test/Analysis/CostModel/X86/testshiftashr.ll
new file mode 100644
index 000000000000..f35eea87164c
--- /dev/null
+++ b/test/Analysis/CostModel/X86/testshiftashr.ll
@@ -0,0 +1,531 @@
+; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=core2 < %s | FileCheck --check-prefix=SSE2-CODEGEN %s
+; RUN: opt -mtriple=x86_64-apple-darwin -mcpu=core2 -cost-model -analyze < %s | FileCheck --check-prefix=SSE2 %s
+
+%shifttype = type <2 x i16>
+define %shifttype @shift2i16(%shifttype %a, %shifttype %b) {
+entry:
+ ; SSE2: shift2i16
+ ; SSE2: cost of 20 {{.*}} ashr
+ ; SSE2-CODEGEN: shift2i16
+ ; SSE2-CODEGEN: sarq %cl
+
+ %0 = ashr %shifttype %a , %b
+ ret %shifttype %0
+}
+
+%shifttype4i16 = type <4 x i16>
+define %shifttype4i16 @shift4i16(%shifttype4i16 %a, %shifttype4i16 %b) {
+entry:
+ ; SSE2: shift4i16
+ ; SSE2: cost of 40 {{.*}} ashr
+ ; SSE2-CODEGEN: shift4i16
+ ; SSE2-CODEGEN: sarl %cl
+
+ %0 = ashr %shifttype4i16 %a , %b
+ ret %shifttype4i16 %0
+}
+
+%shifttype8i16 = type <8 x i16>
+define %shifttype8i16 @shift8i16(%shifttype8i16 %a, %shifttype8i16 %b) {
+entry:
+ ; SSE2: shift8i16
+ ; SSE2: cost of 80 {{.*}} ashr
+ ; SSE2-CODEGEN: shift8i16
+ ; SSE2-CODEGEN: sarw %cl
+
+ %0 = ashr %shifttype8i16 %a , %b
+ ret %shifttype8i16 %0
+}
+
+%shifttype16i16 = type <16 x i16>
+define %shifttype16i16 @shift16i16(%shifttype16i16 %a, %shifttype16i16 %b) {
+entry:
+ ; SSE2: shift16i16
+ ; SSE2: cost of 160 {{.*}} ashr
+ ; SSE2-CODEGEN: shift16i16
+ ; SSE2-CODEGEN: sarw %cl
+
+ %0 = ashr %shifttype16i16 %a , %b
+ ret %shifttype16i16 %0
+}
+
+%shifttype32i16 = type <32 x i16>
+define %shifttype32i16 @shift32i16(%shifttype32i16 %a, %shifttype32i16 %b) {
+entry:
+ ; SSE2: shift32i16
+ ; SSE2: cost of 320 {{.*}} ashr
+ ; SSE2-CODEGEN: shift32i16
+ ; SSE2-CODEGEN: sarw %cl
+
+ %0 = ashr %shifttype32i16 %a , %b
+ ret %shifttype32i16 %0
+}
+
+%shifttype2i32 = type <2 x i32>
+define %shifttype2i32 @shift2i32(%shifttype2i32 %a, %shifttype2i32 %b) {
+entry:
+ ; SSE2: shift2i32
+ ; SSE2: cost of 20 {{.*}} ashr
+ ; SSE2-CODEGEN: shift2i32
+ ; SSE2-CODEGEN: sarq %cl
+
+ %0 = ashr %shifttype2i32 %a , %b
+ ret %shifttype2i32 %0
+}
+
+%shifttype4i32 = type <4 x i32>
+define %shifttype4i32 @shift4i32(%shifttype4i32 %a, %shifttype4i32 %b) {
+entry:
+ ; SSE2: shift4i32
+ ; SSE2: cost of 40 {{.*}} ashr
+ ; SSE2-CODEGEN: shift4i32
+ ; SSE2-CODEGEN: sarl %cl
+
+ %0 = ashr %shifttype4i32 %a , %b
+ ret %shifttype4i32 %0
+}
+
+%shifttype8i32 = type <8 x i32>
+define %shifttype8i32 @shift8i32(%shifttype8i32 %a, %shifttype8i32 %b) {
+entry:
+ ; SSE2: shift8i32
+ ; SSE2: cost of 80 {{.*}} ashr
+ ; SSE2-CODEGEN: shift8i32
+ ; SSE2-CODEGEN: sarl %cl
+
+ %0 = ashr %shifttype8i32 %a , %b
+ ret %shifttype8i32 %0
+}
+
+%shifttype16i32 = type <16 x i32>
+define %shifttype16i32 @shift16i32(%shifttype16i32 %a, %shifttype16i32 %b) {
+entry:
+ ; SSE2: shift16i32
+ ; SSE2: cost of 160 {{.*}} ashr
+ ; SSE2-CODEGEN: shift16i32
+ ; SSE2-CODEGEN: sarl %cl
+
+ %0 = ashr %shifttype16i32 %a , %b
+ ret %shifttype16i32 %0
+}
+
+%shifttype32i32 = type <32 x i32>
+define %shifttype32i32 @shift32i32(%shifttype32i32 %a, %shifttype32i32 %b) {
+entry:
+ ; SSE2: shift32i32
+ ; SSE2: cost of 256 {{.*}} ashr
+ ; SSE2-CODEGEN: shift32i32
+ ; SSE2-CODEGEN: sarl %cl
+
+ %0 = ashr %shifttype32i32 %a , %b
+ ret %shifttype32i32 %0
+}
+
+%shifttype2i64 = type <2 x i64>
+define %shifttype2i64 @shift2i64(%shifttype2i64 %a, %shifttype2i64 %b) {
+entry:
+ ; SSE2: shift2i64
+ ; SSE2: cost of 20 {{.*}} ashr
+ ; SSE2-CODEGEN: shift2i64
+ ; SSE2-CODEGEN: sarq %cl
+
+ %0 = ashr %shifttype2i64 %a , %b
+ ret %shifttype2i64 %0
+}
+
+%shifttype4i64 = type <4 x i64>
+define %shifttype4i64 @shift4i64(%shifttype4i64 %a, %shifttype4i64 %b) {
+entry:
+ ; SSE2: shift4i64
+ ; SSE2: cost of 40 {{.*}} ashr
+ ; SSE2-CODEGEN: shift4i64
+ ; SSE2-CODEGEN: sarq %cl
+
+ %0 = ashr %shifttype4i64 %a , %b
+ ret %shifttype4i64 %0
+}
+
+%shifttype8i64 = type <8 x i64>
+define %shifttype8i64 @shift8i64(%shifttype8i64 %a, %shifttype8i64 %b) {
+entry:
+ ; SSE2: shift8i64
+ ; SSE2: cost of 80 {{.*}} ashr
+ ; SSE2-CODEGEN: shift8i64
+ ; SSE2-CODEGEN: sarq %cl
+
+ %0 = ashr %shifttype8i64 %a , %b
+ ret %shifttype8i64 %0
+}
+
+%shifttype16i64 = type <16 x i64>
+define %shifttype16i64 @shift16i64(%shifttype16i64 %a, %shifttype16i64 %b) {
+entry:
+ ; SSE2: shift16i64
+ ; SSE2: cost of 160 {{.*}} ashr
+ ; SSE2-CODEGEN: shift16i64
+ ; SSE2-CODEGEN: sarq %cl
+
+ %0 = ashr %shifttype16i64 %a , %b
+ ret %shifttype16i64 %0
+}
+
+%shifttype32i64 = type <32 x i64>
+define %shifttype32i64 @shift32i64(%shifttype32i64 %a, %shifttype32i64 %b) {
+entry:
+ ; SSE2: shift32i64
+ ; SSE2: cost of 256 {{.*}} ashr
+ ; SSE2-CODEGEN: shift32i64
+ ; SSE2-CODEGEN: sarq %cl
+
+ %0 = ashr %shifttype32i64 %a , %b
+ ret %shifttype32i64 %0
+}
+
+%shifttype2i8 = type <2 x i8>
+define %shifttype2i8 @shift2i8(%shifttype2i8 %a, %shifttype2i8 %b) {
+entry:
+ ; SSE2: shift2i8
+ ; SSE2: cost of 20 {{.*}} ashr
+ ; SSE2-CODEGEN: shift2i8
+ ; SSE2-CODEGEN: sarq %cl
+
+ %0 = ashr %shifttype2i8 %a , %b
+ ret %shifttype2i8 %0
+}
+
+%shifttype4i8 = type <4 x i8>
+define %shifttype4i8 @shift4i8(%shifttype4i8 %a, %shifttype4i8 %b) {
+entry:
+ ; SSE2: shift4i8
+ ; SSE2: cost of 40 {{.*}} ashr
+ ; SSE2-CODEGEN: shift4i8
+ ; SSE2-CODEGEN: sarl %cl
+
+ %0 = ashr %shifttype4i8 %a , %b
+ ret %shifttype4i8 %0
+}
+
+%shifttype8i8 = type <8 x i8>
+define %shifttype8i8 @shift8i8(%shifttype8i8 %a, %shifttype8i8 %b) {
+entry:
+ ; SSE2: shift8i8
+ ; SSE2: cost of 80 {{.*}} ashr
+ ; SSE2-CODEGEN: shift8i8
+ ; SSE2-CODEGEN: sarw %cl
+
+ %0 = ashr %shifttype8i8 %a , %b
+ ret %shifttype8i8 %0
+}
+
+%shifttype16i8 = type <16 x i8>
+define %shifttype16i8 @shift16i8(%shifttype16i8 %a, %shifttype16i8 %b) {
+entry:
+ ; SSE2: shift16i8
+ ; SSE2: cost of 160 {{.*}} ashr
+ ; SSE2-CODEGEN: shift16i8
+ ; SSE2-CODEGEN: sarb %cl
+
+ %0 = ashr %shifttype16i8 %a , %b
+ ret %shifttype16i8 %0
+}
+
+%shifttype32i8 = type <32 x i8>
+define %shifttype32i8 @shift32i8(%shifttype32i8 %a, %shifttype32i8 %b) {
+entry:
+ ; SSE2: shift32i8
+ ; SSE2: cost of 320 {{.*}} ashr
+ ; SSE2-CODEGEN: shift32i8
+ ; SSE2-CODEGEN: sarb %cl
+
+ %0 = ashr %shifttype32i8 %a , %b
+ ret %shifttype32i8 %0
+}
+
+; Test shift by a constant a value.
+
+%shifttypec = type <2 x i16>
+define %shifttypec @shift2i16const(%shifttypec %a, %shifttypec %b) {
+entry:
+ ; SSE2: shift2i16const
+ ; SSE2: cost of 20 {{.*}} ashr
+ ; SSE2-CODEGEN: shift2i16const
+ ; SSE2-CODEGEN: sarq $
+
+ %0 = ashr %shifttypec %a , <i16 3, i16 3>
+ ret %shifttypec %0
+}
+
+%shifttypec4i16 = type <4 x i16>
+define %shifttypec4i16 @shift4i16const(%shifttypec4i16 %a, %shifttypec4i16 %b) {
+entry:
+ ; SSE2: shift4i16const
+ ; SSE2: cost of 1 {{.*}} ashr
+ ; SSE2-CODEGEN: shift4i16const
+ ; SSE2-CODEGEN: psrad $3
+
+ %0 = ashr %shifttypec4i16 %a , <i16 3, i16 3, i16 3, i16 3>
+ ret %shifttypec4i16 %0
+}
+
+%shifttypec8i16 = type <8 x i16>
+define %shifttypec8i16 @shift8i16const(%shifttypec8i16 %a, %shifttypec8i16 %b) {
+entry:
+ ; SSE2: shift8i16const
+ ; SSE2: cost of 1 {{.*}} ashr
+ ; SSE2-CODEGEN: shift8i16const
+ ; SSE2-CODEGEN: psraw $3
+
+ %0 = ashr %shifttypec8i16 %a , <i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3>
+ ret %shifttypec8i16 %0
+}
+
+%shifttypec16i16 = type <16 x i16>
+define %shifttypec16i16 @shift16i16const(%shifttypec16i16 %a,
+ %shifttypec16i16 %b) {
+entry:
+ ; SSE2: shift16i16const
+ ; SSE2: cost of 2 {{.*}} ashr
+ ; SSE2-CODEGEN: shift16i16const
+ ; SSE2-CODEGEN: psraw $3
+
+ %0 = ashr %shifttypec16i16 %a , <i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3>
+ ret %shifttypec16i16 %0
+}
+
+%shifttypec32i16 = type <32 x i16>
+define %shifttypec32i16 @shift32i16const(%shifttypec32i16 %a,
+ %shifttypec32i16 %b) {
+entry:
+ ; SSE2: shift32i16const
+ ; SSE2: cost of 4 {{.*}} ashr
+ ; SSE2-CODEGEN: shift32i16const
+ ; SSE2-CODEGEN: psraw $3
+
+ %0 = ashr %shifttypec32i16 %a , <i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3>
+ ret %shifttypec32i16 %0
+}
+
+%shifttypec2i32 = type <2 x i32>
+define %shifttypec2i32 @shift2i32c(%shifttypec2i32 %a, %shifttypec2i32 %b) {
+entry:
+ ; SSE2: shift2i32c
+ ; SSE2: cost of 20 {{.*}} ashr
+ ; SSE2-CODEGEN: shift2i32c
+ ; SSE2-CODEGEN: sarq $3
+
+ %0 = ashr %shifttypec2i32 %a , <i32 3, i32 3>
+ ret %shifttypec2i32 %0
+}
+
+%shifttypec4i32 = type <4 x i32>
+define %shifttypec4i32 @shift4i32c(%shifttypec4i32 %a, %shifttypec4i32 %b) {
+entry:
+ ; SSE2: shift4i32c
+ ; SSE2: cost of 1 {{.*}} ashr
+ ; SSE2-CODEGEN: shift4i32c
+ ; SSE2-CODEGEN: psrad $3
+
+ %0 = ashr %shifttypec4i32 %a , <i32 3, i32 3, i32 3, i32 3>
+ ret %shifttypec4i32 %0
+}
+
+%shifttypec8i32 = type <8 x i32>
+define %shifttypec8i32 @shift8i32c(%shifttypec8i32 %a, %shifttypec8i32 %b) {
+entry:
+ ; SSE2: shift8i32c
+ ; SSE2: cost of 2 {{.*}} ashr
+ ; SSE2-CODEGEN: shift8i32c
+ ; SSE2-CODEGEN: psrad $3
+
+ %0 = ashr %shifttypec8i32 %a , <i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3>
+ ret %shifttypec8i32 %0
+}
+
+%shifttypec16i32 = type <16 x i32>
+define %shifttypec16i32 @shift16i32c(%shifttypec16i32 %a, %shifttypec16i32 %b) {
+entry:
+ ; SSE2: shift16i32c
+ ; SSE2: cost of 4 {{.*}} ashr
+ ; SSE2-CODEGEN: shift16i32c
+ ; SSE2-CODEGEN: psrad $3
+
+ %0 = ashr %shifttypec16i32 %a , <i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3>
+ ret %shifttypec16i32 %0
+}
+
+%shifttypec32i32 = type <32 x i32>
+define %shifttypec32i32 @shift32i32c(%shifttypec32i32 %a, %shifttypec32i32 %b) {
+entry:
+ ; SSE2: shift32i32c
+ ; getTypeConversion fails here and promotes this to a i64.
+ ; SSE2: cost of 256 {{.*}} ashr
+ ; SSE2-CODEGEN: shift32i32c
+ ; SSE2-CODEGEN: psrad $3
+ %0 = ashr %shifttypec32i32 %a , <i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3>
+ ret %shifttypec32i32 %0
+}
+
+%shifttypec2i64 = type <2 x i64>
+define %shifttypec2i64 @shift2i64c(%shifttypec2i64 %a, %shifttypec2i64 %b) {
+entry:
+ ; SSE2: shift2i64c
+ ; SSE2: cost of 20 {{.*}} ashr
+ ; SSE2-CODEGEN: shift2i64c
+ ; SSE2-CODEGEN: sarq $3
+
+ %0 = ashr %shifttypec2i64 %a , <i64 3, i64 3>
+ ret %shifttypec2i64 %0
+}
+
+%shifttypec4i64 = type <4 x i64>
+define %shifttypec4i64 @shift4i64c(%shifttypec4i64 %a, %shifttypec4i64 %b) {
+entry:
+ ; SSE2: shift4i64c
+ ; SSE2: cost of 40 {{.*}} ashr
+ ; SSE2-CODEGEN: shift4i64c
+ ; SSE2-CODEGEN: sarq $3
+
+ %0 = ashr %shifttypec4i64 %a , <i64 3, i64 3, i64 3, i64 3>
+ ret %shifttypec4i64 %0
+}
+
+%shifttypec8i64 = type <8 x i64>
+define %shifttypec8i64 @shift8i64c(%shifttypec8i64 %a, %shifttypec8i64 %b) {
+entry:
+ ; SSE2: shift8i64c
+ ; SSE2: cost of 80 {{.*}} ashr
+ ; SSE2-CODEGEN: shift8i64c
+ ; SSE2-CODEGEN: sarq $3
+
+ %0 = ashr %shifttypec8i64 %a , <i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3>
+ ret %shifttypec8i64 %0
+}
+
+%shifttypec16i64 = type <16 x i64>
+define %shifttypec16i64 @shift16i64c(%shifttypec16i64 %a, %shifttypec16i64 %b) {
+entry:
+ ; SSE2: shift16i64c
+ ; SSE2: cost of 160 {{.*}} ashr
+ ; SSE2-CODEGEN: shift16i64c
+ ; SSE2-CODEGEN: sarq $3
+
+ %0 = ashr %shifttypec16i64 %a , <i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3>
+ ret %shifttypec16i64 %0
+}
+
+%shifttypec32i64 = type <32 x i64>
+define %shifttypec32i64 @shift32i64c(%shifttypec32i64 %a, %shifttypec32i64 %b) {
+entry:
+ ; SSE2: shift32i64c
+ ; SSE2: cost of 256 {{.*}} ashr
+ ; SSE2-CODEGEN: shift32i64c
+ ; SSE2-CODEGEN: sarq $3
+
+ %0 = ashr %shifttypec32i64 %a ,<i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3>
+ ret %shifttypec32i64 %0
+}
+
+%shifttypec2i8 = type <2 x i8>
+define %shifttypec2i8 @shift2i8c(%shifttypec2i8 %a, %shifttypec2i8 %b) {
+entry:
+ ; SSE2: shift2i8c
+ ; SSE2: cost of 20 {{.*}} ashr
+ ; SSE2-CODEGEN: shift2i8c
+ ; SSE2-CODEGEN: sarq $3
+
+ %0 = ashr %shifttypec2i8 %a , <i8 3, i8 3>
+ ret %shifttypec2i8 %0
+}
+
+%shifttypec4i8 = type <4 x i8>
+define %shifttypec4i8 @shift4i8c(%shifttypec4i8 %a, %shifttypec4i8 %b) {
+entry:
+ ; SSE2: shift4i8c
+ ; SSE2: cost of 1 {{.*}} ashr
+ ; SSE2-CODEGEN: shift4i8c
+ ; SSE2-CODEGEN: psrad $3
+
+ %0 = ashr %shifttypec4i8 %a , <i8 3, i8 3, i8 3, i8 3>
+ ret %shifttypec4i8 %0
+}
+
+%shifttypec8i8 = type <8 x i8>
+define %shifttypec8i8 @shift8i8c(%shifttypec8i8 %a, %shifttypec8i8 %b) {
+entry:
+ ; SSE2: shift8i8c
+ ; SSE2: cost of 1 {{.*}} ashr
+ ; SSE2-CODEGEN: shift8i8c
+ ; SSE2-CODEGEN: psraw $3
+
+ %0 = ashr %shifttypec8i8 %a , <i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3>
+ ret %shifttypec8i8 %0
+}
+
+%shifttypec16i8 = type <16 x i8>
+define %shifttypec16i8 @shift16i8c(%shifttypec16i8 %a, %shifttypec16i8 %b) {
+entry:
+ ; SSE2: shift16i8c
+ ; SSE2: cost of 4 {{.*}} ashr
+ ; SSE2-CODEGEN: shift16i8c
+ ; SSE2-CODEGEN: psrlw $3
+
+ %0 = ashr %shifttypec16i8 %a , <i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3>
+ ret %shifttypec16i8 %0
+}
+
+%shifttypec32i8 = type <32 x i8>
+define %shifttypec32i8 @shift32i8c(%shifttypec32i8 %a, %shifttypec32i8 %b) {
+entry:
+ ; SSE2: shift32i8c
+ ; SSE2: cost of 8 {{.*}} ashr
+ ; SSE2-CODEGEN: shift32i8c
+ ; SSE2-CODEGEN: psrlw $3
+
+ %0 = ashr %shifttypec32i8 %a , <i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3>
+ ret %shifttypec32i8 %0
+}
+
diff --git a/test/Analysis/CostModel/X86/testshiftlshr.ll b/test/Analysis/CostModel/X86/testshiftlshr.ll
new file mode 100644
index 000000000000..8d6ef3874208
--- /dev/null
+++ b/test/Analysis/CostModel/X86/testshiftlshr.ll
@@ -0,0 +1,530 @@
+; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=core2 < %s | FileCheck --check-prefix=SSE2-CODEGEN %s
+; RUN: opt -mtriple=x86_64-apple-darwin -mcpu=core2 -cost-model -analyze < %s | FileCheck --check-prefix=SSE2 %s
+
+%shifttype = type <2 x i16>
+define %shifttype @shift2i16(%shifttype %a, %shifttype %b) {
+entry:
+ ; SSE2: shift2i16
+ ; SSE2: cost of 20 {{.*}} lshr
+ ; SSE2-CODEGEN: shift2i16
+ ; SSE2-CODEGEN: shrq %cl
+
+ %0 = lshr %shifttype %a , %b
+ ret %shifttype %0
+}
+
+%shifttype4i16 = type <4 x i16>
+define %shifttype4i16 @shift4i16(%shifttype4i16 %a, %shifttype4i16 %b) {
+entry:
+ ; SSE2: shift4i16
+ ; SSE2: cost of 40 {{.*}} lshr
+ ; SSE2-CODEGEN: shift4i16
+ ; SSE2-CODEGEN: shrl %cl
+
+ %0 = lshr %shifttype4i16 %a , %b
+ ret %shifttype4i16 %0
+}
+
+%shifttype8i16 = type <8 x i16>
+define %shifttype8i16 @shift8i16(%shifttype8i16 %a, %shifttype8i16 %b) {
+entry:
+ ; SSE2: shift8i16
+ ; SSE2: cost of 80 {{.*}} lshr
+ ; SSE2-CODEGEN: shift8i16
+ ; SSE2-CODEGEN: shrl %cl
+
+ %0 = lshr %shifttype8i16 %a , %b
+ ret %shifttype8i16 %0
+}
+
+%shifttype16i16 = type <16 x i16>
+define %shifttype16i16 @shift16i16(%shifttype16i16 %a, %shifttype16i16 %b) {
+entry:
+ ; SSE2: shift16i16
+ ; SSE2: cost of 160 {{.*}} lshr
+ ; SSE2-CODEGEN: shift16i16
+ ; SSE2-CODEGEN: shrl %cl
+
+ %0 = lshr %shifttype16i16 %a , %b
+ ret %shifttype16i16 %0
+}
+
+%shifttype32i16 = type <32 x i16>
+define %shifttype32i16 @shift32i16(%shifttype32i16 %a, %shifttype32i16 %b) {
+entry:
+ ; SSE2: shift32i16
+ ; SSE2: cost of 320 {{.*}} lshr
+ ; SSE2-CODEGEN: shift32i16
+ ; SSE2-CODEGEN: shrl %cl
+
+ %0 = lshr %shifttype32i16 %a , %b
+ ret %shifttype32i16 %0
+}
+
+%shifttype2i32 = type <2 x i32>
+define %shifttype2i32 @shift2i32(%shifttype2i32 %a, %shifttype2i32 %b) {
+entry:
+ ; SSE2: shift2i32
+ ; SSE2: cost of 20 {{.*}} lshr
+ ; SSE2-CODEGEN: shift2i32
+ ; SSE2-CODEGEN: shrq %cl
+
+ %0 = lshr %shifttype2i32 %a , %b
+ ret %shifttype2i32 %0
+}
+
+%shifttype4i32 = type <4 x i32>
+define %shifttype4i32 @shift4i32(%shifttype4i32 %a, %shifttype4i32 %b) {
+entry:
+ ; SSE2: shift4i32
+ ; SSE2: cost of 40 {{.*}} lshr
+ ; SSE2-CODEGEN: shift4i32
+ ; SSE2-CODEGEN: shrl %cl
+
+ %0 = lshr %shifttype4i32 %a , %b
+ ret %shifttype4i32 %0
+}
+
+%shifttype8i32 = type <8 x i32>
+define %shifttype8i32 @shift8i32(%shifttype8i32 %a, %shifttype8i32 %b) {
+entry:
+ ; SSE2: shift8i32
+ ; SSE2: cost of 80 {{.*}} lshr
+ ; SSE2-CODEGEN: shift8i32
+ ; SSE2-CODEGEN: shrl %cl
+
+ %0 = lshr %shifttype8i32 %a , %b
+ ret %shifttype8i32 %0
+}
+
+%shifttype16i32 = type <16 x i32>
+define %shifttype16i32 @shift16i32(%shifttype16i32 %a, %shifttype16i32 %b) {
+entry:
+ ; SSE2: shift16i32
+ ; SSE2: cost of 160 {{.*}} lshr
+ ; SSE2-CODEGEN: shift16i32
+ ; SSE2-CODEGEN: shrl %cl
+
+ %0 = lshr %shifttype16i32 %a , %b
+ ret %shifttype16i32 %0
+}
+
+%shifttype32i32 = type <32 x i32>
+define %shifttype32i32 @shift32i32(%shifttype32i32 %a, %shifttype32i32 %b) {
+entry:
+ ; SSE2: shift32i32
+ ; SSE2: cost of 256 {{.*}} lshr
+ ; SSE2-CODEGEN: shift32i32
+ ; SSE2-CODEGEN: shrl %cl
+
+ %0 = lshr %shifttype32i32 %a , %b
+ ret %shifttype32i32 %0
+}
+
+%shifttype2i64 = type <2 x i64>
+define %shifttype2i64 @shift2i64(%shifttype2i64 %a, %shifttype2i64 %b) {
+entry:
+ ; SSE2: shift2i64
+ ; SSE2: cost of 20 {{.*}} lshr
+ ; SSE2-CODEGEN: shift2i64
+ ; SSE2-CODEGEN: shrq %cl
+
+ %0 = lshr %shifttype2i64 %a , %b
+ ret %shifttype2i64 %0
+}
+
+%shifttype4i64 = type <4 x i64>
+define %shifttype4i64 @shift4i64(%shifttype4i64 %a, %shifttype4i64 %b) {
+entry:
+ ; SSE2: shift4i64
+ ; SSE2: cost of 40 {{.*}} lshr
+ ; SSE2-CODEGEN: shift4i64
+ ; SSE2-CODEGEN: shrq %cl
+
+ %0 = lshr %shifttype4i64 %a , %b
+ ret %shifttype4i64 %0
+}
+
+%shifttype8i64 = type <8 x i64>
+define %shifttype8i64 @shift8i64(%shifttype8i64 %a, %shifttype8i64 %b) {
+entry:
+ ; SSE2: shift8i64
+ ; SSE2: cost of 80 {{.*}} lshr
+ ; SSE2-CODEGEN: shift8i64
+ ; SSE2-CODEGEN: shrq %cl
+
+ %0 = lshr %shifttype8i64 %a , %b
+ ret %shifttype8i64 %0
+}
+
+%shifttype16i64 = type <16 x i64>
+define %shifttype16i64 @shift16i64(%shifttype16i64 %a, %shifttype16i64 %b) {
+entry:
+ ; SSE2: shift16i64
+ ; SSE2: cost of 160 {{.*}} lshr
+ ; SSE2-CODEGEN: shift16i64
+ ; SSE2-CODEGEN: shrq %cl
+
+ %0 = lshr %shifttype16i64 %a , %b
+ ret %shifttype16i64 %0
+}
+
+%shifttype32i64 = type <32 x i64>
+define %shifttype32i64 @shift32i64(%shifttype32i64 %a, %shifttype32i64 %b) {
+entry:
+ ; SSE2: shift32i64
+ ; SSE2: cost of 256 {{.*}} lshr
+ ; SSE2-CODEGEN: shift32i64
+ ; SSE2-CODEGEN: shrq %cl
+
+ %0 = lshr %shifttype32i64 %a , %b
+ ret %shifttype32i64 %0
+}
+
+%shifttype2i8 = type <2 x i8>
+define %shifttype2i8 @shift2i8(%shifttype2i8 %a, %shifttype2i8 %b) {
+entry:
+ ; SSE2: shift2i8
+ ; SSE2: cost of 20 {{.*}} lshr
+ ; SSE2-CODEGEN: shift2i8
+ ; SSE2-CODEGEN: shrq %cl
+
+ %0 = lshr %shifttype2i8 %a , %b
+ ret %shifttype2i8 %0
+}
+
+%shifttype4i8 = type <4 x i8>
+define %shifttype4i8 @shift4i8(%shifttype4i8 %a, %shifttype4i8 %b) {
+entry:
+ ; SSE2: shift4i8
+ ; SSE2: cost of 40 {{.*}} lshr
+ ; SSE2-CODEGEN: shift4i8
+ ; SSE2-CODEGEN: shrl %cl
+
+ %0 = lshr %shifttype4i8 %a , %b
+ ret %shifttype4i8 %0
+}
+
+%shifttype8i8 = type <8 x i8>
+define %shifttype8i8 @shift8i8(%shifttype8i8 %a, %shifttype8i8 %b) {
+entry:
+ ; SSE2: shift8i8
+ ; SSE2: cost of 80 {{.*}} lshr
+ ; SSE2-CODEGEN: shift8i8
+ ; SSE2-CODEGEN: shrl %cl
+
+ %0 = lshr %shifttype8i8 %a , %b
+ ret %shifttype8i8 %0
+}
+
+%shifttype16i8 = type <16 x i8>
+define %shifttype16i8 @shift16i8(%shifttype16i8 %a, %shifttype16i8 %b) {
+entry:
+ ; SSE2: shift16i8
+ ; SSE2: cost of 160 {{.*}} lshr
+ ; SSE2-CODEGEN: shift16i8
+ ; SSE2-CODEGEN: shrb %cl
+
+ %0 = lshr %shifttype16i8 %a , %b
+ ret %shifttype16i8 %0
+}
+
+%shifttype32i8 = type <32 x i8>
+define %shifttype32i8 @shift32i8(%shifttype32i8 %a, %shifttype32i8 %b) {
+entry:
+ ; SSE2: shift32i8
+ ; SSE2: cost of 320 {{.*}} lshr
+ ; SSE2-CODEGEN: shift32i8
+ ; SSE2-CODEGEN: shrb %cl
+
+ %0 = lshr %shifttype32i8 %a , %b
+ ret %shifttype32i8 %0
+}
+
+; Test shift by a constant vector.
+
+%shifttypec = type <2 x i16>
+define %shifttypec @shift2i16const(%shifttypec %a, %shifttypec %b) {
+entry:
+ ; SSE2: shift2i16const
+ ; SSE2: cost of 1 {{.*}} lshr
+ ; SSE2-CODEGEN: shift2i16const
+ ; SSE2-CODEGEN: psrlq $3
+
+ %0 = lshr %shifttypec %a , <i16 3, i16 3>
+ ret %shifttypec %0
+}
+
+%shifttypec4i16 = type <4 x i16>
+define %shifttypec4i16 @shift4i16const(%shifttypec4i16 %a, %shifttypec4i16 %b) {
+entry:
+ ; SSE2: shift4i16const
+ ; SSE2: cost of 1 {{.*}} lshr
+ ; SSE2-CODEGEN: shift4i16const
+ ; SSE2-CODEGEN: psrld $3
+
+ %0 = lshr %shifttypec4i16 %a , <i16 3, i16 3, i16 3, i16 3>
+ ret %shifttypec4i16 %0
+}
+
+%shifttypec8i16 = type <8 x i16>
+define %shifttypec8i16 @shift8i16const(%shifttypec8i16 %a, %shifttypec8i16 %b) {
+entry:
+ ; SSE2: shift8i16const
+ ; SSE2: cost of 1 {{.*}} lshr
+ ; SSE2-CODEGEN: shift8i16const
+ ; SSE2-CODEGEN: psrlw $3
+
+ %0 = lshr %shifttypec8i16 %a , <i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3>
+ ret %shifttypec8i16 %0
+}
+
+%shifttypec16i16 = type <16 x i16>
+define %shifttypec16i16 @shift16i16const(%shifttypec16i16 %a,
+ %shifttypec16i16 %b) {
+entry:
+ ; SSE2: shift16i16const
+ ; SSE2: cost of 2 {{.*}} lshr
+ ; SSE2-CODEGEN: shift16i16const
+ ; SSE2-CODEGEN: psrlw $3
+
+ %0 = lshr %shifttypec16i16 %a , <i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3>
+ ret %shifttypec16i16 %0
+}
+
+%shifttypec32i16 = type <32 x i16>
+define %shifttypec32i16 @shift32i16const(%shifttypec32i16 %a,
+ %shifttypec32i16 %b) {
+entry:
+ ; SSE2: shift32i16const
+ ; SSE2: cost of 4 {{.*}} lshr
+ ; SSE2-CODEGEN: shift32i16const
+ ; SSE2-CODEGEN: psrlw $3
+
+ %0 = lshr %shifttypec32i16 %a , <i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3>
+ ret %shifttypec32i16 %0
+}
+
+%shifttypec2i32 = type <2 x i32>
+define %shifttypec2i32 @shift2i32c(%shifttypec2i32 %a, %shifttypec2i32 %b) {
+entry:
+ ; SSE2: shift2i32c
+ ; SSE2: cost of 1 {{.*}} lshr
+ ; SSE2-CODEGEN: shift2i32c
+ ; SSE2-CODEGEN: psrlq $3
+
+ %0 = lshr %shifttypec2i32 %a , <i32 3, i32 3>
+ ret %shifttypec2i32 %0
+}
+
+%shifttypec4i32 = type <4 x i32>
+define %shifttypec4i32 @shift4i32c(%shifttypec4i32 %a, %shifttypec4i32 %b) {
+entry:
+ ; SSE2: shift4i32c
+ ; SSE2: cost of 1 {{.*}} lshr
+ ; SSE2-CODEGEN: shift4i32c
+ ; SSE2-CODEGEN: psrld $3
+
+ %0 = lshr %shifttypec4i32 %a , <i32 3, i32 3, i32 3, i32 3>
+ ret %shifttypec4i32 %0
+}
+
+%shifttypec8i32 = type <8 x i32>
+define %shifttypec8i32 @shift8i32c(%shifttypec8i32 %a, %shifttypec8i32 %b) {
+entry:
+ ; SSE2: shift8i32c
+ ; SSE2: cost of 2 {{.*}} lshr
+ ; SSE2-CODEGEN: shift8i32c
+ ; SSE2-CODEGEN: psrld $3
+
+ %0 = lshr %shifttypec8i32 %a , <i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3>
+ ret %shifttypec8i32 %0
+}
+
+%shifttypec16i32 = type <16 x i32>
+define %shifttypec16i32 @shift16i32c(%shifttypec16i32 %a, %shifttypec16i32 %b) {
+entry:
+ ; SSE2: shift16i32c
+ ; SSE2: cost of 4 {{.*}} lshr
+ ; SSE2-CODEGEN: shift16i32c
+ ; SSE2-CODEGEN: psrld $3
+
+ %0 = lshr %shifttypec16i32 %a , <i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3>
+ ret %shifttypec16i32 %0
+}
+
+%shifttypec32i32 = type <32 x i32>
+define %shifttypec32i32 @shift32i32c(%shifttypec32i32 %a, %shifttypec32i32 %b) {
+entry:
+ ; SSE2: shift32i32c
+ ; getTypeConversion fails here and promotes this to a i64.
+ ; SSE2: cost of 256 {{.*}} lshr
+ ; SSE2-CODEGEN: shift32i32c
+ ; SSE2-CODEGEN: psrld $3
+ %0 = lshr %shifttypec32i32 %a , <i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3>
+ ret %shifttypec32i32 %0
+}
+
+%shifttypec2i64 = type <2 x i64>
+define %shifttypec2i64 @shift2i64c(%shifttypec2i64 %a, %shifttypec2i64 %b) {
+entry:
+ ; SSE2: shift2i64c
+ ; SSE2: cost of 1 {{.*}} lshr
+ ; SSE2-CODEGEN: shift2i64c
+ ; SSE2-CODEGEN: psrlq $3
+
+ %0 = lshr %shifttypec2i64 %a , <i64 3, i64 3>
+ ret %shifttypec2i64 %0
+}
+
+%shifttypec4i64 = type <4 x i64>
+define %shifttypec4i64 @shift4i64c(%shifttypec4i64 %a, %shifttypec4i64 %b) {
+entry:
+ ; SSE2: shift4i64c
+ ; SSE2: cost of 2 {{.*}} lshr
+ ; SSE2-CODEGEN: shift4i64c
+ ; SSE2-CODEGEN: psrlq $3
+
+ %0 = lshr %shifttypec4i64 %a , <i64 3, i64 3, i64 3, i64 3>
+ ret %shifttypec4i64 %0
+}
+
+%shifttypec8i64 = type <8 x i64>
+define %shifttypec8i64 @shift8i64c(%shifttypec8i64 %a, %shifttypec8i64 %b) {
+entry:
+ ; SSE2: shift8i64c
+ ; SSE2: cost of 4 {{.*}} lshr
+ ; SSE2-CODEGEN: shift8i64c
+ ; SSE2-CODEGEN: psrlq $3
+
+ %0 = lshr %shifttypec8i64 %a , <i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3>
+ ret %shifttypec8i64 %0
+}
+
+%shifttypec16i64 = type <16 x i64>
+define %shifttypec16i64 @shift16i64c(%shifttypec16i64 %a, %shifttypec16i64 %b) {
+entry:
+ ; SSE2: shift16i64c
+ ; SSE2: cost of 8 {{.*}} lshr
+ ; SSE2-CODEGEN: shift16i64c
+ ; SSE2-CODEGEN: psrlq $3
+
+ %0 = lshr %shifttypec16i64 %a , <i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3>
+ ret %shifttypec16i64 %0
+}
+
+%shifttypec32i64 = type <32 x i64>
+define %shifttypec32i64 @shift32i64c(%shifttypec32i64 %a, %shifttypec32i64 %b) {
+entry:
+ ; SSE2: shift32i64c
+ ; SSE2: cost of 256 {{.*}} lshr
+ ; SSE2-CODEGEN: shift32i64c
+ ; SSE2-CODEGEN: psrlq $3
+
+ %0 = lshr %shifttypec32i64 %a ,<i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3>
+ ret %shifttypec32i64 %0
+}
+
+%shifttypec2i8 = type <2 x i8>
+define %shifttypec2i8 @shift2i8c(%shifttypec2i8 %a, %shifttypec2i8 %b) {
+entry:
+ ; SSE2: shift2i8c
+ ; SSE2: cost of 1 {{.*}} lshr
+ ; SSE2-CODEGEN: shift2i8c
+ ; SSE2-CODEGEN: psrlq $3
+
+ %0 = lshr %shifttypec2i8 %a , <i8 3, i8 3>
+ ret %shifttypec2i8 %0
+}
+
+%shifttypec4i8 = type <4 x i8>
+define %shifttypec4i8 @shift4i8c(%shifttypec4i8 %a, %shifttypec4i8 %b) {
+entry:
+ ; SSE2: shift4i8c
+ ; SSE2: cost of 1 {{.*}} lshr
+ ; SSE2-CODEGEN: shift4i8c
+ ; SSE2-CODEGEN: psrld $3
+
+ %0 = lshr %shifttypec4i8 %a , <i8 3, i8 3, i8 3, i8 3>
+ ret %shifttypec4i8 %0
+}
+
+%shifttypec8i8 = type <8 x i8>
+define %shifttypec8i8 @shift8i8c(%shifttypec8i8 %a, %shifttypec8i8 %b) {
+entry:
+ ; SSE2: shift8i8c
+ ; SSE2: cost of 1 {{.*}} lshr
+ ; SSE2-CODEGEN: shift8i8c
+ ; SSE2-CODEGEN: psrlw $3
+
+ %0 = lshr %shifttypec8i8 %a , <i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3>
+ ret %shifttypec8i8 %0
+}
+
+%shifttypec16i8 = type <16 x i8>
+define %shifttypec16i8 @shift16i8c(%shifttypec16i8 %a, %shifttypec16i8 %b) {
+entry:
+ ; SSE2: shift16i8c
+ ; SSE2: cost of 1 {{.*}} lshr
+ ; SSE2-CODEGEN: shift16i8c
+ ; SSE2-CODEGEN: psrlw $3
+
+ %0 = lshr %shifttypec16i8 %a , <i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3>
+ ret %shifttypec16i8 %0
+}
+
+%shifttypec32i8 = type <32 x i8>
+define %shifttypec32i8 @shift32i8c(%shifttypec32i8 %a, %shifttypec32i8 %b) {
+entry:
+ ; SSE2: shift32i8c
+ ; SSE2: cost of 2 {{.*}} lshr
+ ; SSE2-CODEGEN: shift32i8c
+ ; SSE2-CODEGEN: psrlw $3
+
+ %0 = lshr %shifttypec32i8 %a , <i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3>
+ ret %shifttypec32i8 %0
+}
diff --git a/test/Analysis/CostModel/X86/testshiftshl.ll b/test/Analysis/CostModel/X86/testshiftshl.ll
new file mode 100644
index 000000000000..f45a69879210
--- /dev/null
+++ b/test/Analysis/CostModel/X86/testshiftshl.ll
@@ -0,0 +1,530 @@
+; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=core2 < %s | FileCheck --check-prefix=SSE2-CODEGEN %s
+; RUN: opt -mtriple=x86_64-apple-darwin -mcpu=core2 -cost-model -analyze < %s | FileCheck --check-prefix=SSE2 %s
+
+%shifttype = type <2 x i16>
+define %shifttype @shift2i16(%shifttype %a, %shifttype %b) {
+entry:
+ ; SSE2: shift2i16
+ ; SSE2: cost of 20 {{.*}} shl
+ ; SSE2-CODEGEN: shift2i16
+ ; SSE2-CODEGEN: shlq %cl
+
+ %0 = shl %shifttype %a , %b
+ ret %shifttype %0
+}
+
+%shifttype4i16 = type <4 x i16>
+define %shifttype4i16 @shift4i16(%shifttype4i16 %a, %shifttype4i16 %b) {
+entry:
+ ; SSE2: shift4i16
+ ; SSE2: cost of 10 {{.*}} shl
+ ; SSE2-CODEGEN: shift4i16
+ ; SSE2-CODEGEN: pmuludq
+
+ %0 = shl %shifttype4i16 %a , %b
+ ret %shifttype4i16 %0
+}
+
+%shifttype8i16 = type <8 x i16>
+define %shifttype8i16 @shift8i16(%shifttype8i16 %a, %shifttype8i16 %b) {
+entry:
+ ; SSE2: shift8i16
+ ; SSE2: cost of 80 {{.*}} shl
+ ; SSE2-CODEGEN: shift8i16
+ ; SSE2-CODEGEN: shll %cl
+
+ %0 = shl %shifttype8i16 %a , %b
+ ret %shifttype8i16 %0
+}
+
+%shifttype16i16 = type <16 x i16>
+define %shifttype16i16 @shift16i16(%shifttype16i16 %a, %shifttype16i16 %b) {
+entry:
+ ; SSE2: shift16i16
+ ; SSE2: cost of 160 {{.*}} shl
+ ; SSE2-CODEGEN: shift16i16
+ ; SSE2-CODEGEN: shll %cl
+
+ %0 = shl %shifttype16i16 %a , %b
+ ret %shifttype16i16 %0
+}
+
+%shifttype32i16 = type <32 x i16>
+define %shifttype32i16 @shift32i16(%shifttype32i16 %a, %shifttype32i16 %b) {
+entry:
+ ; SSE2: shift32i16
+ ; SSE2: cost of 320 {{.*}} shl
+ ; SSE2-CODEGEN: shift32i16
+ ; SSE2-CODEGEN: shll %cl
+
+ %0 = shl %shifttype32i16 %a , %b
+ ret %shifttype32i16 %0
+}
+
+%shifttype2i32 = type <2 x i32>
+define %shifttype2i32 @shift2i32(%shifttype2i32 %a, %shifttype2i32 %b) {
+entry:
+ ; SSE2: shift2i32
+ ; SSE2: cost of 20 {{.*}} shl
+ ; SSE2-CODEGEN: shift2i32
+ ; SSE2-CODEGEN: shlq %cl
+
+ %0 = shl %shifttype2i32 %a , %b
+ ret %shifttype2i32 %0
+}
+
+%shifttype4i32 = type <4 x i32>
+define %shifttype4i32 @shift4i32(%shifttype4i32 %a, %shifttype4i32 %b) {
+entry:
+ ; SSE2: shift4i32
+ ; SSE2: cost of 10 {{.*}} shl
+ ; SSE2-CODEGEN: shift4i32
+ ; SSE2-CODEGEN: pmuludq
+
+ %0 = shl %shifttype4i32 %a , %b
+ ret %shifttype4i32 %0
+}
+
+%shifttype8i32 = type <8 x i32>
+define %shifttype8i32 @shift8i32(%shifttype8i32 %a, %shifttype8i32 %b) {
+entry:
+ ; SSE2: shift8i32
+ ; SSE2: cost of 20 {{.*}} shl
+ ; SSE2-CODEGEN: shift8i32
+ ; SSE2-CODEGEN: pmuludq
+
+ %0 = shl %shifttype8i32 %a , %b
+ ret %shifttype8i32 %0
+}
+
+%shifttype16i32 = type <16 x i32>
+define %shifttype16i32 @shift16i32(%shifttype16i32 %a, %shifttype16i32 %b) {
+entry:
+ ; SSE2: shift16i32
+ ; SSE2: cost of 40 {{.*}} shl
+ ; SSE2-CODEGEN: shift16i32
+ ; SSE2-CODEGEN: pmuludq
+
+ %0 = shl %shifttype16i32 %a , %b
+ ret %shifttype16i32 %0
+}
+
+%shifttype32i32 = type <32 x i32>
+define %shifttype32i32 @shift32i32(%shifttype32i32 %a, %shifttype32i32 %b) {
+entry:
+ ; SSE2: shift32i32
+ ; SSE2: cost of 256 {{.*}} shl
+ ; SSE2-CODEGEN: shift32i32
+ ; SSE2-CODEGEN: pmuludq
+
+ %0 = shl %shifttype32i32 %a , %b
+ ret %shifttype32i32 %0
+}
+
+%shifttype2i64 = type <2 x i64>
+define %shifttype2i64 @shift2i64(%shifttype2i64 %a, %shifttype2i64 %b) {
+entry:
+ ; SSE2: shift2i64
+ ; SSE2: cost of 20 {{.*}} shl
+ ; SSE2-CODEGEN: shift2i64
+ ; SSE2-CODEGEN: shlq %cl
+
+ %0 = shl %shifttype2i64 %a , %b
+ ret %shifttype2i64 %0
+}
+
+%shifttype4i64 = type <4 x i64>
+define %shifttype4i64 @shift4i64(%shifttype4i64 %a, %shifttype4i64 %b) {
+entry:
+ ; SSE2: shift4i64
+ ; SSE2: cost of 40 {{.*}} shl
+ ; SSE2-CODEGEN: shift4i64
+ ; SSE2-CODEGEN: shlq %cl
+
+ %0 = shl %shifttype4i64 %a , %b
+ ret %shifttype4i64 %0
+}
+
+%shifttype8i64 = type <8 x i64>
+define %shifttype8i64 @shift8i64(%shifttype8i64 %a, %shifttype8i64 %b) {
+entry:
+ ; SSE2: shift8i64
+ ; SSE2: cost of 80 {{.*}} shl
+ ; SSE2-CODEGEN: shift8i64
+ ; SSE2-CODEGEN: shlq %cl
+
+ %0 = shl %shifttype8i64 %a , %b
+ ret %shifttype8i64 %0
+}
+
+%shifttype16i64 = type <16 x i64>
+define %shifttype16i64 @shift16i64(%shifttype16i64 %a, %shifttype16i64 %b) {
+entry:
+ ; SSE2: shift16i64
+ ; SSE2: cost of 160 {{.*}} shl
+ ; SSE2-CODEGEN: shift16i64
+ ; SSE2-CODEGEN: shlq %cl
+
+ %0 = shl %shifttype16i64 %a , %b
+ ret %shifttype16i64 %0
+}
+
+%shifttype32i64 = type <32 x i64>
+define %shifttype32i64 @shift32i64(%shifttype32i64 %a, %shifttype32i64 %b) {
+entry:
+ ; SSE2: shift32i64
+ ; SSE2: cost of 256 {{.*}} shl
+ ; SSE2-CODEGEN: shift32i64
+ ; SSE2-CODEGEN: shlq %cl
+
+ %0 = shl %shifttype32i64 %a , %b
+ ret %shifttype32i64 %0
+}
+
+%shifttype2i8 = type <2 x i8>
+define %shifttype2i8 @shift2i8(%shifttype2i8 %a, %shifttype2i8 %b) {
+entry:
+ ; SSE2: shift2i8
+ ; SSE2: cost of 20 {{.*}} shl
+ ; SSE2-CODEGEN: shift2i8
+ ; SSE2-CODEGEN: shlq %cl
+
+ %0 = shl %shifttype2i8 %a , %b
+ ret %shifttype2i8 %0
+}
+
+%shifttype4i8 = type <4 x i8>
+define %shifttype4i8 @shift4i8(%shifttype4i8 %a, %shifttype4i8 %b) {
+entry:
+ ; SSE2: shift4i8
+ ; SSE2: cost of 10 {{.*}} shl
+ ; SSE2-CODEGEN: shift4i8
+ ; SSE2-CODEGEN: pmuludq
+
+ %0 = shl %shifttype4i8 %a , %b
+ ret %shifttype4i8 %0
+}
+
+%shifttype8i8 = type <8 x i8>
+define %shifttype8i8 @shift8i8(%shifttype8i8 %a, %shifttype8i8 %b) {
+entry:
+ ; SSE2: shift8i8
+ ; SSE2: cost of 80 {{.*}} shl
+ ; SSE2-CODEGEN: shift8i8
+ ; SSE2-CODEGEN: shll
+
+ %0 = shl %shifttype8i8 %a , %b
+ ret %shifttype8i8 %0
+}
+
+%shifttype16i8 = type <16 x i8>
+define %shifttype16i8 @shift16i8(%shifttype16i8 %a, %shifttype16i8 %b) {
+entry:
+ ; SSE2: shift16i8
+ ; SSE2: cost of 30 {{.*}} shl
+ ; SSE2-CODEGEN: shift16i8
+ ; SSE2-CODEGEN: cmpeqb
+
+ %0 = shl %shifttype16i8 %a , %b
+ ret %shifttype16i8 %0
+}
+
+%shifttype32i8 = type <32 x i8>
+define %shifttype32i8 @shift32i8(%shifttype32i8 %a, %shifttype32i8 %b) {
+entry:
+ ; SSE2: shift32i8
+ ; SSE2: cost of 60 {{.*}} shl
+ ; SSE2-CODEGEN: shift32i8
+ ; SSE2-CODEGEN: cmpeqb
+
+ %0 = shl %shifttype32i8 %a , %b
+ ret %shifttype32i8 %0
+}
+
+; Test shift by a constant vector.
+
+%shifttypec = type <2 x i16>
+define %shifttypec @shift2i16const(%shifttypec %a, %shifttypec %b) {
+entry:
+ ; SSE2: shift2i16const
+ ; SSE2: cost of 1 {{.*}} shl
+ ; SSE2-CODEGEN: shift2i16const
+ ; SSE2-CODEGEN: psllq $3
+
+ %0 = shl %shifttypec %a , <i16 3, i16 3>
+ ret %shifttypec %0
+}
+
+%shifttypec4i16 = type <4 x i16>
+define %shifttypec4i16 @shift4i16const(%shifttypec4i16 %a, %shifttypec4i16 %b) {
+entry:
+ ; SSE2: shift4i16const
+ ; SSE2: cost of 1 {{.*}} shl
+ ; SSE2-CODEGEN: shift4i16const
+ ; SSE2-CODEGEN: pslld $3
+
+ %0 = shl %shifttypec4i16 %a , <i16 3, i16 3, i16 3, i16 3>
+ ret %shifttypec4i16 %0
+}
+
+%shifttypec8i16 = type <8 x i16>
+define %shifttypec8i16 @shift8i16const(%shifttypec8i16 %a, %shifttypec8i16 %b) {
+entry:
+ ; SSE2: shift8i16const
+ ; SSE2: cost of 1 {{.*}} shl
+ ; SSE2-CODEGEN: shift8i16const
+ ; SSE2-CODEGEN: psllw $3
+
+ %0 = shl %shifttypec8i16 %a , <i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3>
+ ret %shifttypec8i16 %0
+}
+
+%shifttypec16i16 = type <16 x i16>
+define %shifttypec16i16 @shift16i16const(%shifttypec16i16 %a,
+ %shifttypec16i16 %b) {
+entry:
+ ; SSE2: shift16i16const
+ ; SSE2: cost of 2 {{.*}} shl
+ ; SSE2-CODEGEN: shift16i16const
+ ; SSE2-CODEGEN: psllw $3
+
+ %0 = shl %shifttypec16i16 %a , <i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3>
+ ret %shifttypec16i16 %0
+}
+
+%shifttypec32i16 = type <32 x i16>
+define %shifttypec32i16 @shift32i16const(%shifttypec32i16 %a,
+ %shifttypec32i16 %b) {
+entry:
+ ; SSE2: shift32i16const
+ ; SSE2: cost of 4 {{.*}} shl
+ ; SSE2-CODEGEN: shift32i16const
+ ; SSE2-CODEGEN: psllw $3
+
+ %0 = shl %shifttypec32i16 %a , <i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3,
+ i16 3, i16 3, i16 3, i16 3>
+ ret %shifttypec32i16 %0
+}
+
+%shifttypec2i32 = type <2 x i32>
+define %shifttypec2i32 @shift2i32c(%shifttypec2i32 %a, %shifttypec2i32 %b) {
+entry:
+ ; SSE2: shift2i32c
+ ; SSE2: cost of 1 {{.*}} shl
+ ; SSE2-CODEGEN: shift2i32c
+ ; SSE2-CODEGEN: psllq $3
+
+ %0 = shl %shifttypec2i32 %a , <i32 3, i32 3>
+ ret %shifttypec2i32 %0
+}
+
+%shifttypec4i32 = type <4 x i32>
+define %shifttypec4i32 @shift4i32c(%shifttypec4i32 %a, %shifttypec4i32 %b) {
+entry:
+ ; SSE2: shift4i32c
+ ; SSE2: cost of 1 {{.*}} shl
+ ; SSE2-CODEGEN: shift4i32c
+ ; SSE2-CODEGEN: pslld $3
+
+ %0 = shl %shifttypec4i32 %a , <i32 3, i32 3, i32 3, i32 3>
+ ret %shifttypec4i32 %0
+}
+
+%shifttypec8i32 = type <8 x i32>
+define %shifttypec8i32 @shift8i32c(%shifttypec8i32 %a, %shifttypec8i32 %b) {
+entry:
+ ; SSE2: shift8i32c
+ ; SSE2: cost of 2 {{.*}} shl
+ ; SSE2-CODEGEN: shift8i32c
+ ; SSE2-CODEGEN: pslld $3
+
+ %0 = shl %shifttypec8i32 %a , <i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3>
+ ret %shifttypec8i32 %0
+}
+
+%shifttypec16i32 = type <16 x i32>
+define %shifttypec16i32 @shift16i32c(%shifttypec16i32 %a, %shifttypec16i32 %b) {
+entry:
+ ; SSE2: shift16i32c
+ ; SSE2: cost of 4 {{.*}} shl
+ ; SSE2-CODEGEN: shift16i32c
+ ; SSE2-CODEGEN: pslld $3
+
+ %0 = shl %shifttypec16i32 %a , <i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3>
+ ret %shifttypec16i32 %0
+}
+
+%shifttypec32i32 = type <32 x i32>
+define %shifttypec32i32 @shift32i32c(%shifttypec32i32 %a, %shifttypec32i32 %b) {
+entry:
+ ; SSE2: shift32i32c
+ ; getTypeConversion fails here and promotes this to a i64.
+ ; SSE2: cost of 256 {{.*}} shl
+ ; SSE2-CODEGEN: shift32i32c
+ ; SSE2-CODEGEN: pslld $3
+ %0 = shl %shifttypec32i32 %a , <i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3,
+ i32 3, i32 3, i32 3, i32 3>
+ ret %shifttypec32i32 %0
+}
+
+%shifttypec2i64 = type <2 x i64>
+define %shifttypec2i64 @shift2i64c(%shifttypec2i64 %a, %shifttypec2i64 %b) {
+entry:
+ ; SSE2: shift2i64c
+ ; SSE2: cost of 1 {{.*}} shl
+ ; SSE2-CODEGEN: shift2i64c
+ ; SSE2-CODEGEN: psllq $3
+
+ %0 = shl %shifttypec2i64 %a , <i64 3, i64 3>
+ ret %shifttypec2i64 %0
+}
+
+%shifttypec4i64 = type <4 x i64>
+define %shifttypec4i64 @shift4i64c(%shifttypec4i64 %a, %shifttypec4i64 %b) {
+entry:
+ ; SSE2: shift4i64c
+ ; SSE2: cost of 2 {{.*}} shl
+ ; SSE2-CODEGEN: shift4i64c
+ ; SSE2-CODEGEN: psllq $3
+
+ %0 = shl %shifttypec4i64 %a , <i64 3, i64 3, i64 3, i64 3>
+ ret %shifttypec4i64 %0
+}
+
+%shifttypec8i64 = type <8 x i64>
+define %shifttypec8i64 @shift8i64c(%shifttypec8i64 %a, %shifttypec8i64 %b) {
+entry:
+ ; SSE2: shift8i64c
+ ; SSE2: cost of 4 {{.*}} shl
+ ; SSE2-CODEGEN: shift8i64c
+ ; SSE2-CODEGEN: psllq $3
+
+ %0 = shl %shifttypec8i64 %a , <i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3>
+ ret %shifttypec8i64 %0
+}
+
+%shifttypec16i64 = type <16 x i64>
+define %shifttypec16i64 @shift16i64c(%shifttypec16i64 %a, %shifttypec16i64 %b) {
+entry:
+ ; SSE2: shift16i64c
+ ; SSE2: cost of 8 {{.*}} shl
+ ; SSE2-CODEGEN: shift16i64c
+ ; SSE2-CODEGEN: psllq $3
+
+ %0 = shl %shifttypec16i64 %a , <i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3>
+ ret %shifttypec16i64 %0
+}
+
+%shifttypec32i64 = type <32 x i64>
+define %shifttypec32i64 @shift32i64c(%shifttypec32i64 %a, %shifttypec32i64 %b) {
+entry:
+ ; SSE2: shift32i64c
+ ; SSE2: cost of 256 {{.*}} shl
+ ; SSE2-CODEGEN: shift32i64c
+ ; SSE2-CODEGEN: psllq $3
+
+ %0 = shl %shifttypec32i64 %a ,<i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3,
+ i64 3, i64 3, i64 3, i64 3>
+ ret %shifttypec32i64 %0
+}
+
+%shifttypec2i8 = type <2 x i8>
+define %shifttypec2i8 @shift2i8c(%shifttypec2i8 %a, %shifttypec2i8 %b) {
+entry:
+ ; SSE2: shift2i8c
+ ; SSE2: cost of 1 {{.*}} shl
+ ; SSE2-CODEGEN: shift2i8c
+ ; SSE2-CODEGEN: psllq $3
+
+ %0 = shl %shifttypec2i8 %a , <i8 3, i8 3>
+ ret %shifttypec2i8 %0
+}
+
+%shifttypec4i8 = type <4 x i8>
+define %shifttypec4i8 @shift4i8c(%shifttypec4i8 %a, %shifttypec4i8 %b) {
+entry:
+ ; SSE2: shift4i8c
+ ; SSE2: cost of 1 {{.*}} shl
+ ; SSE2-CODEGEN: shift4i8c
+ ; SSE2-CODEGEN: pslld $3
+
+ %0 = shl %shifttypec4i8 %a , <i8 3, i8 3, i8 3, i8 3>
+ ret %shifttypec4i8 %0
+}
+
+%shifttypec8i8 = type <8 x i8>
+define %shifttypec8i8 @shift8i8c(%shifttypec8i8 %a, %shifttypec8i8 %b) {
+entry:
+ ; SSE2: shift8i8c
+ ; SSE2: cost of 1 {{.*}} shl
+ ; SSE2-CODEGEN: shift8i8c
+ ; SSE2-CODEGEN: psllw $3
+
+ %0 = shl %shifttypec8i8 %a , <i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3>
+ ret %shifttypec8i8 %0
+}
+
+%shifttypec16i8 = type <16 x i8>
+define %shifttypec16i8 @shift16i8c(%shifttypec16i8 %a, %shifttypec16i8 %b) {
+entry:
+ ; SSE2: shift16i8c
+ ; SSE2: cost of 1 {{.*}} shl
+ ; SSE2-CODEGEN: shift16i8c
+ ; SSE2-CODEGEN: psllw $3
+
+ %0 = shl %shifttypec16i8 %a , <i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3>
+ ret %shifttypec16i8 %0
+}
+
+%shifttypec32i8 = type <32 x i8>
+define %shifttypec32i8 @shift32i8c(%shifttypec32i8 %a, %shifttypec32i8 %b) {
+entry:
+ ; SSE2: shift32i8c
+ ; SSE2: cost of 2 {{.*}} shl
+ ; SSE2-CODEGEN: shift32i8c
+ ; SSE2-CODEGEN: psllw $3
+
+ %0 = shl %shifttypec32i8 %a , <i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3,
+ i8 3, i8 3, i8 3, i8 3>
+ ret %shifttypec32i8 %0
+}
diff --git a/test/Analysis/CostModel/X86/tiny.ll b/test/Analysis/CostModel/X86/tiny.ll
index cc7b443a7dfc..0dafdadb5b15 100644
--- a/test/Analysis/CostModel/X86/tiny.ll
+++ b/test/Analysis/CostModel/X86/tiny.ll
@@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-apple-macosx10.8.0"
;CHECK: cost of 1 {{.*}} add
-;CHECK: cost of 1 {{.*}} ret
+;CHECK: cost of 0 {{.*}} ret
define i32 @no_info(i32 %arg) {
%e = add i32 %arg, %arg
ret i32 %e
diff --git a/test/Analysis/CostModel/X86/vectorized-loop.ll b/test/Analysis/CostModel/X86/vectorized-loop.ll
index 7919a9ca9a64..25b11145c661 100644
--- a/test/Analysis/CostModel/X86/vectorized-loop.ll
+++ b/test/Analysis/CostModel/X86/vectorized-loop.ll
@@ -28,20 +28,21 @@ vector.body: ; preds = %for.body.lr.ph, %ve
%4 = getelementptr inbounds i32* %B, i64 %3
;CHECK: cost of 0 {{.*}} bitcast
%5 = bitcast i32* %4 to <8 x i32>*
- ;CHECK: cost of 1 {{.*}} load
+ ;CHECK: cost of 2 {{.*}} load
%6 = load <8 x i32>* %5, align 4
;CHECK: cost of 4 {{.*}} mul
%7 = mul nsw <8 x i32> %6, <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5>
%8 = getelementptr inbounds i32* %A, i64 %index
%9 = bitcast i32* %8 to <8 x i32>*
+ ;CHECK: cost of 2 {{.*}} load
%10 = load <8 x i32>* %9, align 4
;CHECK: cost of 4 {{.*}} add
%11 = add nsw <8 x i32> %10, %7
- ;CHECK: cost of 1 {{.*}} store
+ ;CHECK: cost of 2 {{.*}} store
store <8 x i32> %11, <8 x i32>* %9, align 4
%index.next = add i64 %index, 8
%12 = icmp eq i64 %index.next, %end.idx.rnd.down
- ;CHECK: cost of 1 {{.*}} br
+ ;CHECK: cost of 0 {{.*}} br
br i1 %12, label %middle.block, label %vector.body
middle.block: ; preds = %vector.body, %for.body.lr.ph
@@ -65,11 +66,11 @@ for.body: ; preds = %middle.block, %for.
;CHECK: cost of 0 {{.*}} trunc
%16 = trunc i64 %indvars.iv.next to i32
%cmp = icmp slt i32 %16, %end
- ;CHECK: cost of 1 {{.*}} br
+ ;CHECK: cost of 0 {{.*}} br
br i1 %cmp, label %for.body, label %for.end
for.end: ; preds = %middle.block, %for.body, %entry
- ;CHECK: cost of 1 {{.*}} ret
+ ;CHECK: cost of 0 {{.*}} ret
ret i32 undef
}
diff --git a/test/Analysis/CostModel/no_info.ll b/test/Analysis/CostModel/no_info.ll
index d20d56b79a7f..f3f165b1b52a 100644
--- a/test/Analysis/CostModel/no_info.ll
+++ b/test/Analysis/CostModel/no_info.ll
@@ -1,11 +1,8 @@
; RUN: opt < %s -cost-model -analyze | FileCheck %s
; The cost model does not have any target information so it can't make a decision.
-; Notice that OPT does not read the triple information from the module itself, only through the command line.
-; This info ignored:
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.8.0"
+; -- No triple in this module --
;CHECK: Unknown cost {{.*}} add
;CHECK: Unknown cost {{.*}} ret
diff --git a/test/Analysis/DependenceAnalysis/Banerjee.ll b/test/Analysis/DependenceAnalysis/Banerjee.ll
index 8865ee94016f..003ee03ab0be 100644
--- a/test/Analysis/DependenceAnalysis/Banerjee.ll
+++ b/test/Analysis/DependenceAnalysis/Banerjee.ll
@@ -7,13 +7,20 @@ target triple = "x86_64-apple-macosx10.6.0"
;; for (long int i = 1; i <= 10; i++)
;; for (long int j = 1; j <= 10; j++) {
-;; A[10*i + j] = ...
-;; ... = A[10*i + j - 1];
+;; A[10*i + j] = 0;
+;; *B++ = A[10*i + j - 1];
define void @banerjee0(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [<= <>]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc7
%B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc7 ]
%i.03 = phi i64 [ 1, %entry ], [ %inc8, %for.inc7 ]
@@ -31,7 +38,6 @@ for.body3: ; preds = %for.cond1.preheader
%sub = add nsw i64 %add5, -1
%arrayidx6 = getelementptr inbounds i64* %A, i64 %sub
%0 = load i64* %arrayidx6, align 8
-; CHECK: da analyze - flow [<= <>]!
%incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1
store i64 %0, i64* %B.addr.11, align 8
%inc = add nsw i64 %j.02, 1
@@ -51,14 +57,21 @@ for.end9: ; preds = %for.inc7
;; for (long int i = 1; i <= n; i++)
;; for (long int j = 1; j <= m; j++) {
-;; A[10*i + j] = ...
-;; ... = A[10*i + j - 1];
+;; A[10*i + j] = 0;
+;; *B++ = A[10*i + j - 1];
define void @banerjee1(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp {
entry:
%cmp4 = icmp sgt i64 %n, 0
br i1 %cmp4, label %for.cond1.preheader.preheader, label %for.end9
+; CHECK: da analyze - output [* *]!
+; CHECK: da analyze - flow [* <>]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [* *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - output [* *]!
+
for.cond1.preheader.preheader: ; preds = %entry
%0 = add i64 %n, 1
br label %for.cond1.preheader
@@ -85,7 +98,6 @@ for.body3: ; preds = %for.body3.preheader
%sub = add nsw i64 %add5, -1
%arrayidx6 = getelementptr inbounds i64* %A, i64 %sub
%2 = load i64* %arrayidx6, align 8
-; CHECK: da analyze - flow [* <>]!
%incdec.ptr = getelementptr inbounds i64* %B.addr.12, i64 1
store i64 %2, i64* %B.addr.12, align 8
%inc = add nsw i64 %j.03, 1
@@ -119,6 +131,13 @@ define void @banerjee2(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc8
%B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc8 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ]
@@ -136,7 +155,6 @@ for.body3: ; preds = %for.cond1.preheader
%add6 = add nsw i64 %add5, 100
%arrayidx7 = getelementptr inbounds i64* %A, i64 %add6
%0 = load i64* %arrayidx7, align 8
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1
store i64 %0, i64* %B.addr.11, align 8
%inc = add nsw i64 %j.02, 1
@@ -156,13 +174,20 @@ for.end10: ; preds = %for.inc8
;; for (long int i = 0; i < 10; i++)
;; for (long int j = 0; j < 10; j++) {
-;; A[10*i + j] = ...
-;; ... = A[10*i + j + 99];
+;; A[10*i + j] = 0;
+;; *B++ = A[10*i + j + 99];
define void @banerjee3(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [> >]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc8
%B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc8 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ]
@@ -180,7 +205,6 @@ for.body3: ; preds = %for.cond1.preheader
%add6 = add nsw i64 %add5, 99
%arrayidx7 = getelementptr inbounds i64* %A, i64 %add6
%0 = load i64* %arrayidx7, align 8
-; CHECK: da analyze - flow [> >]!
%incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1
store i64 %0, i64* %B.addr.11, align 8
%inc = add nsw i64 %j.02, 1
@@ -200,13 +224,20 @@ for.end10: ; preds = %for.inc8
;; for (long int i = 0; i < 10; i++)
;; for (long int j = 0; j < 10; j++) {
-;; A[10*i + j] = ...
-;; ... = A[10*i + j - 100];
+;; A[10*i + j] = 0;
+;; *B++ = A[10*i + j - 100];
define void @banerjee4(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc7
%B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc7 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ]
@@ -224,7 +255,6 @@ for.body3: ; preds = %for.cond1.preheader
%sub = add nsw i64 %add5, -100
%arrayidx6 = getelementptr inbounds i64* %A, i64 %sub
%0 = load i64* %arrayidx6, align 8
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1
store i64 %0, i64* %B.addr.11, align 8
%inc = add nsw i64 %j.02, 1
@@ -244,13 +274,20 @@ for.end9: ; preds = %for.inc7
;; for (long int i = 0; i < 10; i++)
;; for (long int j = 0; j < 10; j++) {
-;; A[10*i + j] = ...
-;; ... = A[10*i + j - 99];
+;; A[10*i + j] = 0;
+;; *B++ = A[10*i + j - 99];
define void @banerjee5(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [< <]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc7
%B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc7 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ]
@@ -268,7 +305,6 @@ for.body3: ; preds = %for.cond1.preheader
%sub = add nsw i64 %add5, -99
%arrayidx6 = getelementptr inbounds i64* %A, i64 %sub
%0 = load i64* %arrayidx6, align 8
-; CHECK: da analyze - flow [< <]!
%incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1
store i64 %0, i64* %B.addr.11, align 8
%inc = add nsw i64 %j.02, 1
@@ -288,13 +324,20 @@ for.end9: ; preds = %for.inc7
;; for (long int i = 0; i < 10; i++)
;; for (long int j = 0; j < 10; j++) {
-;; A[10*i + j] = ...
-;; ... = A[10*i + j + 9];
+;; A[10*i + j] = 0;
+;; *B++ = A[10*i + j + 9];
define void @banerjee6(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [=> <>]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc8
%B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc8 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ]
@@ -312,7 +355,6 @@ for.body3: ; preds = %for.cond1.preheader
%add6 = add nsw i64 %add5, 9
%arrayidx7 = getelementptr inbounds i64* %A, i64 %add6
%0 = load i64* %arrayidx7, align 8
-; CHECK: da analyze - flow [=> <>]!
%incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1
store i64 %0, i64* %B.addr.11, align 8
%inc = add nsw i64 %j.02, 1
@@ -332,13 +374,20 @@ for.end10: ; preds = %for.inc8
;; for (long int i = 0; i < 10; i++)
;; for (long int j = 0; j < 10; j++) {
-;; A[10*i + j] = ...
-;; ... = A[10*i + j + 10];
+;; A[10*i + j] = 0;
+;; *B++ = A[10*i + j + 10];
define void @banerjee7(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [> <=]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc8
%B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc8 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ]
@@ -356,7 +405,6 @@ for.body3: ; preds = %for.cond1.preheader
%add6 = add nsw i64 %add5, 10
%arrayidx7 = getelementptr inbounds i64* %A, i64 %add6
%0 = load i64* %arrayidx7, align 8
-; CHECK: da analyze - flow [> <=]!
%incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1
store i64 %0, i64* %B.addr.11, align 8
%inc = add nsw i64 %j.02, 1
@@ -376,13 +424,20 @@ for.end10: ; preds = %for.inc8
;; for (long int i = 0; i < 10; i++)
;; for (long int j = 0; j < 10; j++) {
-;; A[10*i + j] = ...
-;; ... = A[10*i + j + 11];
+;; A[10*i + j] = 0;
+;; *B++ = A[10*i + j + 11];
define void @banerjee8(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [> <>]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc8
%B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc8 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ]
@@ -400,7 +455,6 @@ for.body3: ; preds = %for.cond1.preheader
%add6 = add nsw i64 %add5, 11
%arrayidx7 = getelementptr inbounds i64* %A, i64 %add6
%0 = load i64* %arrayidx7, align 8
-; CHECK: da analyze - flow [> <>]!
%incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1
store i64 %0, i64* %B.addr.11, align 8
%inc = add nsw i64 %j.02, 1
@@ -420,13 +474,20 @@ for.end10: ; preds = %for.inc8
;; for (long int i = 0; i < 20; i++)
;; for (long int j = 0; j < 20; j++) {
-;; A[30*i + 500*j] = ...
-;; ... = A[i - 500*j + 11];
+;; A[30*i + 500*j] = 0;
+;; *B++ = A[i - 500*j + 11];
define void @banerjee9(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - output [* *]!
+; CHECK: da analyze - flow [<= =|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc8
%B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc8 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ]
@@ -445,7 +506,6 @@ for.body3: ; preds = %for.cond1.preheader
%add6 = add nsw i64 %sub, 11
%arrayidx7 = getelementptr inbounds i64* %A, i64 %add6
%1 = load i64* %arrayidx7, align 8
-; CHECK: da analyze - flow [<= =|<]!
%incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1
store i64 %1, i64* %B.addr.11, align 8
%inc = add nsw i64 %j.02, 1
@@ -465,13 +525,20 @@ for.end10: ; preds = %for.inc8
;; for (long int i = 0; i < 20; i++)
;; for (long int j = 0; j < 20; j++) {
-;; A[i + 500*j] = ...
-;; ... = A[i - 500*j + 11];
+;; A[i + 500*j] = 0;
+;; *B++ = A[i - 500*j + 11];
define void @banerjee10(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [<> =]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc7
%B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc7 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ]
@@ -489,7 +556,6 @@ for.body3: ; preds = %for.cond1.preheader
%add5 = add nsw i64 %sub, 11
%arrayidx6 = getelementptr inbounds i64* %A, i64 %add5
%1 = load i64* %arrayidx6, align 8
-; CHECK: da analyze - flow [<> =]!
%incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1
store i64 %1, i64* %B.addr.11, align 8
%inc = add nsw i64 %j.02, 1
@@ -509,13 +575,20 @@ for.end9: ; preds = %for.inc7
;; for (long int i = 0; i < 20; i++)
;; for (long int j = 0; j < 20; j++) {
-;; A[300*i + j] = ...
-;; ... = A[250*i - j + 11];
+;; A[300*i + j] = 0;
+;; *B++ = A[250*i - j + 11];
define void @banerjee11(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [<= <>]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc7
%B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc7 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ]
@@ -533,7 +606,6 @@ for.body3: ; preds = %for.cond1.preheader
%add5 = add nsw i64 %sub, 11
%arrayidx6 = getelementptr inbounds i64* %A, i64 %add5
%0 = load i64* %arrayidx6, align 8
-; CHECK: da analyze - flow [<= <>]!
%incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1
store i64 %0, i64* %B.addr.11, align 8
%inc = add nsw i64 %j.02, 1
@@ -553,13 +625,20 @@ for.end9: ; preds = %for.inc7
;; for (long int i = 0; i < 20; i++)
;; for (long int j = 0; j < 20; j++) {
-;; A[100*i + j] = ...
-;; ... = A[100*i - j + 11];
+;; A[100*i + j] = 0;
+;; *B++ = A[100*i - j + 11];
define void @banerjee12(i64* %A, i64* %B, i64 %m, i64 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [= <>]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc7
%B.addr.04 = phi i64* [ %B, %entry ], [ %scevgep, %for.inc7 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ]
@@ -577,7 +656,6 @@ for.body3: ; preds = %for.cond1.preheader
%add5 = add nsw i64 %sub, 11
%arrayidx6 = getelementptr inbounds i64* %A, i64 %add5
%0 = load i64* %arrayidx6, align 8
-; CHECK: da analyze - flow [= <>]!
%incdec.ptr = getelementptr inbounds i64* %B.addr.11, i64 1
store i64 %0, i64* %B.addr.11, align 8
%inc = add nsw i64 %j.02, 1
diff --git a/test/Analysis/DependenceAnalysis/Coupled.ll b/test/Analysis/DependenceAnalysis/Coupled.ll
index 60163fe7c2d0..8c77849ae847 100644
--- a/test/Analysis/DependenceAnalysis/Coupled.ll
+++ b/test/Analysis/DependenceAnalysis/Coupled.ll
@@ -5,15 +5,22 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-apple-macosx10.6.0"
-;; for (long int i = 0; i < 50; i++)
-;; A[i][i] = ...
-;; ... = A[i + 10][i + 9]
+;; for (long int i = 0; i < 50; i++) {
+;; A[i][i] = i;
+;; *B++ = A[i + 10][i + 9];
define void @couple0([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -23,27 +30,33 @@ for.body: ; preds = %for.body, %entry
%add2 = add nsw i64 %i.02, 10
%arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %add2, i64 %add
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 50
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 50
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i < 50; i++)
-;; A[i][i] = ...
-;; ... = A[i + 9][i + 9]
+;; for (long int i = 0; i < 50; i++) {
+;; A[i][i] = i;
+;; *B++ = A[i + 9][i + 9];
define void @couple1([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - consistent flow [-9]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -53,27 +66,33 @@ for.body: ; preds = %for.body, %entry
%add2 = add nsw i64 %i.02, 9
%arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %add2, i64 %add
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - consistent flow [-9]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 50
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 50
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i < 50; i++)
-;; A[3*i - 6][3*i - 6] = ...
-;; ... = A[i][i]
+;; for (long int i = 0; i < 50; i++) {
+;; A[3*i - 6][3*i - 6] = i;
+;; *B++ = A[i][i];
define void @couple2([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [*|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -85,27 +104,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx3, align 4
%arrayidx5 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx5, align 4
-; CHECK: da analyze - flow [*|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 50
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 50
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i < 50; i++)
-;; A[3*i - 6][3*i - 5] = ...
-;; ... = A[i][i]
+;; for (long int i = 0; i < 50; i++) {
+;; A[3*i - 6][3*i - 5] = i;
+;; *B++ = A[i][i];
define void @couple3([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -117,27 +142,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx3, align 4
%arrayidx5 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx5, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 50
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 50
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i < 50; i++)
-;; A[3*i - 6][3*i - n] = ...
-;; ... = A[i][i]
+;; for (long int i = 0; i < 50; i++) {
+;; A[3*i - 6][3*i - n] = i;
+;; *B++ = A[i][i];
define void @couple4([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [*|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -150,27 +181,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx4, align 4
%arrayidx6 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx6, align 4
-; CHECK: da analyze - flow [*|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 50
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 50
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i < 50; i++)
-;; A[3*i - n + 1][3*i - n] = ...
-;; ... = A[i][i]
+;; for (long int i = 0; i < 50; i++) {
+;; A[3*i - n + 1][3*i - n] = i;
+;; *B++ = A[i][i];
define void @couple5([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -185,27 +222,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx5, align 4
%arrayidx7 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx7, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 50
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 50
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i < 50; i++)
-;; A[i][3*i - 6] = ...
-;; ... = A[i][i]
+;; for (long int i = 0; i < 50; i++) {
+;; A[i][3*i - 6] = i;
+;; *B++ = A[i][i];
define void @couple6([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [=|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -215,27 +258,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx1, align 4
%arrayidx3 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx3, align 4
-; CHECK: da analyze - flow [=|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 50
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 50
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i < 50; i++)
-;; A[i][3*i - 5] = ...
-;; ... = A[i][i]
+;; for (long int i = 0; i < 50; i++) {
+;; A[i][3*i - 5] = i;
+;; *B++ = A[i][i];
define void @couple7([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -245,27 +294,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx1, align 4
%arrayidx3 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx3, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 50
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 50
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i <= 15; i++)
-;; A[3*i - 18][3 - i] = ...
-;; ... = A[i][i]
+;; for (long int i = 0; i <= 15; i++) {
+;; A[3*i - 18][3 - i] = i;
+;; *B++ = A[i][i];
define void @couple8([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -276,27 +331,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx2, align 4
%arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 16
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 16
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i <= 15; i++)
-;; A[3*i - 18][2 - i] = ...
-;; ... = A[i][i]
+;; for (long int i = 0; i <= 15; i++) {
+;; A[3*i - 18][2 - i] = i;
+;; *B++ = A[i][i];
define void @couple9([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -307,27 +368,34 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx2, align 4
%arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 16
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 16
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i <= 15; i++)
-;; A[3*i - 18][6 - i] = ...
-;; ... = A[i][i]
+;; for (long int i = 0; i <= 15; i++) {
+;; A[3*i - 18][6 - i] = i;
+;; *B++ = A[i][i];
define void @couple10([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [>] splitable!
+; CHECK: da analyze - split level = 1, iteration = 3!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -338,28 +406,34 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx2, align 4
%arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - flow [>] splitable!
-; CHECK: da analyze - split level = 1, iteration = 3!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 16
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 16
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i <= 15; i++)
-;; A[3*i - 18][18 - i] = ...
-;; ... = A[i][i]
+;; for (long int i = 0; i <= 15; i++) {
+;; A[3*i - 18][18 - i] = i;
+;; *B++ = A[i][i];
define void @couple11([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [=|<] splitable!
+; CHECK: da analyze - split level = 1, iteration = 9!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -370,28 +444,34 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx2, align 4
%arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - flow [=|<] splitable!
-; CHECK: da analyze - split level = 1, iteration = 9!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 16
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 16
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i <= 12; i++)
-;; A[3*i - 18][22 - i] = ...
-;; ... = A[i][i]
+;; for (long int i = 0; i <= 12; i++) {
+;; A[3*i - 18][22 - i] = i;
+;; *B++ = A[i][i];
define void @couple12([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [<] splitable!
+; CHECK: da analyze - split level = 1, iteration = 11!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -402,28 +482,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx2, align 4
%arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - flow [<] splitable!
-; CHECK: da analyze - split level = 1, iteration = 11!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 13
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 13
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i < 12; i++)
-;; A[3*i - 18][22 - i] = ...
-;; ... = A[i][i]
+;; for (long int i = 0; i < 12; i++) {
+;; A[3*i - 18][22 - i] = i;
+;; *B++ = A[i][i];
define void @couple13([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -434,27 +519,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx2, align 4
%arrayidx4 = getelementptr inbounds [100 x i32]* %A, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 12
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 12
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-
-;; for (long int i = 0; i < 100; i++)
-;; A[3*i - 18][18 - i][i] = ...
-;; ... = A[i][i][i]
+;; for (long int i = 0; i < 100; i++) {
+;; A[3*i - 18][18 - i][i] = i;
+;; *B++ = A[i][i][i];
define void @couple14([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [=|<] splitable!
+; CHECK: da analyze - split level = 1, iteration = 9!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -465,28 +556,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx3, align 4
%arrayidx6 = getelementptr inbounds [100 x [100 x i32]]* %A, i64 %i.02, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx6, align 4
-; CHECK: da analyze - flow [=|<] splitable!
-; CHECK: da analyze - split level = 1, iteration = 9!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 100
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 100
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long int i = 0; i < 100; i++)
-;; A[3*i - 18][22 - i][i] = ...
-;; ... = A[i][i][i]
+;; for (long int i = 0; i < 100; i++) {
+;; A[3*i - 18][22 - i][i] = i;
+;; *B++ = A[i][i][i];
define void @couple15([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -497,12 +593,11 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx3, align 4
%arrayidx6 = getelementptr inbounds [100 x [100 x i32]]* %A, i64 %i.02, i64 %i.02, i64 %i.02
%0 = load i32* %arrayidx6, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add nsw i64 %i.02, 1
- %cmp = icmp slt i64 %inc, 100
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 100
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
diff --git a/test/Analysis/DependenceAnalysis/ExactRDIV.ll b/test/Analysis/DependenceAnalysis/ExactRDIV.ll
index aa5d254a0ce2..81f55161c0df 100644
--- a/test/Analysis/DependenceAnalysis/ExactRDIV.ll
+++ b/test/Analysis/DependenceAnalysis/ExactRDIV.ll
@@ -6,15 +6,22 @@ target triple = "x86_64-apple-macosx10.6.0"
;; for (long int i = 0; i < 10; i++)
-;; A[4*i + 10] = ...
+;; A[4*i + 10] = i;
;; for (long int j = 0; j < 10; j++)
-;; ... = A[2*j + 1];
+;; *B++ = A[2*j + 1];
define void @rdiv0(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%conv = trunc i64 %i.03 to i32
%mul = shl nsw i64 %i.03, 2
@@ -22,22 +29,24 @@ for.body: ; preds = %for.body, %entry
%arrayidx = getelementptr inbounds i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc, 10
- br i1 %cmp, label %for.body, label %for.body4
+ %exitcond5 = icmp ne i64 %inc, 10
+ br i1 %exitcond5, label %for.body, label %for.body4.preheader
+
+for.body4.preheader: ; preds = %for.body
+ br label %for.body4
-for.body4: ; preds = %for.body4, %for.body
- %j.02 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body ]
- %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.02 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%mul5 = shl nsw i64 %j.02, 1
%add64 = or i64 %mul5, 1
%arrayidx7 = getelementptr inbounds i32* %A, i64 %add64
%0 = load i32* %arrayidx7, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc9 = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc9, 10
- br i1 %cmp2, label %for.body4, label %for.end10
+ %exitcond = icmp ne i64 %inc9, 10
+ br i1 %exitcond, label %for.body4, label %for.end10
for.end10: ; preds = %for.body4
ret void
@@ -45,15 +54,22 @@ for.end10: ; preds = %for.body4
;; for (long int i = 0; i < 5; i++)
-;; A[11*i - 45] = ...
+;; A[11*i - 45] = i;
;; for (long int j = 0; j < 10; j++)
-;; ... = A[j];
+;; *B++ = A[j];
define void @rdiv1(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, 11
@@ -61,20 +77,22 @@ for.body: ; preds = %for.body, %entry
%arrayidx = getelementptr inbounds i32* %A, i64 %sub
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc, 5
- br i1 %cmp, label %for.body, label %for.body4
+ %exitcond4 = icmp ne i64 %inc, 5
+ br i1 %exitcond4, label %for.body, label %for.body4.preheader
+
+for.body4.preheader: ; preds = %for.body
+ br label %for.body4
-for.body4: ; preds = %for.body4, %for.body
- %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
- %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%arrayidx5 = getelementptr inbounds i32* %A, i64 %j.02
%0 = load i32* %arrayidx5, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc7 = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc7, 10
- br i1 %cmp2, label %for.body4, label %for.end8
+ %exitcond = icmp ne i64 %inc7, 10
+ br i1 %exitcond, label %for.body4, label %for.end8
for.end8: ; preds = %for.body4
ret void
@@ -82,15 +100,22 @@ for.end8: ; preds = %for.body4
;; for (long int i = 0; i <= 5; i++)
-;; A[11*i - 45] = ...
+;; A[11*i - 45] = i;
;; for (long int j = 0; j < 10; j++)
-;; ... = A[j];
+;; *B++ = A[j];
define void @rdiv2(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, 11
@@ -98,20 +123,22 @@ for.body: ; preds = %for.body, %entry
%arrayidx = getelementptr inbounds i32* %A, i64 %sub
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc, 6
- br i1 %cmp, label %for.body, label %for.body4
+ %exitcond4 = icmp ne i64 %inc, 6
+ br i1 %exitcond4, label %for.body, label %for.body4.preheader
+
+for.body4.preheader: ; preds = %for.body
+ br label %for.body4
-for.body4: ; preds = %for.body4, %for.body
- %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
- %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%arrayidx5 = getelementptr inbounds i32* %A, i64 %j.02
%0 = load i32* %arrayidx5, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc7 = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc7, 10
- br i1 %cmp2, label %for.body4, label %for.end8
+ %exitcond = icmp ne i64 %inc7, 10
+ br i1 %exitcond, label %for.body4, label %for.end8
for.end8: ; preds = %for.body4
ret void
@@ -119,15 +146,22 @@ for.end8: ; preds = %for.body4
;; for (long int i = 0; i < 5; i++)
-;; A[11*i - 45] = ...
+;; A[11*i - 45] = i;
;; for (long int j = 0; j <= 10; j++)
-;; ... = A[j];
+;; *B++ = A[j];
define void @rdiv3(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, 11
@@ -135,20 +169,22 @@ for.body: ; preds = %for.body, %entry
%arrayidx = getelementptr inbounds i32* %A, i64 %sub
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc, 5
- br i1 %cmp, label %for.body, label %for.body4
+ %exitcond4 = icmp ne i64 %inc, 5
+ br i1 %exitcond4, label %for.body, label %for.body4.preheader
+
+for.body4.preheader: ; preds = %for.body
+ br label %for.body4
-for.body4: ; preds = %for.body4, %for.body
- %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
- %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%arrayidx5 = getelementptr inbounds i32* %A, i64 %j.02
%0 = load i32* %arrayidx5, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc7 = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc7, 11
- br i1 %cmp2, label %for.body4, label %for.end8
+ %exitcond = icmp ne i64 %inc7, 11
+ br i1 %exitcond, label %for.body4, label %for.end8
for.end8: ; preds = %for.body4
ret void
@@ -156,15 +192,22 @@ for.end8: ; preds = %for.body4
;; for (long int i = 0; i <= 5; i++)
-;; A[11*i - 45] = ...
+;; A[11*i - 45] = i;
;; for (long int j = 0; j <= 10; j++)
-;; ... = A[j];
+;; *B++ = A[j];
define void @rdiv4(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, 11
@@ -172,20 +215,22 @@ for.body: ; preds = %for.body, %entry
%arrayidx = getelementptr inbounds i32* %A, i64 %sub
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc, 6
- br i1 %cmp, label %for.body, label %for.body4
+ %exitcond4 = icmp ne i64 %inc, 6
+ br i1 %exitcond4, label %for.body, label %for.body4.preheader
+
+for.body4.preheader: ; preds = %for.body
+ br label %for.body4
-for.body4: ; preds = %for.body4, %for.body
- %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
- %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%arrayidx5 = getelementptr inbounds i32* %A, i64 %j.02
%0 = load i32* %arrayidx5, align 4
-; CHECK: da analyze - flow!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc7 = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc7, 11
- br i1 %cmp2, label %for.body4, label %for.end8
+ %exitcond = icmp ne i64 %inc7, 11
+ br i1 %exitcond, label %for.body4, label %for.end8
for.end8: ; preds = %for.body4
ret void
@@ -193,15 +238,22 @@ for.end8: ; preds = %for.body4
;; for (long int i = 0; i < 5; i++)
-;; A[-11*i + 45] = ...
+;; A[-11*i + 45] = i;
;; for (long int j = 0; j < 10; j++)
-;; ... = A[-j];
+;; *B++ = A[-j];
define void @rdiv5(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, -11
@@ -209,21 +261,23 @@ for.body: ; preds = %for.body, %entry
%arrayidx = getelementptr inbounds i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc, 5
- br i1 %cmp, label %for.body, label %for.body4
+ %exitcond4 = icmp ne i64 %inc, 5
+ br i1 %exitcond4, label %for.body, label %for.body4.preheader
-for.body4: ; preds = %for.body4, %for.body
- %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
- %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
+for.body4.preheader: ; preds = %for.body
+ br label %for.body4
+
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%sub = sub nsw i64 0, %j.02
%arrayidx5 = getelementptr inbounds i32* %A, i64 %sub
%0 = load i32* %arrayidx5, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc7 = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc7, 10
- br i1 %cmp2, label %for.body4, label %for.end8
+ %exitcond = icmp ne i64 %inc7, 10
+ br i1 %exitcond, label %for.body4, label %for.end8
for.end8: ; preds = %for.body4
ret void
@@ -231,15 +285,22 @@ for.end8: ; preds = %for.body4
;; for (long int i = 0; i <= 5; i++)
-;; A[-11*i + 45] = ...
+;; A[-11*i + 45] = i;
;; for (long int j = 0; j < 10; j++)
-;; ... = A[-j];
+;; *B++ = A[-j];
define void @rdiv6(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, -11
@@ -247,21 +308,23 @@ for.body: ; preds = %for.body, %entry
%arrayidx = getelementptr inbounds i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc, 6
- br i1 %cmp, label %for.body, label %for.body4
+ %exitcond4 = icmp ne i64 %inc, 6
+ br i1 %exitcond4, label %for.body, label %for.body4.preheader
+
+for.body4.preheader: ; preds = %for.body
+ br label %for.body4
-for.body4: ; preds = %for.body4, %for.body
- %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
- %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%sub = sub nsw i64 0, %j.02
%arrayidx5 = getelementptr inbounds i32* %A, i64 %sub
%0 = load i32* %arrayidx5, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc7 = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc7, 10
- br i1 %cmp2, label %for.body4, label %for.end8
+ %exitcond = icmp ne i64 %inc7, 10
+ br i1 %exitcond, label %for.body4, label %for.end8
for.end8: ; preds = %for.body4
ret void
@@ -269,15 +332,22 @@ for.end8: ; preds = %for.body4
;; for (long int i = 0; i < 5; i++)
-;; A[-11*i + 45] = ...
+;; A[-11*i + 45] = i;
;; for (long int j = 0; j <= 10; j++)
-;; ... = A[-j];
+;; *B++ = A[-j];
define void @rdiv7(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, -11
@@ -285,21 +355,23 @@ for.body: ; preds = %for.body, %entry
%arrayidx = getelementptr inbounds i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc, 5
- br i1 %cmp, label %for.body, label %for.body4
+ %exitcond4 = icmp ne i64 %inc, 5
+ br i1 %exitcond4, label %for.body, label %for.body4.preheader
-for.body4: ; preds = %for.body4, %for.body
- %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
- %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
+for.body4.preheader: ; preds = %for.body
+ br label %for.body4
+
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%sub = sub nsw i64 0, %j.02
%arrayidx5 = getelementptr inbounds i32* %A, i64 %sub
%0 = load i32* %arrayidx5, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc7 = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc7, 11
- br i1 %cmp2, label %for.body4, label %for.end8
+ %exitcond = icmp ne i64 %inc7, 11
+ br i1 %exitcond, label %for.body4, label %for.end8
for.end8: ; preds = %for.body4
ret void
@@ -307,15 +379,22 @@ for.end8: ; preds = %for.body4
;; for (long int i = 0; i <= 5; i++)
-;; A[-11*i + 45] = ...
+;; A[-11*i + 45] = i;
;; for (long int j = 0; j <= 10; j++)
-;; ... = A[-j];
+;; *B++ = A[-j];
define void @rdiv8(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.03 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, -11
@@ -323,21 +402,23 @@ for.body: ; preds = %for.body, %entry
%arrayidx = getelementptr inbounds i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc, 6
- br i1 %cmp, label %for.body, label %for.body4
+ %exitcond4 = icmp ne i64 %inc, 6
+ br i1 %exitcond4, label %for.body, label %for.body4.preheader
+
+for.body4.preheader: ; preds = %for.body
+ br label %for.body4
-for.body4: ; preds = %for.body4, %for.body
- %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body ]
- %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body ]
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.02 = phi i64 [ %inc7, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.01 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%sub = sub nsw i64 0, %j.02
%arrayidx5 = getelementptr inbounds i32* %A, i64 %sub
%0 = load i32* %arrayidx5, align 4
-; CHECK: da analyze - flow!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc7 = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc7, 11
- br i1 %cmp2, label %for.body4, label %for.end8
+ %exitcond = icmp ne i64 %inc7, 11
+ br i1 %exitcond, label %for.body4, label %for.end8
for.end8: ; preds = %for.body4
ret void
@@ -345,20 +426,27 @@ for.end8: ; preds = %for.body4
;; for (long int i = 0; i < 5; i++)
-;; for (long int j = 0; j < 10; j++)
-;; A[11*i - j] = ...
-;; ... = A[45];
+;; for (long int j = 0; j < 10; j++) {
+;; A[11*i - j] = i;
+;; *B++ = A[45];
define void @rdiv9(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc5, %entry
- %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc5 ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [S S]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc5
+ %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc5 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc6, %for.inc5 ]
br label %for.body3
-for.body3: ; preds = %for.body3, %for.cond1.preheader
+for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
%conv = trunc i64 %i.03 to i32
@@ -368,38 +456,46 @@ for.body3: ; preds = %for.body3, %for.con
store i32 %conv, i32* %arrayidx, align 4
%arrayidx4 = getelementptr inbounds i32* %A, i64 45
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc, 10
- br i1 %cmp2, label %for.body3, label %for.inc5
+ %exitcond = icmp ne i64 %inc, 10
+ br i1 %exitcond, label %for.body3, label %for.inc5
for.inc5: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.04, i64 10
%inc6 = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc6, 5
- br i1 %cmp, label %for.cond1.preheader, label %for.end7
+ %exitcond5 = icmp ne i64 %inc6, 5
+ br i1 %exitcond5, label %for.cond1.preheader, label %for.end7
for.end7: ; preds = %for.inc5
ret void
}
-;; for (long int i = 0; i < 5; i++)
-;; for (long int j = 0; j <= 10; j++)
-;; A[11*i - j] = ...
-;; ... = A[45];
+
+;; for (long int i = 0; i <= 5; i++)
+;; for (long int j = 0; j < 10; j++) {
+;; A[11*i - j] = i;
+;; *B++ = A[45];
define void @rdiv10(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc5, %entry
- %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc5 ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [S S]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc5
+ %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc5 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc6, %for.inc5 ]
br label %for.body3
-for.body3: ; preds = %for.body3, %for.cond1.preheader
+for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
%conv = trunc i64 %i.03 to i32
@@ -409,38 +505,45 @@ for.body3: ; preds = %for.body3, %for.con
store i32 %conv, i32* %arrayidx, align 4
%arrayidx4 = getelementptr inbounds i32* %A, i64 45
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc, 10
- br i1 %cmp2, label %for.body3, label %for.inc5
+ %exitcond = icmp ne i64 %inc, 10
+ br i1 %exitcond, label %for.body3, label %for.inc5
for.inc5: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.04, i64 10
%inc6 = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc6, 6
- br i1 %cmp, label %for.cond1.preheader, label %for.end7
+ %exitcond5 = icmp ne i64 %inc6, 6
+ br i1 %exitcond5, label %for.cond1.preheader, label %for.end7
for.end7: ; preds = %for.inc5
ret void
}
-;; for (long int i = 0; i <= 5; i++)
-;; for (long int j = 0; j <= 10; j++)
-;; A[11*i - j] = ...
-;; ... = A[45];
+;; for (long int i = 0; i < 5; i++)
+;; for (long int j = 0; j <= 10; j++) {
+;; A[11*i - j] = i;
+;; *B++ = A[45];
define void @rdiv11(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc5, %entry
- %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc5 ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [S S]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc5
+ %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc5 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc6, %for.inc5 ]
br label %for.body3
-for.body3: ; preds = %for.body3, %for.cond1.preheader
+for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
%conv = trunc i64 %i.03 to i32
@@ -450,38 +553,45 @@ for.body3: ; preds = %for.body3, %for.con
store i32 %conv, i32* %arrayidx, align 4
%arrayidx4 = getelementptr inbounds i32* %A, i64 45
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc, 11
- br i1 %cmp2, label %for.body3, label %for.inc5
+ %exitcond = icmp ne i64 %inc, 11
+ br i1 %exitcond, label %for.body3, label %for.inc5
for.inc5: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.04, i64 11
%inc6 = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc6, 5
- br i1 %cmp, label %for.cond1.preheader, label %for.end7
+ %exitcond5 = icmp ne i64 %inc6, 5
+ br i1 %exitcond5, label %for.cond1.preheader, label %for.end7
for.end7: ; preds = %for.inc5
ret void
}
-;; for (long int i = 0; i < 5; i++)
-;; for (long int j = 0; j < 10; j++)
-;; A[11*i - j] = ...
-;; ... = A[45];
+;; for (long int i = 0; i <= 5; i++)
+;; for (long int j = 0; j <= 10; j++) {
+;; A[11*i - j] = i;
+;; *B++ = A[45];
define void @rdiv12(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc5, %entry
- %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc5 ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [* *|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [S S]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc5
+ %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc5 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc6, %for.inc5 ]
br label %for.body3
-for.body3: ; preds = %for.body3, %for.cond1.preheader
+for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
%conv = trunc i64 %i.03 to i32
@@ -491,17 +601,17 @@ for.body3: ; preds = %for.body3, %for.con
store i32 %conv, i32* %arrayidx, align 4
%arrayidx4 = getelementptr inbounds i32* %A, i64 45
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - flow [* *|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc, 11
- br i1 %cmp2, label %for.body3, label %for.inc5
+ %exitcond = icmp ne i64 %inc, 11
+ br i1 %exitcond, label %for.body3, label %for.inc5
for.inc5: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.04, i64 11
%inc6 = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc6, 6
- br i1 %cmp, label %for.cond1.preheader, label %for.end7
+ %exitcond5 = icmp ne i64 %inc6, 6
+ br i1 %exitcond5, label %for.cond1.preheader, label %for.end7
for.end7: ; preds = %for.inc5
ret void
diff --git a/test/Analysis/DependenceAnalysis/ExactSIV.ll b/test/Analysis/DependenceAnalysis/ExactSIV.ll
index 71e050246291..586bbe5096d6 100644
--- a/test/Analysis/DependenceAnalysis/ExactSIV.ll
+++ b/test/Analysis/DependenceAnalysis/ExactSIV.ll
@@ -6,14 +6,21 @@ target triple = "x86_64-apple-macosx10.6.0"
;; for (long unsigned i = 0; i < 10; i++) {
-;; A[i + 10] = ...
-;; ... = A[2*i + 1];
+;; A[i + 10] = i;
+;; *B++ = A[2*i + 1];
define void @exact0(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [<=|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -24,12 +31,11 @@ for.body: ; preds = %for.body, %entry
%add13 = or i64 %mul, 1
%arrayidx2 = getelementptr inbounds i32* %A, i64 %add13
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - flow [<=|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 10
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 10
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
@@ -37,14 +43,21 @@ for.end: ; preds = %for.body
;; for (long unsigned i = 0; i < 10; i++) {
-;; A[4*i + 10] = ...
-;; ... = A[2*i + 1];
+;; A[4*i + 10] = i;
+;; *B++ = A[2*i + 1];
define void @exact1(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -56,12 +69,11 @@ for.body: ; preds = %for.body, %entry
%add23 = or i64 %mul1, 1
%arrayidx3 = getelementptr inbounds i32* %A, i64 %add23
%0 = load i32* %arrayidx3, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 10
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 10
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
@@ -69,14 +81,21 @@ for.end: ; preds = %for.body
;; for (long unsigned i = 0; i < 10; i++) {
-;; A[6*i] = ...
-;; ... = A[i + 60];
+;; A[6*i] = i;
+;; *B++ = A[i + 60];
define void @exact2(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -86,12 +105,11 @@ for.body: ; preds = %for.body, %entry
%add = add i64 %i.02, 60
%arrayidx1 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 10
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 10
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
@@ -99,14 +117,21 @@ for.end: ; preds = %for.body
;; for (long unsigned i = 0; i <= 10; i++) {
-;; A[6*i] = ...
-;; ... = A[i + 60];
+;; A[6*i] = i;
+;; *B++ = A[i + 60];
define void @exact3(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [>]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -116,12 +141,11 @@ for.body: ; preds = %for.body, %entry
%add = add i64 %i.02, 60
%arrayidx1 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [>]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 11
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 11
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
@@ -129,14 +153,21 @@ for.end: ; preds = %for.body
;; for (long unsigned i = 0; i < 12; i++) {
-;; A[6*i] = ...
-;; ... = A[i + 60];
+;; A[6*i] = i;
+;; *B++ = A[i + 60];
define void @exact4(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [>]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -146,12 +177,11 @@ for.body: ; preds = %for.body, %entry
%add = add i64 %i.02, 60
%arrayidx1 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [>]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 12
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 12
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
@@ -159,14 +189,21 @@ for.end: ; preds = %for.body
;; for (long unsigned i = 0; i <= 12; i++) {
-;; A[6*i] = ...
-;; ... = A[i + 60];
+;; A[6*i] = i;
+;; *B++ = A[i + 60];
define void @exact5(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [=>|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -176,12 +213,11 @@ for.body: ; preds = %for.body, %entry
%add = add i64 %i.02, 60
%arrayidx1 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [=>|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 13
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 13
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
@@ -189,14 +225,21 @@ for.end: ; preds = %for.body
;; for (long unsigned i = 0; i < 18; i++) {
-;; A[6*i] = ...
-;; ... = A[i + 60];
+;; A[6*i] = i;
+;; *B++ = A[i + 60];
define void @exact6(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [=>|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -206,12 +249,11 @@ for.body: ; preds = %for.body, %entry
%add = add i64 %i.02, 60
%arrayidx1 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [=>|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 18
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 18
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
@@ -219,14 +261,21 @@ for.end: ; preds = %for.body
;; for (long unsigned i = 0; i <= 18; i++) {
-;; A[6*i] = ...
-;; ... = A[i + 60];
+;; A[6*i] = i;
+;; *B++ = A[i + 60];
define void @exact7(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [*|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -236,12 +285,11 @@ for.body: ; preds = %for.body, %entry
%add = add i64 %i.02, 60
%arrayidx1 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [*|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 19
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 19
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
@@ -249,14 +297,21 @@ for.end: ; preds = %for.body
;; for (long unsigned i = 0; i < 10; i++) {
-;; A[-6*i] = ...
-;; ... = A[-i - 60];
+;; A[-6*i] = i;
+;; *B++ = A[-i - 60];
define void @exact8(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -266,12 +321,11 @@ for.body: ; preds = %for.body, %entry
%sub1 = sub i64 -60, %i.02
%arrayidx2 = getelementptr inbounds i32* %A, i64 %sub1
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 10
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 10
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
@@ -279,14 +333,21 @@ for.end: ; preds = %for.body
;; for (long unsigned i = 0; i <= 10; i++) {
-;; A[-6*i] = ...
-;; ... = A[-i - 60];
+;; A[-6*i] = i;
+;; *B++ = A[-i - 60];
define void @exact9(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [>]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -296,12 +357,11 @@ for.body: ; preds = %for.body, %entry
%sub1 = sub i64 -60, %i.02
%arrayidx2 = getelementptr inbounds i32* %A, i64 %sub1
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - flow [>]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 11
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 11
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
@@ -309,14 +369,21 @@ for.end: ; preds = %for.body
;; for (long unsigned i = 0; i < 12; i++) {
-;; A[-6*i] = ...
-;; ... = A[-i - 60];
+;; A[-6*i] = i;
+;; *B++ = A[-i - 60];
define void @exact10(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [>]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -326,12 +393,11 @@ for.body: ; preds = %for.body, %entry
%sub1 = sub i64 -60, %i.02
%arrayidx2 = getelementptr inbounds i32* %A, i64 %sub1
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - flow [>]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 12
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 12
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
@@ -339,14 +405,21 @@ for.end: ; preds = %for.body
;; for (long unsigned i = 0; i <= 12; i++) {
-;; A[-6*i] = ...
-;; ... = A[-i - 60];
+;; A[-6*i] = i;
+;; *B++ = A[-i - 60];
define void @exact11(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [=>|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -356,12 +429,11 @@ for.body: ; preds = %for.body, %entry
%sub1 = sub i64 -60, %i.02
%arrayidx2 = getelementptr inbounds i32* %A, i64 %sub1
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - flow [=>|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 13
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 13
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
@@ -369,14 +441,21 @@ for.end: ; preds = %for.body
;; for (long unsigned i = 0; i < 18; i++) {
-;; A[-6*i] = ...
-;; ... = A[-i - 60];
+;; A[-6*i] = i;
+;; *B++ = A[-i - 60];
define void @exact12(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [=>|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -386,12 +465,11 @@ for.body: ; preds = %for.body, %entry
%sub1 = sub i64 -60, %i.02
%arrayidx2 = getelementptr inbounds i32* %A, i64 %sub1
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - flow [=>|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 18
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 18
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
@@ -399,14 +477,21 @@ for.end: ; preds = %for.body
;; for (long unsigned i = 0; i <= 18; i++) {
-;; A[-6*i] = ...
-;; ... = A[-i - 60];
+;; A[-6*i] = i;
+;; *B++ = A[-i - 60];
define void @exact13(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [*|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -416,12 +501,11 @@ for.body: ; preds = %for.body, %entry
%sub1 = sub i64 -60, %i.02
%arrayidx2 = getelementptr inbounds i32* %A, i64 %sub1
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - flow [*|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 19
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 19
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
diff --git a/test/Analysis/DependenceAnalysis/GCD.ll b/test/Analysis/DependenceAnalysis/GCD.ll
index 94c93a8a0dd4..a42212464f86 100644
--- a/test/Analysis/DependenceAnalysis/GCD.ll
+++ b/test/Analysis/DependenceAnalysis/GCD.ll
@@ -6,14 +6,21 @@ target triple = "x86_64-apple-macosx10.6.0"
;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++)
-;; A[2*i - 4*j] = ...
-;; ... = A[6*i + 8*j];
+;; for (long int j = 0; j < 100; j++) {
+;; A[2*i - 4*j] = i;
+;; *B++ = A[6*i + 8*j];
define void @gcd0(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - output [* *]!
+; CHECK: da analyze - flow [=> *|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [* *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc8
%B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc8 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ]
@@ -33,7 +40,6 @@ for.body3: ; preds = %for.cond1.preheader
%add = add nsw i64 %mul5, %mul6
%arrayidx7 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx7, align 4
-; CHECK: da analyze - flow [=> *|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
@@ -52,14 +58,21 @@ for.end10: ; preds = %for.inc8
;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++)
-;; A[2*i - 4*j] = ...
-;; ... = A[6*i + 8*j + 1];
+;; for (long int j = 0; j < 100; j++) {
+;; A[2*i - 4*j] = i;
+;; *B++ = A[6*i + 8*j + 1];
define void @gcd1(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - output [* *]!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [* *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc9
%B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc9 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc10, %for.inc9 ]
@@ -80,7 +93,6 @@ for.body3: ; preds = %for.cond1.preheader
%add7 = or i64 %add, 1
%arrayidx8 = getelementptr inbounds i32* %A, i64 %add7
%0 = load i32* %arrayidx8, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
@@ -99,14 +111,21 @@ for.end11: ; preds = %for.inc9
;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++)
-;; A[2*i - 4*j + 1] = ...
-;; ... = A[6*i + 8*j];
+;; for (long int j = 0; j < 100; j++) {
+;; A[2*i - 4*j + 1] = i;
+;; *B++ = A[6*i + 8*j];
define void @gcd2(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - output [* *]!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [* *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc9
%B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc9 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc10, %for.inc9 ]
@@ -127,7 +146,6 @@ for.body3: ; preds = %for.cond1.preheader
%add7 = add nsw i64 %mul5, %mul6
%arrayidx8 = getelementptr inbounds i32* %A, i64 %add7
%0 = load i32* %arrayidx8, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
@@ -146,14 +164,21 @@ for.end11: ; preds = %for.inc9
;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++)
-;; A[i + 2*j] = ...
-;; ... = A[i + 2*j - 1];
+;; for (long int j = 0; j < 100; j++) {
+;; A[i + 2*j] = i;
+;; *B++ = A[i + 2*j - 1];
define void @gcd3(i32* %A, i32* %B) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - output [* *]!
+; CHECK: da analyze - flow [<> *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [* *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc7
%B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc7 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ]
@@ -172,7 +197,6 @@ for.body3: ; preds = %for.cond1.preheader
%sub = add nsw i64 %add5, -1
%arrayidx6 = getelementptr inbounds i32* %A, i64 %sub
%0 = load i32* %arrayidx6, align 4
-; CHECK: da analyze - flow [<> *]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
@@ -190,16 +214,22 @@ for.end9: ; preds = %for.inc7
}
-;; void gcd4(int *A, int *B, long int M, long int N) {
-;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++) {
-;; A[5*i + 10*j*M + 9*M*N] = i;
-;; *B++ = A[15*i + 20*j*M - 21*N*M + 4];
+;; for (long int i = 0; i < 100; i++)
+;; for (long int j = 0; j < 100; j++) {
+;; A[5*i + 10*j*M + 9*M*N] = i;
+;; *B++ = A[15*i + 20*j*M - 21*N*M + 4];
define void @gcd4(i32* %A, i32* %B, i64 %M, i64 %N) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - output [* *]!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [* *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc17
%B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc17 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc18, %for.inc17 ]
@@ -228,7 +258,6 @@ for.body3: ; preds = %for.cond1.preheader
%add15 = add nsw i64 %sub, 4
%arrayidx16 = getelementptr inbounds i32* %A, i64 %add15
%0 = load i32* %arrayidx16, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
@@ -246,16 +275,22 @@ for.end19: ; preds = %for.inc17
}
-;; void gcd5(int *A, int *B, long int M, long int N) {
-;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++) {
-;; A[5*i + 10*j*M + 9*M*N] = i;
-;; *B++ = A[15*i + 20*j*M - 21*N*M + 5];
+;; for (long int i = 0; i < 100; i++)
+;; for (long int j = 0; j < 100; j++) {
+;; A[5*i + 10*j*M + 9*M*N] = i;
+;; *B++ = A[15*i + 20*j*M - 21*N*M + 5];
define void @gcd5(i32* %A, i32* %B, i64 %M, i64 %N) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
+; CHECK: da analyze - output [* *]!
+; CHECK: da analyze - flow [<> *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [* *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.cond1.preheader: ; preds = %entry, %for.inc17
%B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc17 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc18, %for.inc17 ]
@@ -284,7 +319,6 @@ for.body3: ; preds = %for.cond1.preheader
%add15 = add nsw i64 %sub, 5
%arrayidx16 = getelementptr inbounds i32* %A, i64 %add15
%0 = load i32* %arrayidx16, align 4
-; CHECK: da analyze - flow [<> *]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
@@ -302,17 +336,23 @@ for.end19: ; preds = %for.inc17
}
-;; void gcd6(long int n, int A[][n], int *B) {
-;; for (long int i = 0; i < n; i++)
-;; for (long int j = 0; j < n; j++) {
-;; A[2*i][4*j] = i;
-;; *B++ = A[8*i][6*j + 1];
+;; for (long int i = 0; i < n; i++)
+;; for (long int j = 0; j < n; j++) {
+;; A[2*i][4*j] = i;
+;; *B++ = A[8*i][6*j + 1];
define void @gcd6(i64 %n, i32* %A, i32* %B) nounwind uwtable ssp {
entry:
%cmp4 = icmp sgt i64 %n, 0
br i1 %cmp4, label %for.cond1.preheader.preheader, label %for.end12
+; CHECK: da analyze - output [* *]!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [* *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - output [* *]!
+
for.cond1.preheader.preheader: ; preds = %entry
br label %for.cond1.preheader
@@ -342,7 +382,6 @@ for.body3: ; preds = %for.body3.preheader
%arrayidx8.sum = add i64 %1, %add7
%arrayidx9 = getelementptr inbounds i32* %A, i64 %arrayidx8.sum
%2 = load i32* %arrayidx9, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.12, i64 1
store i32 %2, i32* %B.addr.12, align 4
%inc = add nsw i64 %j.03, 1
@@ -367,11 +406,10 @@ for.end12: ; preds = %for.end12.loopexit,
}
-;; void gcd7(int n, int A[][n], int *B) {
-;; for (int i = 0; i < n; i++)
-;; for (int j = 0; j < n; j++) {
-;; A[2*i][4*j] = i;
-;; *B++ = A[8*i][6*j + 1];
+;; for (int i = 0; i < n; i++)
+;; for (int j = 0; j < n; j++) {
+;; A[2*i][4*j] = i;
+;; *B++ = A[8*i][6*j + 1];
define void @gcd7(i32 %n, i32* %A, i32* %B) nounwind uwtable ssp {
entry:
@@ -379,6 +417,13 @@ entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %for.cond1.preheader.preheader, label %for.end15
+; CHECK: da analyze - output [* *]!
+; CHECK: da analyze - flow [* *|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [* *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - output [* *]!
+
for.cond1.preheader.preheader: ; preds = %entry
br label %for.cond1.preheader
@@ -419,7 +464,6 @@ for.body3: ; preds = %for.body3.preheader
%arrayidx11.sum = add i64 %10, %idxprom8
%arrayidx12 = getelementptr inbounds i32* %A, i64 %arrayidx11.sum
%11 = load i32* %arrayidx12, align 4
-; CHECK: da analyze - flow [* *|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.12, i64 1
store i32 %11, i32* %B.addr.12, align 4
%indvars.iv.next = add i64 %indvars.iv, 1
@@ -446,17 +490,23 @@ for.end15: ; preds = %for.end15.loopexit,
}
-;; void gcd8(int n, int *A, int *B) {
-;; for (int i = 0; i < n; i++)
-;; for (int j = 0; j < n; j++) {
-;; A[n*2*i + 4*j] = i;
-;; *B++ = A[n*8*i + 6*j + 1];
+;; for (int i = 0; i < n; i++)
+;; for (int j = 0; j < n; j++) {
+;; A[n*2*i + 4*j] = i;
+;; *B++ = A[n*8*i + 6*j + 1];
define void @gcd8(i32 %n, i32* %A, i32* %B) nounwind uwtable ssp {
entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %for.cond1.preheader.preheader, label %for.end15
+; CHECK: da analyze - output [* *]!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [* *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - output [* *]!
+
for.cond1.preheader.preheader: ; preds = %entry
br label %for.cond1.preheader
@@ -492,7 +542,6 @@ for.body3: ; preds = %for.body3.preheader
%idxprom11 = sext i32 %add10 to i64
%arrayidx12 = getelementptr inbounds i32* %A, i64 %idxprom11
%5 = load i32* %arrayidx12, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.12, i64 1
store i32 %5, i32* %B.addr.12, align 4
%indvars.iv.next = add i64 %indvars.iv, 1
@@ -518,11 +567,10 @@ for.end15: ; preds = %for.end15.loopexit,
}
-;; void gcd9(unsigned n, int A[][n], int *B) {
-;; for (unsigned i = 0; i < n; i++)
-;; for (unsigned j = 0; j < n; j++) {
-;; A[2*i][4*j] = i;
-;; *B++ = A[8*i][6*j + 1];
+;; for (unsigned i = 0; i < n; i++)
+;; for (unsigned j = 0; j < n; j++) {
+;; A[2*i][4*j] = i;
+;; *B++ = A[8*i][6*j + 1];
define void @gcd9(i32 %n, i32* %A, i32* %B) nounwind uwtable ssp {
entry:
@@ -530,6 +578,13 @@ entry:
%cmp4 = icmp eq i32 %n, 0
br i1 %cmp4, label %for.end15, label %for.cond1.preheader.preheader
+; CHECK: da analyze - output [* *]!
+; CHECK: da analyze - flow [* *|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [* *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - output [* *]!
+
for.cond1.preheader.preheader: ; preds = %entry
br label %for.cond1.preheader
@@ -570,7 +625,6 @@ for.body3: ; preds = %for.body3.preheader
%arrayidx11.sum = add i64 %10, %idxprom8
%arrayidx12 = getelementptr inbounds i32* %A, i64 %arrayidx11.sum
%11 = load i32* %arrayidx12, align 4
-; CHECK: da analyze - flow [* *|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.12, i64 1
store i32 %11, i32* %B.addr.12, align 4
%indvars.iv.next = add i64 %indvars.iv, 1
diff --git a/test/Analysis/DependenceAnalysis/Preliminary.ll b/test/Analysis/DependenceAnalysis/Preliminary.ll
index 3ef63fd5592f..f36b85a5951e 100644
--- a/test/Analysis/DependenceAnalysis/Preliminary.ll
+++ b/test/Analysis/DependenceAnalysis/Preliminary.ll
@@ -1,111 +1,147 @@
-; RUN: opt < %s -analyze -basicaa -indvars -da | FileCheck %s
-
-; This series of tests is more interesting when debugging is enabled.
+; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
; ModuleID = 'Preliminary.bc'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.6.0"
-;; may alias
-;; int p0(int n, int *A, int *B) {
+;;int p0(int n, int *A, int *B) {
;; A[0] = n;
;; return B[1];
define i32 @p0(i32 %n, i32* %A, i32* %B) nounwind uwtable ssp {
entry:
store i32 %n, i32* %A, align 4
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
%arrayidx1 = getelementptr inbounds i32* %B, i64 1
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - confused!
ret i32 %0
}
-;; no alias
-;; int p1(int n, int *restrict A, int *restrict B) {
+;;int p1(int n, int *restrict A, int *restrict B) {
;; A[0] = n;
;; return B[1];
define i32 @p1(i32 %n, i32* noalias %A, i32* noalias %B) nounwind uwtable ssp {
entry:
store i32 %n, i32* %A, align 4
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+
%arrayidx1 = getelementptr inbounds i32* %B, i64 1
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - none!
ret i32 %0
}
-;; check loop nesting levels
-;; for (long int i = 0; i < n; i++)
-;; for (long int j = 0; j < n; j++)
-;; for (long int k = 0; k < n; k++)
-;; A[i][j][k] = ...
-;; for (long int k = 0; k < n; k++)
-;; ... = A[i + 3][j + 2][k + 1];
+
+;; for (long int i = 0; i < n; i++) {
+;; for (long int j = 0; j < n; j++) {
+;; for (long int k = 0; k < n; k++) {
+;; A[i][j][k] = i;
+;; }
+;; for (long int k = 0; k < n; k++) {
+;; *B++ = A[i + 3][j + 2][k + 1];
define void @p2(i64 %n, [100 x [100 x i64]]* %A, i64* %B) nounwind uwtable ssp {
entry:
%cmp10 = icmp sgt i64 %n, 0
- br i1 %cmp10, label %for.cond1.preheader, label %for.end26
+ br i1 %cmp10, label %for.cond1.preheader.preheader, label %for.end26
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [-3 -2]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - output [* * *]!
-for.cond1.preheader: ; preds = %for.inc24, %entry
- %B.addr.012 = phi i64* [ %B.addr.1.lcssa, %for.inc24 ], [ %B, %entry ]
- %i.011 = phi i64 [ %inc25, %for.inc24 ], [ 0, %entry ]
+for.cond1.preheader.preheader: ; preds = %entry
+ br label %for.cond1.preheader
+
+for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.inc24
+ %B.addr.012 = phi i64* [ %B.addr.1.lcssa, %for.inc24 ], [ %B, %for.cond1.preheader.preheader ]
+ %i.011 = phi i64 [ %inc25, %for.inc24 ], [ 0, %for.cond1.preheader.preheader ]
%cmp26 = icmp sgt i64 %n, 0
- br i1 %cmp26, label %for.cond4.preheader, label %for.inc24
+ br i1 %cmp26, label %for.cond4.preheader.preheader, label %for.inc24
+
+for.cond4.preheader.preheader: ; preds = %for.cond1.preheader
+ br label %for.cond4.preheader
-for.cond4.preheader: ; preds = %for.inc21, %for.cond1.preheader
- %B.addr.18 = phi i64* [ %B.addr.2.lcssa, %for.inc21 ], [ %B.addr.012, %for.cond1.preheader ]
- %j.07 = phi i64 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ]
+for.cond4.preheader: ; preds = %for.cond4.preheader.preheader, %for.inc21
+ %B.addr.18 = phi i64* [ %B.addr.2.lcssa, %for.inc21 ], [ %B.addr.012, %for.cond4.preheader.preheader ]
+ %j.07 = phi i64 [ %inc22, %for.inc21 ], [ 0, %for.cond4.preheader.preheader ]
%cmp51 = icmp sgt i64 %n, 0
- br i1 %cmp51, label %for.body6, label %for.cond10.loopexit
+ br i1 %cmp51, label %for.body6.preheader, label %for.cond10.loopexit
-for.body6: ; preds = %for.body6, %for.cond4.preheader
- %k.02 = phi i64 [ %inc, %for.body6 ], [ 0, %for.cond4.preheader ]
+for.body6.preheader: ; preds = %for.cond4.preheader
+ br label %for.body6
+
+for.body6: ; preds = %for.body6.preheader, %for.body6
+ %k.02 = phi i64 [ %inc, %for.body6 ], [ 0, %for.body6.preheader ]
%arrayidx8 = getelementptr inbounds [100 x [100 x i64]]* %A, i64 %i.011, i64 %j.07, i64 %k.02
store i64 %i.011, i64* %arrayidx8, align 8
%inc = add nsw i64 %k.02, 1
- %cmp5 = icmp slt i64 %inc, %n
- br i1 %cmp5, label %for.body6, label %for.cond10.loopexit
+ %exitcond13 = icmp ne i64 %inc, %n
+ br i1 %exitcond13, label %for.body6, label %for.cond10.loopexit.loopexit
+
+for.cond10.loopexit.loopexit: ; preds = %for.body6
+ br label %for.cond10.loopexit
-for.cond10.loopexit: ; preds = %for.body6, %for.cond4.preheader
+for.cond10.loopexit: ; preds = %for.cond10.loopexit.loopexit, %for.cond4.preheader
%cmp113 = icmp sgt i64 %n, 0
- br i1 %cmp113, label %for.body12, label %for.inc21
+ br i1 %cmp113, label %for.body12.preheader, label %for.inc21
-for.body12: ; preds = %for.body12, %for.cond10.loopexit
- %k9.05 = phi i64 [ %inc19, %for.body12 ], [ 0, %for.cond10.loopexit ]
- %B.addr.24 = phi i64* [ %incdec.ptr, %for.body12 ], [ %B.addr.18, %for.cond10.loopexit ]
+for.body12.preheader: ; preds = %for.cond10.loopexit
+ br label %for.body12
+
+for.body12: ; preds = %for.body12.preheader, %for.body12
+ %k9.05 = phi i64 [ %inc19, %for.body12 ], [ 0, %for.body12.preheader ]
+ %B.addr.24 = phi i64* [ %incdec.ptr, %for.body12 ], [ %B.addr.18, %for.body12.preheader ]
%add = add nsw i64 %k9.05, 1
%add13 = add nsw i64 %j.07, 2
%add14 = add nsw i64 %i.011, 3
%arrayidx17 = getelementptr inbounds [100 x [100 x i64]]* %A, i64 %add14, i64 %add13, i64 %add
%0 = load i64* %arrayidx17, align 8
-; CHECK: da analyze - flow [-3 -2]!
%incdec.ptr = getelementptr inbounds i64* %B.addr.24, i64 1
store i64 %0, i64* %B.addr.24, align 8
%inc19 = add nsw i64 %k9.05, 1
- %cmp11 = icmp slt i64 %inc19, %n
- br i1 %cmp11, label %for.body12, label %for.inc21
+ %exitcond = icmp ne i64 %inc19, %n
+ br i1 %exitcond, label %for.body12, label %for.inc21.loopexit
-for.inc21: ; preds = %for.body12, %for.cond10.loopexit
- %B.addr.2.lcssa = phi i64* [ %B.addr.18, %for.cond10.loopexit ], [ %incdec.ptr, %for.body12 ]
+for.inc21.loopexit: ; preds = %for.body12
+ %scevgep = getelementptr i64* %B.addr.18, i64 %n
+ br label %for.inc21
+
+for.inc21: ; preds = %for.inc21.loopexit, %for.cond10.loopexit
+ %B.addr.2.lcssa = phi i64* [ %B.addr.18, %for.cond10.loopexit ], [ %scevgep, %for.inc21.loopexit ]
%inc22 = add nsw i64 %j.07, 1
- %cmp2 = icmp slt i64 %inc22, %n
- br i1 %cmp2, label %for.cond4.preheader, label %for.inc24
+ %exitcond14 = icmp ne i64 %inc22, %n
+ br i1 %exitcond14, label %for.cond4.preheader, label %for.inc24.loopexit
+
+for.inc24.loopexit: ; preds = %for.inc21
+ %B.addr.2.lcssa.lcssa = phi i64* [ %B.addr.2.lcssa, %for.inc21 ]
+ br label %for.inc24
-for.inc24: ; preds = %for.inc21, %for.cond1.preheader
- %B.addr.1.lcssa = phi i64* [ %B.addr.012, %for.cond1.preheader ], [ %B.addr.2.lcssa, %for.inc21 ]
+for.inc24: ; preds = %for.inc24.loopexit, %for.cond1.preheader
+ %B.addr.1.lcssa = phi i64* [ %B.addr.012, %for.cond1.preheader ], [ %B.addr.2.lcssa.lcssa, %for.inc24.loopexit ]
%inc25 = add nsw i64 %i.011, 1
- %cmp = icmp slt i64 %inc25, %n
- br i1 %cmp, label %for.cond1.preheader, label %for.end26
+ %exitcond15 = icmp ne i64 %inc25, %n
+ br i1 %exitcond15, label %for.cond1.preheader, label %for.end26.loopexit
+
+for.end26.loopexit: ; preds = %for.inc24
+ br label %for.end26
-for.end26: ; preds = %for.inc24, %entry
+for.end26: ; preds = %for.end26.loopexit, %entry
ret void
}
-;; classify subscripts
;; for (long int i = 0; i < n; i++)
;; for (long int j = 0; j < n; j++)
;; for (long int k = 0; k < n; k++)
@@ -118,83 +154,127 @@ for.end26: ; preds = %for.inc24, %entry
;; for (long int s = 0; s < n; s++)
;; for (long int u = 0; u < n; u++)
;; for (long int t = 0; t < n; t++) {
-;; A[i - 3] [j] [2] [k-1] [2*l + 1] [m] [p + q] [r + s] = ...
-;; ... = A[i + 3] [2] [u] [1-k] [3*l - 1] [o] [1 + n] [t + 2];
+;; A[i - 3] [j] [2] [k-1] [2*l + 1] [m] [p + q] [r + s] = i;
+;; *B++ = A[i + 3] [2] [u] [1-k] [3*l - 1] [o] [1 + n] [t + 2];
define void @p3(i64 %n, [100 x [100 x [100 x [100 x [100 x [100 x [100 x i64]]]]]]]* %A, i64* %B) nounwind uwtable ssp {
entry:
%cmp44 = icmp sgt i64 %n, 0
- br i1 %cmp44, label %for.cond1.preheader, label %for.end90
+ br i1 %cmp44, label %for.cond1.preheader.preheader, label %for.end90
+
+; CHECK: da analyze - output [0 0 0 0 0 S * * * * S S]!
+; CHECK: da analyze - flow [-6 * * => * * * * * * * *] splitable!
+; CHECK: da analyze - split level = 3, iteration = 1!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [0 S 0 0 S 0 S S S S 0 0]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - output [* * * * * * * * * * * *]!
+
+for.cond1.preheader.preheader: ; preds = %entry
+ br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc88, %entry
- %B.addr.046 = phi i64* [ %B.addr.1.lcssa, %for.inc88 ], [ %B, %entry ]
- %i.045 = phi i64 [ %inc89, %for.inc88 ], [ 0, %entry ]
+for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.inc88
+ %B.addr.046 = phi i64* [ %B.addr.1.lcssa, %for.inc88 ], [ %B, %for.cond1.preheader.preheader ]
+ %i.045 = phi i64 [ %inc89, %for.inc88 ], [ 0, %for.cond1.preheader.preheader ]
%cmp240 = icmp sgt i64 %n, 0
- br i1 %cmp240, label %for.cond4.preheader, label %for.inc88
+ br i1 %cmp240, label %for.cond4.preheader.preheader, label %for.inc88
-for.cond4.preheader: ; preds = %for.inc85, %for.cond1.preheader
- %B.addr.142 = phi i64* [ %B.addr.2.lcssa, %for.inc85 ], [ %B.addr.046, %for.cond1.preheader ]
- %j.041 = phi i64 [ %inc86, %for.inc85 ], [ 0, %for.cond1.preheader ]
+for.cond4.preheader.preheader: ; preds = %for.cond1.preheader
+ br label %for.cond4.preheader
+
+for.cond4.preheader: ; preds = %for.cond4.preheader.preheader, %for.inc85
+ %B.addr.142 = phi i64* [ %B.addr.2.lcssa, %for.inc85 ], [ %B.addr.046, %for.cond4.preheader.preheader ]
+ %j.041 = phi i64 [ %inc86, %for.inc85 ], [ 0, %for.cond4.preheader.preheader ]
%cmp536 = icmp sgt i64 %n, 0
- br i1 %cmp536, label %for.cond7.preheader, label %for.inc85
+ br i1 %cmp536, label %for.cond7.preheader.preheader, label %for.inc85
+
+for.cond7.preheader.preheader: ; preds = %for.cond4.preheader
+ br label %for.cond7.preheader
-for.cond7.preheader: ; preds = %for.inc82, %for.cond4.preheader
- %B.addr.238 = phi i64* [ %B.addr.3.lcssa, %for.inc82 ], [ %B.addr.142, %for.cond4.preheader ]
- %k.037 = phi i64 [ %inc83, %for.inc82 ], [ 0, %for.cond4.preheader ]
+for.cond7.preheader: ; preds = %for.cond7.preheader.preheader, %for.inc82
+ %B.addr.238 = phi i64* [ %B.addr.3.lcssa, %for.inc82 ], [ %B.addr.142, %for.cond7.preheader.preheader ]
+ %k.037 = phi i64 [ %inc83, %for.inc82 ], [ 0, %for.cond7.preheader.preheader ]
%cmp832 = icmp sgt i64 %n, 0
- br i1 %cmp832, label %for.cond10.preheader, label %for.inc82
+ br i1 %cmp832, label %for.cond10.preheader.preheader, label %for.inc82
+
+for.cond10.preheader.preheader: ; preds = %for.cond7.preheader
+ br label %for.cond10.preheader
-for.cond10.preheader: ; preds = %for.inc79, %for.cond7.preheader
- %B.addr.334 = phi i64* [ %B.addr.4.lcssa, %for.inc79 ], [ %B.addr.238, %for.cond7.preheader ]
- %l.033 = phi i64 [ %inc80, %for.inc79 ], [ 0, %for.cond7.preheader ]
+for.cond10.preheader: ; preds = %for.cond10.preheader.preheader, %for.inc79
+ %B.addr.334 = phi i64* [ %B.addr.4.lcssa, %for.inc79 ], [ %B.addr.238, %for.cond10.preheader.preheader ]
+ %l.033 = phi i64 [ %inc80, %for.inc79 ], [ 0, %for.cond10.preheader.preheader ]
%cmp1128 = icmp sgt i64 %n, 0
- br i1 %cmp1128, label %for.cond13.preheader, label %for.inc79
+ br i1 %cmp1128, label %for.cond13.preheader.preheader, label %for.inc79
-for.cond13.preheader: ; preds = %for.inc76, %for.cond10.preheader
- %B.addr.430 = phi i64* [ %B.addr.5.lcssa, %for.inc76 ], [ %B.addr.334, %for.cond10.preheader ]
- %m.029 = phi i64 [ %inc77, %for.inc76 ], [ 0, %for.cond10.preheader ]
+for.cond13.preheader.preheader: ; preds = %for.cond10.preheader
+ br label %for.cond13.preheader
+
+for.cond13.preheader: ; preds = %for.cond13.preheader.preheader, %for.inc76
+ %B.addr.430 = phi i64* [ %B.addr.5.lcssa, %for.inc76 ], [ %B.addr.334, %for.cond13.preheader.preheader ]
+ %m.029 = phi i64 [ %inc77, %for.inc76 ], [ 0, %for.cond13.preheader.preheader ]
%cmp1424 = icmp sgt i64 %n, 0
- br i1 %cmp1424, label %for.cond16.preheader, label %for.inc76
+ br i1 %cmp1424, label %for.cond16.preheader.preheader, label %for.inc76
+
+for.cond16.preheader.preheader: ; preds = %for.cond13.preheader
+ br label %for.cond16.preheader
-for.cond16.preheader: ; preds = %for.inc73, %for.cond13.preheader
- %B.addr.526 = phi i64* [ %B.addr.6.lcssa, %for.inc73 ], [ %B.addr.430, %for.cond13.preheader ]
- %o.025 = phi i64 [ %inc74, %for.inc73 ], [ 0, %for.cond13.preheader ]
+for.cond16.preheader: ; preds = %for.cond16.preheader.preheader, %for.inc73
+ %B.addr.526 = phi i64* [ %B.addr.6.lcssa, %for.inc73 ], [ %B.addr.430, %for.cond16.preheader.preheader ]
+ %o.025 = phi i64 [ %inc74, %for.inc73 ], [ 0, %for.cond16.preheader.preheader ]
%cmp1720 = icmp sgt i64 %n, 0
- br i1 %cmp1720, label %for.cond19.preheader, label %for.inc73
+ br i1 %cmp1720, label %for.cond19.preheader.preheader, label %for.inc73
-for.cond19.preheader: ; preds = %for.inc70, %for.cond16.preheader
- %B.addr.622 = phi i64* [ %B.addr.7.lcssa, %for.inc70 ], [ %B.addr.526, %for.cond16.preheader ]
- %p.021 = phi i64 [ %inc71, %for.inc70 ], [ 0, %for.cond16.preheader ]
+for.cond19.preheader.preheader: ; preds = %for.cond16.preheader
+ br label %for.cond19.preheader
+
+for.cond19.preheader: ; preds = %for.cond19.preheader.preheader, %for.inc70
+ %B.addr.622 = phi i64* [ %B.addr.7.lcssa, %for.inc70 ], [ %B.addr.526, %for.cond19.preheader.preheader ]
+ %p.021 = phi i64 [ %inc71, %for.inc70 ], [ 0, %for.cond19.preheader.preheader ]
%cmp2016 = icmp sgt i64 %n, 0
- br i1 %cmp2016, label %for.cond22.preheader, label %for.inc70
+ br i1 %cmp2016, label %for.cond22.preheader.preheader, label %for.inc70
+
+for.cond22.preheader.preheader: ; preds = %for.cond19.preheader
+ br label %for.cond22.preheader
-for.cond22.preheader: ; preds = %for.inc67, %for.cond19.preheader
- %B.addr.718 = phi i64* [ %B.addr.8.lcssa, %for.inc67 ], [ %B.addr.622, %for.cond19.preheader ]
- %q.017 = phi i64 [ %inc68, %for.inc67 ], [ 0, %for.cond19.preheader ]
+for.cond22.preheader: ; preds = %for.cond22.preheader.preheader, %for.inc67
+ %B.addr.718 = phi i64* [ %B.addr.8.lcssa, %for.inc67 ], [ %B.addr.622, %for.cond22.preheader.preheader ]
+ %q.017 = phi i64 [ %inc68, %for.inc67 ], [ 0, %for.cond22.preheader.preheader ]
%cmp2312 = icmp sgt i64 %n, 0
- br i1 %cmp2312, label %for.cond25.preheader, label %for.inc67
+ br i1 %cmp2312, label %for.cond25.preheader.preheader, label %for.inc67
-for.cond25.preheader: ; preds = %for.inc64, %for.cond22.preheader
- %B.addr.814 = phi i64* [ %B.addr.9.lcssa, %for.inc64 ], [ %B.addr.718, %for.cond22.preheader ]
- %r.013 = phi i64 [ %inc65, %for.inc64 ], [ 0, %for.cond22.preheader ]
+for.cond25.preheader.preheader: ; preds = %for.cond22.preheader
+ br label %for.cond25.preheader
+
+for.cond25.preheader: ; preds = %for.cond25.preheader.preheader, %for.inc64
+ %B.addr.814 = phi i64* [ %B.addr.9.lcssa, %for.inc64 ], [ %B.addr.718, %for.cond25.preheader.preheader ]
+ %r.013 = phi i64 [ %inc65, %for.inc64 ], [ 0, %for.cond25.preheader.preheader ]
%cmp268 = icmp sgt i64 %n, 0
- br i1 %cmp268, label %for.cond28.preheader, label %for.inc64
+ br i1 %cmp268, label %for.cond28.preheader.preheader, label %for.inc64
+
+for.cond28.preheader.preheader: ; preds = %for.cond25.preheader
+ br label %for.cond28.preheader
-for.cond28.preheader: ; preds = %for.inc61, %for.cond25.preheader
- %B.addr.910 = phi i64* [ %B.addr.10.lcssa, %for.inc61 ], [ %B.addr.814, %for.cond25.preheader ]
- %s.09 = phi i64 [ %inc62, %for.inc61 ], [ 0, %for.cond25.preheader ]
+for.cond28.preheader: ; preds = %for.cond28.preheader.preheader, %for.inc61
+ %B.addr.910 = phi i64* [ %B.addr.10.lcssa, %for.inc61 ], [ %B.addr.814, %for.cond28.preheader.preheader ]
+ %s.09 = phi i64 [ %inc62, %for.inc61 ], [ 0, %for.cond28.preheader.preheader ]
%cmp294 = icmp sgt i64 %n, 0
- br i1 %cmp294, label %for.cond31.preheader, label %for.inc61
+ br i1 %cmp294, label %for.cond31.preheader.preheader, label %for.inc61
-for.cond31.preheader: ; preds = %for.inc58, %for.cond28.preheader
- %u.06 = phi i64 [ %inc59, %for.inc58 ], [ 0, %for.cond28.preheader ]
- %B.addr.105 = phi i64* [ %B.addr.11.lcssa, %for.inc58 ], [ %B.addr.910, %for.cond28.preheader ]
+for.cond31.preheader.preheader: ; preds = %for.cond28.preheader
+ br label %for.cond31.preheader
+
+for.cond31.preheader: ; preds = %for.cond31.preheader.preheader, %for.inc58
+ %u.06 = phi i64 [ %inc59, %for.inc58 ], [ 0, %for.cond31.preheader.preheader ]
+ %B.addr.105 = phi i64* [ %B.addr.11.lcssa, %for.inc58 ], [ %B.addr.910, %for.cond31.preheader.preheader ]
%cmp321 = icmp sgt i64 %n, 0
- br i1 %cmp321, label %for.body33, label %for.inc58
+ br i1 %cmp321, label %for.body33.preheader, label %for.inc58
+
+for.body33.preheader: ; preds = %for.cond31.preheader
+ br label %for.body33
-for.body33: ; preds = %for.body33, %for.cond31.preheader
- %t.03 = phi i64 [ %inc, %for.body33 ], [ 0, %for.cond31.preheader ]
- %B.addr.112 = phi i64* [ %incdec.ptr, %for.body33 ], [ %B.addr.105, %for.cond31.preheader ]
+for.body33: ; preds = %for.body33.preheader, %for.body33
+ %t.03 = phi i64 [ %inc, %for.body33 ], [ 0, %for.body33.preheader ]
+ %B.addr.112 = phi i64* [ %incdec.ptr, %for.body33 ], [ %B.addr.105, %for.body33.preheader ]
%add = add nsw i64 %r.013, %s.09
%add34 = add nsw i64 %p.021, %q.017
%mul = shl nsw i64 %l.033, 1
@@ -211,99 +291,153 @@ for.body33: ; preds = %for.body33, %for.co
%add49 = add nsw i64 %i.045, 3
%arrayidx57 = getelementptr inbounds [100 x [100 x [100 x [100 x [100 x [100 x [100 x i64]]]]]]]* %A, i64 %add49, i64 2, i64 %u.06, i64 %sub48, i64 %sub47, i64 %o.025, i64 %add45, i64 %add44
%0 = load i64* %arrayidx57, align 8
-; CHECK: da analyze - flow [-6 * * => * * * * * * * *] splitable!
-; CHECK: da analyze - split level = 3, iteration = 1!
%incdec.ptr = getelementptr inbounds i64* %B.addr.112, i64 1
store i64 %0, i64* %B.addr.112, align 8
%inc = add nsw i64 %t.03, 1
- %cmp32 = icmp slt i64 %inc, %n
- br i1 %cmp32, label %for.body33, label %for.inc58
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body33, label %for.inc58.loopexit
+
+for.inc58.loopexit: ; preds = %for.body33
+ %scevgep = getelementptr i64* %B.addr.105, i64 %n
+ br label %for.inc58
-for.inc58: ; preds = %for.body33, %for.cond31.preheader
- %B.addr.11.lcssa = phi i64* [ %B.addr.105, %for.cond31.preheader ], [ %incdec.ptr, %for.body33 ]
+for.inc58: ; preds = %for.inc58.loopexit, %for.cond31.preheader
+ %B.addr.11.lcssa = phi i64* [ %B.addr.105, %for.cond31.preheader ], [ %scevgep, %for.inc58.loopexit ]
%inc59 = add nsw i64 %u.06, 1
- %cmp29 = icmp slt i64 %inc59, %n
- br i1 %cmp29, label %for.cond31.preheader, label %for.inc61
+ %exitcond48 = icmp ne i64 %inc59, %n
+ br i1 %exitcond48, label %for.cond31.preheader, label %for.inc61.loopexit
-for.inc61: ; preds = %for.inc58, %for.cond28.preheader
- %B.addr.10.lcssa = phi i64* [ %B.addr.910, %for.cond28.preheader ], [ %B.addr.11.lcssa, %for.inc58 ]
+for.inc61.loopexit: ; preds = %for.inc58
+ %B.addr.11.lcssa.lcssa = phi i64* [ %B.addr.11.lcssa, %for.inc58 ]
+ br label %for.inc61
+
+for.inc61: ; preds = %for.inc61.loopexit, %for.cond28.preheader
+ %B.addr.10.lcssa = phi i64* [ %B.addr.910, %for.cond28.preheader ], [ %B.addr.11.lcssa.lcssa, %for.inc61.loopexit ]
%inc62 = add nsw i64 %s.09, 1
- %cmp26 = icmp slt i64 %inc62, %n
- br i1 %cmp26, label %for.cond28.preheader, label %for.inc64
+ %exitcond49 = icmp ne i64 %inc62, %n
+ br i1 %exitcond49, label %for.cond28.preheader, label %for.inc64.loopexit
+
+for.inc64.loopexit: ; preds = %for.inc61
+ %B.addr.10.lcssa.lcssa = phi i64* [ %B.addr.10.lcssa, %for.inc61 ]
+ br label %for.inc64
-for.inc64: ; preds = %for.inc61, %for.cond25.preheader
- %B.addr.9.lcssa = phi i64* [ %B.addr.814, %for.cond25.preheader ], [ %B.addr.10.lcssa, %for.inc61 ]
+for.inc64: ; preds = %for.inc64.loopexit, %for.cond25.preheader
+ %B.addr.9.lcssa = phi i64* [ %B.addr.814, %for.cond25.preheader ], [ %B.addr.10.lcssa.lcssa, %for.inc64.loopexit ]
%inc65 = add nsw i64 %r.013, 1
- %cmp23 = icmp slt i64 %inc65, %n
- br i1 %cmp23, label %for.cond25.preheader, label %for.inc67
+ %exitcond50 = icmp ne i64 %inc65, %n
+ br i1 %exitcond50, label %for.cond25.preheader, label %for.inc67.loopexit
-for.inc67: ; preds = %for.inc64, %for.cond22.preheader
- %B.addr.8.lcssa = phi i64* [ %B.addr.718, %for.cond22.preheader ], [ %B.addr.9.lcssa, %for.inc64 ]
+for.inc67.loopexit: ; preds = %for.inc64
+ %B.addr.9.lcssa.lcssa = phi i64* [ %B.addr.9.lcssa, %for.inc64 ]
+ br label %for.inc67
+
+for.inc67: ; preds = %for.inc67.loopexit, %for.cond22.preheader
+ %B.addr.8.lcssa = phi i64* [ %B.addr.718, %for.cond22.preheader ], [ %B.addr.9.lcssa.lcssa, %for.inc67.loopexit ]
%inc68 = add nsw i64 %q.017, 1
- %cmp20 = icmp slt i64 %inc68, %n
- br i1 %cmp20, label %for.cond22.preheader, label %for.inc70
+ %exitcond51 = icmp ne i64 %inc68, %n
+ br i1 %exitcond51, label %for.cond22.preheader, label %for.inc70.loopexit
+
+for.inc70.loopexit: ; preds = %for.inc67
+ %B.addr.8.lcssa.lcssa = phi i64* [ %B.addr.8.lcssa, %for.inc67 ]
+ br label %for.inc70
-for.inc70: ; preds = %for.inc67, %for.cond19.preheader
- %B.addr.7.lcssa = phi i64* [ %B.addr.622, %for.cond19.preheader ], [ %B.addr.8.lcssa, %for.inc67 ]
+for.inc70: ; preds = %for.inc70.loopexit, %for.cond19.preheader
+ %B.addr.7.lcssa = phi i64* [ %B.addr.622, %for.cond19.preheader ], [ %B.addr.8.lcssa.lcssa, %for.inc70.loopexit ]
%inc71 = add nsw i64 %p.021, 1
- %cmp17 = icmp slt i64 %inc71, %n
- br i1 %cmp17, label %for.cond19.preheader, label %for.inc73
+ %exitcond52 = icmp ne i64 %inc71, %n
+ br i1 %exitcond52, label %for.cond19.preheader, label %for.inc73.loopexit
-for.inc73: ; preds = %for.inc70, %for.cond16.preheader
- %B.addr.6.lcssa = phi i64* [ %B.addr.526, %for.cond16.preheader ], [ %B.addr.7.lcssa, %for.inc70 ]
+for.inc73.loopexit: ; preds = %for.inc70
+ %B.addr.7.lcssa.lcssa = phi i64* [ %B.addr.7.lcssa, %for.inc70 ]
+ br label %for.inc73
+
+for.inc73: ; preds = %for.inc73.loopexit, %for.cond16.preheader
+ %B.addr.6.lcssa = phi i64* [ %B.addr.526, %for.cond16.preheader ], [ %B.addr.7.lcssa.lcssa, %for.inc73.loopexit ]
%inc74 = add nsw i64 %o.025, 1
- %cmp14 = icmp slt i64 %inc74, %n
- br i1 %cmp14, label %for.cond16.preheader, label %for.inc76
+ %exitcond53 = icmp ne i64 %inc74, %n
+ br i1 %exitcond53, label %for.cond16.preheader, label %for.inc76.loopexit
+
+for.inc76.loopexit: ; preds = %for.inc73
+ %B.addr.6.lcssa.lcssa = phi i64* [ %B.addr.6.lcssa, %for.inc73 ]
+ br label %for.inc76
-for.inc76: ; preds = %for.inc73, %for.cond13.preheader
- %B.addr.5.lcssa = phi i64* [ %B.addr.430, %for.cond13.preheader ], [ %B.addr.6.lcssa, %for.inc73 ]
+for.inc76: ; preds = %for.inc76.loopexit, %for.cond13.preheader
+ %B.addr.5.lcssa = phi i64* [ %B.addr.430, %for.cond13.preheader ], [ %B.addr.6.lcssa.lcssa, %for.inc76.loopexit ]
%inc77 = add nsw i64 %m.029, 1
- %cmp11 = icmp slt i64 %inc77, %n
- br i1 %cmp11, label %for.cond13.preheader, label %for.inc79
+ %exitcond54 = icmp ne i64 %inc77, %n
+ br i1 %exitcond54, label %for.cond13.preheader, label %for.inc79.loopexit
+
+for.inc79.loopexit: ; preds = %for.inc76
+ %B.addr.5.lcssa.lcssa = phi i64* [ %B.addr.5.lcssa, %for.inc76 ]
+ br label %for.inc79
-for.inc79: ; preds = %for.inc76, %for.cond10.preheader
- %B.addr.4.lcssa = phi i64* [ %B.addr.334, %for.cond10.preheader ], [ %B.addr.5.lcssa, %for.inc76 ]
+for.inc79: ; preds = %for.inc79.loopexit, %for.cond10.preheader
+ %B.addr.4.lcssa = phi i64* [ %B.addr.334, %for.cond10.preheader ], [ %B.addr.5.lcssa.lcssa, %for.inc79.loopexit ]
%inc80 = add nsw i64 %l.033, 1
- %cmp8 = icmp slt i64 %inc80, %n
- br i1 %cmp8, label %for.cond10.preheader, label %for.inc82
+ %exitcond55 = icmp ne i64 %inc80, %n
+ br i1 %exitcond55, label %for.cond10.preheader, label %for.inc82.loopexit
-for.inc82: ; preds = %for.inc79, %for.cond7.preheader
- %B.addr.3.lcssa = phi i64* [ %B.addr.238, %for.cond7.preheader ], [ %B.addr.4.lcssa, %for.inc79 ]
+for.inc82.loopexit: ; preds = %for.inc79
+ %B.addr.4.lcssa.lcssa = phi i64* [ %B.addr.4.lcssa, %for.inc79 ]
+ br label %for.inc82
+
+for.inc82: ; preds = %for.inc82.loopexit, %for.cond7.preheader
+ %B.addr.3.lcssa = phi i64* [ %B.addr.238, %for.cond7.preheader ], [ %B.addr.4.lcssa.lcssa, %for.inc82.loopexit ]
%inc83 = add nsw i64 %k.037, 1
- %cmp5 = icmp slt i64 %inc83, %n
- br i1 %cmp5, label %for.cond7.preheader, label %for.inc85
+ %exitcond56 = icmp ne i64 %inc83, %n
+ br i1 %exitcond56, label %for.cond7.preheader, label %for.inc85.loopexit
+
+for.inc85.loopexit: ; preds = %for.inc82
+ %B.addr.3.lcssa.lcssa = phi i64* [ %B.addr.3.lcssa, %for.inc82 ]
+ br label %for.inc85
-for.inc85: ; preds = %for.inc82, %for.cond4.preheader
- %B.addr.2.lcssa = phi i64* [ %B.addr.142, %for.cond4.preheader ], [ %B.addr.3.lcssa, %for.inc82 ]
+for.inc85: ; preds = %for.inc85.loopexit, %for.cond4.preheader
+ %B.addr.2.lcssa = phi i64* [ %B.addr.142, %for.cond4.preheader ], [ %B.addr.3.lcssa.lcssa, %for.inc85.loopexit ]
%inc86 = add nsw i64 %j.041, 1
- %cmp2 = icmp slt i64 %inc86, %n
- br i1 %cmp2, label %for.cond4.preheader, label %for.inc88
+ %exitcond57 = icmp ne i64 %inc86, %n
+ br i1 %exitcond57, label %for.cond4.preheader, label %for.inc88.loopexit
-for.inc88: ; preds = %for.inc85, %for.cond1.preheader
- %B.addr.1.lcssa = phi i64* [ %B.addr.046, %for.cond1.preheader ], [ %B.addr.2.lcssa, %for.inc85 ]
+for.inc88.loopexit: ; preds = %for.inc85
+ %B.addr.2.lcssa.lcssa = phi i64* [ %B.addr.2.lcssa, %for.inc85 ]
+ br label %for.inc88
+
+for.inc88: ; preds = %for.inc88.loopexit, %for.cond1.preheader
+ %B.addr.1.lcssa = phi i64* [ %B.addr.046, %for.cond1.preheader ], [ %B.addr.2.lcssa.lcssa, %for.inc88.loopexit ]
%inc89 = add nsw i64 %i.045, 1
- %cmp = icmp slt i64 %inc89, %n
- br i1 %cmp, label %for.cond1.preheader, label %for.end90
+ %exitcond58 = icmp ne i64 %inc89, %n
+ br i1 %exitcond58, label %for.cond1.preheader, label %for.end90.loopexit
+
+for.end90.loopexit: ; preds = %for.inc88
+ br label %for.end90
-for.end90: ; preds = %for.inc88, %entry
+for.end90: ; preds = %for.end90.loopexit, %entry
ret void
}
-;; cleanup around chars, shorts, ints
-;;void p4(int *A, int *B, long int n)
-;; for (char i = 0; i < n; i++)
-;; A[i + 2] = ...
-;; ... = A[i];
+;;void p4(int *A, int *B, long int n) {
+;; for (char i = 0; i < n; i++) {
+;; A[i + 2] = i;
+;; *B++ = A[i];
define void @p4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp sgt i64 %n, 0
- br i1 %cmp1, label %for.body, label %for.end
+ br i1 %cmp1, label %for.body.preheader, label %for.end
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i8 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+; CHECK: da analyze - output [*]!
+; CHECK: da analyze - flow [*|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i8 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv2 = sext i8 %i.03 to i32
%conv3 = sext i8 %i.03 to i64
%add = add i64 %conv3, 2
@@ -312,32 +446,44 @@ for.body: ; preds = %for.body, %entry
%idxprom4 = sext i8 %i.03 to i64
%arrayidx5 = getelementptr inbounds i32* %A, i64 %idxprom4
%0 = load i32* %arrayidx5, align 4
-; CHECK: da analyze - flow [*|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i8 %i.03, 1
%conv = sext i8 %inc to i64
%cmp = icmp slt i64 %conv, %n
- br i1 %cmp, label %for.body, label %for.end
+ br i1 %cmp, label %for.body, label %for.end.loopexit
-for.end: ; preds = %for.body, %entry
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
+
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;;void p5(int *A, int *B, long int n)
-;; for (short i = 0; i < n; i++)
-;; A[i + 2] = ...
-;; ... = A[i];
+;;void p5(int *A, int *B, long int n) {
+;; for (short i = 0; i < n; i++) {
+;; A[i + 2] = i;
+;; *B++ = A[i];
define void @p5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp sgt i64 %n, 0
- br i1 %cmp1, label %for.body, label %for.end
+ br i1 %cmp1, label %for.body.preheader, label %for.end
+
+; CHECK: da analyze - output [*]!
+; CHECK: da analyze - flow [*|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i16 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i16 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv2 = sext i16 %i.03 to i32
%conv3 = sext i16 %i.03 to i64
%add = add i64 %conv3, 2
@@ -346,124 +492,208 @@ for.body: ; preds = %for.body, %entry
%idxprom4 = sext i16 %i.03 to i64
%arrayidx5 = getelementptr inbounds i32* %A, i64 %idxprom4
%0 = load i32* %arrayidx5, align 4
-; CHECK: da analyze - flow [*|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i16 %i.03, 1
%conv = sext i16 %inc to i64
%cmp = icmp slt i64 %conv, %n
- br i1 %cmp, label %for.body, label %for.end
+ br i1 %cmp, label %for.body, label %for.end.loopexit
-for.end: ; preds = %for.body, %entry
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
+
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;;void p6(int *A, int *B, long int n)
-;; for (int i = 0; i < n; i++)
-;; A[i + 2] = ...
-;; ... = A[i];
+;;void p6(int *A, int *B, long int n) {
+;; for (int i = 0; i < n; i++) {
+;; A[i + 2] = i;
+;; *B++ = A[i];
define void @p6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp sgt i64 %n, 0
- br i1 %cmp1, label %for.body, label %for.end
+ br i1 %cmp1, label %for.body.preheader, label %for.end
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
- %add = add nsw i32 %i.03, 2
- %idxprom = sext i32 %add to i64
- %arrayidx = getelementptr inbounds i32* %A, i64 %idxprom
- store i32 %i.03, i32* %arrayidx, align 4
- %idxprom2 = sext i32 %i.03 to i64
- %arrayidx3 = getelementptr inbounds i32* %A, i64 %idxprom2
- %0 = load i32* %arrayidx3, align 4
+; CHECK: da analyze - none!
; CHECK: da analyze - consistent flow [2]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
+ %0 = add nsw i64 %indvars.iv, 2
+ %arrayidx = getelementptr inbounds i32* %A, i64 %0
+ %1 = trunc i64 %indvars.iv to i32
+ store i32 %1, i32* %arrayidx, align 4
+ %arrayidx3 = getelementptr inbounds i32* %A, i64 %indvars.iv
+ %2 = load i32* %arrayidx3, align 4
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
- store i32 %0, i32* %B.addr.02, align 4
- %inc = add nsw i32 %i.03, 1
- %conv = sext i32 %inc to i64
- %cmp = icmp slt i64 %conv, %n
- br i1 %cmp, label %for.body, label %for.end
+ store i32 %2, i32* %B.addr.02, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %exitcond = icmp ne i64 %indvars.iv.next, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
-for.end: ; preds = %for.body, %entry
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
+
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;;void p7(unsigned *A, unsigned *B, char n)
-;; A[n] = ...
-;; ... = A[n + 1];
+;;void p7(unsigned *A, unsigned *B, char n) {
+;; A[n] = 0;
+;; *B = A[n + 1];
define void @p7(i32* %A, i32* %B, i8 signext %n) nounwind uwtable ssp {
entry:
%idxprom = sext i8 %n to i64
%arrayidx = getelementptr inbounds i32* %A, i64 %idxprom
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
store i32 0, i32* %arrayidx, align 4
%conv = sext i8 %n to i64
%add = add i64 %conv, 1
%arrayidx2 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - none!
store i32 %0, i32* %B, align 4
ret void
}
-
-;;void p8(unsigned *A, unsigned *B, short n)
-;; A[n] = ...
-;; ... = A[n + 1];
+;;void p8(unsigned *A, unsigned *B, short n) {
+;; A[n] = 0;
+;; *B = A[n + 1];
define void @p8(i32* %A, i32* %B, i16 signext %n) nounwind uwtable ssp {
entry:
%idxprom = sext i16 %n to i64
%arrayidx = getelementptr inbounds i32* %A, i64 %idxprom
store i32 0, i32* %arrayidx, align 4
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
%conv = sext i16 %n to i64
%add = add i64 %conv, 1
%arrayidx2 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - none!
store i32 %0, i32* %B, align 4
ret void
}
-;;void p9(unsigned *A, unsigned *B, int n)
-;; A[n] = ...
-;; ... = A[n + 1];
+;;void p9(unsigned *A, unsigned *B, int n) {
+;; A[n] = 0;
+;; *B = A[n + 1];
define void @p9(i32* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds i32* %A, i64 %idxprom
store i32 0, i32* %arrayidx, align 4
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
%add = add nsw i32 %n, 1
%idxprom1 = sext i32 %add to i64
%arrayidx2 = getelementptr inbounds i32* %A, i64 %idxprom1
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - none!
store i32 %0, i32* %B, align 4
ret void
}
-;;void p10(unsigned *A, unsigned *B, unsigned n)
-;; A[n] = ...
-;; ... = A[n + 1];
+;;void p10(unsigned *A, unsigned *B, unsigned n) {
+;; A[n] = 0;
+;; *B = A[n + 1];
define void @p10(i32* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
%idxprom = zext i32 %n to i64
%arrayidx = getelementptr inbounds i32* %A, i64 %idxprom
store i32 0, i32* %arrayidx, align 4
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
%add = add i32 %n, 1
%idxprom1 = zext i32 %add to i64
%arrayidx2 = getelementptr inbounds i32* %A, i64 %idxprom1
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - none!
store i32 %0, i32* %B, align 4
ret void
}
+
+
+;;typedef struct { int v; } S;
+;;
+;;void f(S *s, unsigned size) {
+;; S *i = s, *e = s + size - 1;
+;; while (i != e) {
+;; *i = *(i + 1);
+;; ++i;
+
+%struct.S = type { i32 }
+
+define void @f(%struct.S* %s, i32 %size) nounwind uwtable ssp {
+entry:
+ %idx.ext = zext i32 %size to i64
+ %add.ptr.sum = add i64 %idx.ext, -1
+ %add.ptr1 = getelementptr inbounds %struct.S* %s, i64 %add.ptr.sum
+ %cmp1 = icmp eq i64 %add.ptr.sum, 0
+ br i1 %cmp1, label %while.end, label %while.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - consistent anti [1]!
+; CHECK: da analyze - none!
+
+while.body.preheader: ; preds = %entry
+ br label %while.body
+
+while.body: ; preds = %while.body.preheader, %while.body
+ %i.02 = phi %struct.S* [ %incdec.ptr, %while.body ], [ %s, %while.body.preheader ]
+ %0 = getelementptr inbounds %struct.S* %i.02, i64 1, i32 0
+ %1 = load i32* %0, align 4
+ %2 = getelementptr inbounds %struct.S* %i.02, i64 0, i32 0
+ store i32 %1, i32* %2, align 4
+ %incdec.ptr = getelementptr inbounds %struct.S* %i.02, i64 1
+ %cmp = icmp eq %struct.S* %incdec.ptr, %add.ptr1
+ br i1 %cmp, label %while.end.loopexit, label %while.body
+
+while.end.loopexit: ; preds = %while.body
+ br label %while.end
+
+while.end: ; preds = %while.end.loopexit, %entry
+ ret void
+}
+
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
diff --git a/test/Analysis/DependenceAnalysis/Propagating.ll b/test/Analysis/DependenceAnalysis/Propagating.ll
index 076348c68dc8..f9034ede9d0b 100644
--- a/test/Analysis/DependenceAnalysis/Propagating.ll
+++ b/test/Analysis/DependenceAnalysis/Propagating.ll
@@ -6,7 +6,7 @@ target triple = "x86_64-apple-macosx10.6.0"
;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++)
+;; for (long int j = 0; j < 100; j++) {
;; A[i + 1][i + j] = i;
;; *B++ = A[i][i + j];
@@ -14,12 +14,19 @@ define void @prop0([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc9, %entry
- %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc9 ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - consistent flow [1 -1]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc9
+ %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc9 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc10, %for.inc9 ]
br label %for.body3
-for.body3: ; preds = %for.body3, %for.cond1.preheader
+for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
%conv = trunc i64 %i.03 to i32
@@ -30,17 +37,17 @@ for.body3: ; preds = %for.body3, %for.con
%add6 = add nsw i64 %i.03, %j.02
%arrayidx8 = getelementptr inbounds [100 x i32]* %A, i64 %i.03, i64 %add6
%0 = load i32* %arrayidx8, align 4
-; CHECK: da analyze - consistent flow [1 -1]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc, 100
- br i1 %cmp2, label %for.body3, label %for.inc9
+ %exitcond = icmp ne i64 %inc, 100
+ br i1 %exitcond, label %for.body3, label %for.inc9
for.inc9: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.04, i64 100
%inc10 = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc10, 100
- br i1 %cmp, label %for.cond1.preheader, label %for.end11
+ %exitcond5 = icmp ne i64 %inc10, 100
+ br i1 %exitcond5, label %for.cond1.preheader, label %for.end11
for.end11: ; preds = %for.inc9
ret void
@@ -49,25 +56,32 @@ for.end11: ; preds = %for.inc9
;; for (long int i = 0; i < 100; i++)
;; for (long int j = 0; j < 100; j++)
-;; for (long int k = 0; k < 100; k++)
-;; A[j - i][i + 1][j + k] = ...
-;; ... = A[j - i][i][j + k];
+;; for (long int k = 0; k < 100; k++) {
+;; A[j - i][i + 1][j + k] = i;
+;; *B++ = A[j - i][i][j + k];
define void @prop1([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc18, %entry
- %B.addr.06 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc18 ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - consistent flow [1 1 -1]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc18
+ %B.addr.06 = phi i32* [ %B, %entry ], [ %scevgep7, %for.inc18 ]
%i.05 = phi i64 [ 0, %entry ], [ %inc19, %for.inc18 ]
br label %for.cond4.preheader
-for.cond4.preheader: ; preds = %for.inc15, %for.cond1.preheader
- %B.addr.14 = phi i32* [ %B.addr.06, %for.cond1.preheader ], [ %incdec.ptr, %for.inc15 ]
+for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc15
+ %B.addr.14 = phi i32* [ %B.addr.06, %for.cond1.preheader ], [ %scevgep, %for.inc15 ]
%j.03 = phi i64 [ 0, %for.cond1.preheader ], [ %inc16, %for.inc15 ]
br label %for.body6
-for.body6: ; preds = %for.body6, %for.cond4.preheader
+for.body6: ; preds = %for.cond4.preheader, %for.body6
%k.02 = phi i64 [ 0, %for.cond4.preheader ], [ %inc, %for.body6 ]
%B.addr.21 = phi i32* [ %B.addr.14, %for.cond4.preheader ], [ %incdec.ptr, %for.body6 ]
%conv = trunc i64 %i.05 to i32
@@ -80,22 +94,23 @@ for.body6: ; preds = %for.body6, %for.con
%sub11 = sub nsw i64 %j.03, %i.05
%arrayidx14 = getelementptr inbounds [100 x [100 x i32]]* %A, i64 %sub11, i64 %i.05, i64 %add10
%0 = load i32* %arrayidx14, align 4
-; CHECK: da analyze - consistent flow [1 1 -1]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.21, i64 1
store i32 %0, i32* %B.addr.21, align 4
%inc = add nsw i64 %k.02, 1
- %cmp5 = icmp slt i64 %inc, 100
- br i1 %cmp5, label %for.body6, label %for.inc15
+ %exitcond = icmp ne i64 %inc, 100
+ br i1 %exitcond, label %for.body6, label %for.inc15
for.inc15: ; preds = %for.body6
+ %scevgep = getelementptr i32* %B.addr.14, i64 100
%inc16 = add nsw i64 %j.03, 1
- %cmp2 = icmp slt i64 %inc16, 100
- br i1 %cmp2, label %for.cond4.preheader, label %for.inc18
+ %exitcond8 = icmp ne i64 %inc16, 100
+ br i1 %exitcond8, label %for.cond4.preheader, label %for.inc18
for.inc18: ; preds = %for.inc15
+ %scevgep7 = getelementptr i32* %B.addr.06, i64 10000
%inc19 = add nsw i64 %i.05, 1
- %cmp = icmp slt i64 %inc19, 100
- br i1 %cmp, label %for.cond1.preheader, label %for.end20
+ %exitcond9 = icmp ne i64 %inc19, 100
+ br i1 %exitcond9, label %for.cond1.preheader, label %for.end20
for.end20: ; preds = %for.inc18
ret void
@@ -103,20 +118,27 @@ for.end20: ; preds = %for.inc18
;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++)
-;; A[i - 1][2*i] = ...
-;; ... = A[i][i + j + 110];
+;; for (long int j = 0; j < 100; j++) {
+;; A[i - 1][2*i] = i;
+;; *B++ = A[i][i + j + 110];
define void @prop2([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc8, %entry
- %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc8 ]
+; CHECK: da analyze - consistent output [0 S]!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc8
+ %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc8 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc9, %for.inc8 ]
br label %for.body3
-for.body3: ; preds = %for.body3, %for.cond1.preheader
+for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
%conv = trunc i64 %i.03 to i32
@@ -128,17 +150,17 @@ for.body3: ; preds = %for.body3, %for.con
%add5 = add nsw i64 %add, 110
%arrayidx7 = getelementptr inbounds [100 x i32]* %A, i64 %i.03, i64 %add5
%0 = load i32* %arrayidx7, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc, 100
- br i1 %cmp2, label %for.body3, label %for.inc8
+ %exitcond = icmp ne i64 %inc, 100
+ br i1 %exitcond, label %for.body3, label %for.inc8
for.inc8: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.04, i64 100
%inc9 = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc9, 100
- br i1 %cmp, label %for.cond1.preheader, label %for.end10
+ %exitcond5 = icmp ne i64 %inc9, 100
+ br i1 %exitcond5, label %for.cond1.preheader, label %for.end10
for.end10: ; preds = %for.inc8
ret void
@@ -146,20 +168,27 @@ for.end10: ; preds = %for.inc8
;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++)
-;; A[i][2*j + i] = ...
-;; ... = A[i][2*j - i + 5];
+;; for (long int j = 0; j < 100; j++) {
+;; A[i][2*j + i] = i;
+;; *B++ = A[i][2*j - i + 5];
define void @prop3([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc9, %entry
- %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc9 ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc9
+ %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc9 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc10, %for.inc9 ]
br label %for.body3
-for.body3: ; preds = %for.body3, %for.cond1.preheader
+for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
%conv = trunc i64 %i.03 to i32
@@ -172,39 +201,45 @@ for.body3: ; preds = %for.body3, %for.con
%add6 = add nsw i64 %sub, 5
%arrayidx8 = getelementptr inbounds [100 x i32]* %A, i64 %i.03, i64 %add6
%0 = load i32* %arrayidx8, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc, 100
- br i1 %cmp2, label %for.body3, label %for.inc9
+ %exitcond = icmp ne i64 %inc, 100
+ br i1 %exitcond, label %for.body3, label %for.inc9
for.inc9: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.04, i64 100
%inc10 = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc10, 100
- br i1 %cmp, label %for.cond1.preheader, label %for.end11
+ %exitcond5 = icmp ne i64 %inc10, 100
+ br i1 %exitcond5, label %for.cond1.preheader, label %for.end11
for.end11: ; preds = %for.inc9
ret void
}
-;; propagate Distance
;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++)
-;; A[i + 2][2*i + j + 1] = ...
-;; ... = A[i][2*i + j];
+;; for (long int j = 0; j < 100; j++) {
+;; A[i + 2][2*i + j + 1] = i;
+;; *B++ = A[i][2*i + j];
define void @prop4([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc11, %entry
- %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc11 ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - consistent flow [2 -3]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc11
+ %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc11 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc12, %for.inc11 ]
br label %for.body3
-for.body3: ; preds = %for.body3, %for.cond1.preheader
+for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
%conv = trunc i64 %i.03 to i32
@@ -218,39 +253,46 @@ for.body3: ; preds = %for.body3, %for.con
%add8 = add nsw i64 %mul7, %j.02
%arrayidx10 = getelementptr inbounds [100 x i32]* %A, i64 %i.03, i64 %add8
%0 = load i32* %arrayidx10, align 4
-; CHECK: da analyze - consistent flow [2 -3]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc, 100
- br i1 %cmp2, label %for.body3, label %for.inc11
+ %exitcond = icmp ne i64 %inc, 100
+ br i1 %exitcond, label %for.body3, label %for.inc11
for.inc11: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.04, i64 100
%inc12 = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc12, 100
- br i1 %cmp, label %for.cond1.preheader, label %for.end13
+ %exitcond5 = icmp ne i64 %inc12, 100
+ br i1 %exitcond5, label %for.cond1.preheader, label %for.end13
for.end13: ; preds = %for.inc11
ret void
}
-;; propagate Point
;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++)
-;; A[3*i - 18][22 - i][2*i + j] = ...
-;; ... = A[i][i][3*i + j];
+;; for (long int j = 0; j < 100; j++) {
+;; A[3*i - 18][22 - i][2*i + j] = i;
+;; *B++ = A[i][i][3*i + j];
define void @prop5([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc13, %entry
- %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc13 ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [< -16] splitable!
+; CHECK: da analyze - split level = 1, iteration = 11!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc13
+ %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc13 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc14, %for.inc13 ]
br label %for.body3
-for.body3: ; preds = %for.body3, %for.cond1.preheader
+for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
%conv = trunc i64 %i.03 to i32
@@ -265,40 +307,45 @@ for.body3: ; preds = %for.body3, %for.con
%add9 = add nsw i64 %mul8, %j.02
%arrayidx12 = getelementptr inbounds [100 x [100 x i32]]* %A, i64 %i.03, i64 %i.03, i64 %add9
%0 = load i32* %arrayidx12, align 4
-; CHECK: da analyze - flow [< -16] splitable!
-; CHECK: da analyze - split level = 1, iteration = 11!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc, 100
- br i1 %cmp2, label %for.body3, label %for.inc13
+ %exitcond = icmp ne i64 %inc, 100
+ br i1 %exitcond, label %for.body3, label %for.inc13
for.inc13: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.04, i64 100
%inc14 = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc14, 100
- br i1 %cmp, label %for.cond1.preheader, label %for.end15
+ %exitcond5 = icmp ne i64 %inc14, 100
+ br i1 %exitcond5, label %for.cond1.preheader, label %for.end15
for.end15: ; preds = %for.inc13
ret void
}
-;; propagate Line
;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++)
-;; A[i + 1][4*i + j + 2] = ...
-;; ... = A[2*i][8*i + j];
+;; for (long int j = 0; j < 100; j++) {
+;; A[i + 1][4*i + j + 2] = i;
+;; *B++ = A[2*i][8*i + j];
define void @prop6([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc12, %entry
- %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc12 ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [=> -2]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc12
+ %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc12 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc13, %for.inc12 ]
br label %for.body3
-for.body3: ; preds = %for.body3, %for.cond1.preheader
+for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
%conv = trunc i64 %i.03 to i32
@@ -313,17 +360,17 @@ for.body3: ; preds = %for.body3, %for.con
%mul9 = shl nsw i64 %i.03, 1
%arrayidx11 = getelementptr inbounds [100 x i32]* %A, i64 %mul9, i64 %add8
%0 = load i32* %arrayidx11, align 4
-; CHECK: da analyze - flow [=> -2]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc, 100
- br i1 %cmp2, label %for.body3, label %for.inc12
+ %exitcond = icmp ne i64 %inc, 100
+ br i1 %exitcond, label %for.body3, label %for.inc12
for.inc12: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.04, i64 100
%inc13 = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc13, 100
- br i1 %cmp, label %for.cond1.preheader, label %for.end14
+ %exitcond5 = icmp ne i64 %inc13, 100
+ br i1 %exitcond5, label %for.cond1.preheader, label %for.end14
for.end14: ; preds = %for.inc12
ret void
@@ -331,20 +378,28 @@ for.end14: ; preds = %for.inc12
;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++)
-;; A[2*i + 4][-5*i + j + 2] = ...
-;; ... = A[-2*i + 20][5*i + j];
+;; for (long int j = 0; j < 100; j++) {
+;; A[2*i + 4][-5*i + j + 2] = i;
+;; *B++ = A[-2*i + 20][5*i + j];
define void @prop7([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc14, %entry
- %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc14 ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [* -38] splitable!
+; CHECK: da analyze - split level = 1, iteration = 4!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc14
+ %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc14 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc15, %for.inc14 ]
br label %for.body3
-for.body3: ; preds = %for.body3, %for.cond1.preheader
+for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
%conv = trunc i64 %i.03 to i32
@@ -361,18 +416,17 @@ for.body3: ; preds = %for.body3, %for.con
%add11 = add nsw i64 %mul10, 20
%arrayidx13 = getelementptr inbounds [100 x i32]* %A, i64 %add11, i64 %add9
%0 = load i32* %arrayidx13, align 4
-; CHECK: da analyze - flow [* -38] splitable!
-; CHECK: da analyze - split level = 1, iteration = 4!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc, 100
- br i1 %cmp2, label %for.body3, label %for.inc14
+ %exitcond = icmp ne i64 %inc, 100
+ br i1 %exitcond, label %for.body3, label %for.inc14
for.inc14: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.04, i64 100
%inc15 = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc15, 100
- br i1 %cmp, label %for.cond1.preheader, label %for.end16
+ %exitcond5 = icmp ne i64 %inc15, 100
+ br i1 %exitcond5, label %for.cond1.preheader, label %for.end16
for.end16: ; preds = %for.inc14
ret void
@@ -380,20 +434,27 @@ for.end16: ; preds = %for.inc14
;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++)
-;; A[4][j + 2] = ...
-;; ... = A[-2*i + 4][5*i + j];
+;; for (long int j = 0; j < 100; j++) {
+;; A[4][j + 2] = i;
+;; *B++ = A[-2*i + 4][5*i + j];
define void @prop8([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc10, %entry
- %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc10 ]
+; CHECK: da analyze - consistent output [S 0]!
+; CHECK: da analyze - flow [p<= 2]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc10
+ %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc10 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc11, %for.inc10 ]
br label %for.body3
-for.body3: ; preds = %for.body3, %for.cond1.preheader
+for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
%conv = trunc i64 %i.03 to i32
@@ -406,17 +467,17 @@ for.body3: ; preds = %for.body3, %for.con
%add7 = add nsw i64 %mul6, 4
%arrayidx9 = getelementptr inbounds [100 x i32]* %A, i64 %add7, i64 %add5
%0 = load i32* %arrayidx9, align 4
-; CHECK: da analyze - flow [p<= 2]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc, 100
- br i1 %cmp2, label %for.body3, label %for.inc10
+ %exitcond = icmp ne i64 %inc, 100
+ br i1 %exitcond, label %for.body3, label %for.inc10
for.inc10: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.04, i64 100
%inc11 = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc11, 100
- br i1 %cmp, label %for.cond1.preheader, label %for.end12
+ %exitcond5 = icmp ne i64 %inc11, 100
+ br i1 %exitcond5, label %for.cond1.preheader, label %for.end12
for.end12: ; preds = %for.inc10
ret void
@@ -424,20 +485,27 @@ for.end12: ; preds = %for.inc10
;; for (long int i = 0; i < 100; i++)
-;; for (long int j = 0; j < 100; j++)
-;; A[2*i + 4][5*i + j + 2] = ...
-;; ... = A[4][j];
+;; for (long int j = 0; j < 100; j++) {
+;; A[2*i + 4][5*i + j + 2] = i;
+;; *B++ = A[4][j];
define void @prop9([100 x i32]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc10, %entry
- %B.addr.04 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc10 ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [p<= 2]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [S 0]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc10
+ %B.addr.04 = phi i32* [ %B, %entry ], [ %scevgep, %for.inc10 ]
%i.03 = phi i64 [ 0, %entry ], [ %inc11, %for.inc10 ]
br label %for.body3
-for.body3: ; preds = %for.body3, %for.cond1.preheader
+for.body3: ; preds = %for.cond1.preheader, %for.body3
%j.02 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.body3 ]
%B.addr.11 = phi i32* [ %B.addr.04, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
%conv = trunc i64 %i.03 to i32
@@ -450,17 +518,17 @@ for.body3: ; preds = %for.body3, %for.con
store i32 %conv, i32* %arrayidx7, align 4
%arrayidx9 = getelementptr inbounds [100 x i32]* %A, i64 4, i64 %j.02
%0 = load i32* %arrayidx9, align 4
-; CHECK: da analyze - flow [p<= 2]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.11, i64 1
store i32 %0, i32* %B.addr.11, align 4
%inc = add nsw i64 %j.02, 1
- %cmp2 = icmp slt i64 %inc, 100
- br i1 %cmp2, label %for.body3, label %for.inc10
+ %exitcond = icmp ne i64 %inc, 100
+ br i1 %exitcond, label %for.body3, label %for.inc10
for.inc10: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.04, i64 100
%inc11 = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc11, 100
- br i1 %cmp, label %for.cond1.preheader, label %for.end12
+ %exitcond5 = icmp ne i64 %inc11, 100
+ br i1 %exitcond5, label %for.cond1.preheader, label %for.end12
for.end12: ; preds = %for.inc10
ret void
diff --git a/test/Analysis/DependenceAnalysis/Separability.ll b/test/Analysis/DependenceAnalysis/Separability.ll
index d42d3cdb39e5..3dcaaec2ae85 100644
--- a/test/Analysis/DependenceAnalysis/Separability.ll
+++ b/test/Analysis/DependenceAnalysis/Separability.ll
@@ -8,30 +8,37 @@ target triple = "x86_64-apple-macosx10.6.0"
;; for (long int i = 0; i < 50; i++)
;; for (long int j = 0; j < 50; j++)
;; for (long int k = 0; k < 50; k++)
-;; for (long int l = 0; l < 50; l++)
-;; A[n][i][j + k] = ...
-;; ... = A[10][i + 10][2*j - l];
+;; for (long int l = 0; l < 50; l++) {
+;; A[n][i][j + k] = i;
+;; *B++ = A[10][i + 10][2*j - l];
define void @sep0([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc22, %entry
- %B.addr.08 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc22 ]
+; CHECK: da analyze - output [0 * * S]!
+; CHECK: da analyze - flow [-10 * * *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [0 * S *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc22
+ %B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc22 ]
%i.07 = phi i64 [ 0, %entry ], [ %inc23, %for.inc22 ]
br label %for.cond4.preheader
-for.cond4.preheader: ; preds = %for.inc19, %for.cond1.preheader
- %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %incdec.ptr, %for.inc19 ]
+for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc19
+ %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc19 ]
%j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc20, %for.inc19 ]
br label %for.cond7.preheader
-for.cond7.preheader: ; preds = %for.inc16, %for.cond4.preheader
- %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %incdec.ptr, %for.inc16 ]
+for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc16
+ %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc16 ]
%k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc17, %for.inc16 ]
br label %for.body9
-for.body9: ; preds = %for.body9, %for.cond7.preheader
+for.body9: ; preds = %for.cond7.preheader, %for.body9
%l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ]
%B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ]
%conv = trunc i64 %i.07 to i32
@@ -44,27 +51,29 @@ for.body9: ; preds = %for.body9, %for.con
%add12 = add nsw i64 %i.07, 10
%arrayidx15 = getelementptr inbounds [100 x [100 x i32]]* %A, i64 10, i64 %add12, i64 %sub
%0 = load i32* %arrayidx15, align 4
-; CHECK: da analyze - flow [-10 * * *]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.31, i64 1
store i32 %0, i32* %B.addr.31, align 4
%inc = add nsw i64 %l.02, 1
- %cmp8 = icmp slt i64 %inc, 50
- br i1 %cmp8, label %for.body9, label %for.inc16
+ %exitcond = icmp ne i64 %inc, 50
+ br i1 %exitcond, label %for.body9, label %for.inc16
for.inc16: ; preds = %for.body9
+ %scevgep = getelementptr i32* %B.addr.24, i64 50
%inc17 = add nsw i64 %k.03, 1
- %cmp5 = icmp slt i64 %inc17, 50
- br i1 %cmp5, label %for.cond7.preheader, label %for.inc19
+ %exitcond10 = icmp ne i64 %inc17, 50
+ br i1 %exitcond10, label %for.cond7.preheader, label %for.inc19
for.inc19: ; preds = %for.inc16
+ %scevgep9 = getelementptr i32* %B.addr.16, i64 2500
%inc20 = add nsw i64 %j.05, 1
- %cmp2 = icmp slt i64 %inc20, 50
- br i1 %cmp2, label %for.cond4.preheader, label %for.inc22
+ %exitcond12 = icmp ne i64 %inc20, 50
+ br i1 %exitcond12, label %for.cond4.preheader, label %for.inc22
for.inc22: ; preds = %for.inc19
+ %scevgep11 = getelementptr i32* %B.addr.08, i64 125000
%inc23 = add nsw i64 %i.07, 1
- %cmp = icmp slt i64 %inc23, 50
- br i1 %cmp, label %for.cond1.preheader, label %for.end24
+ %exitcond13 = icmp ne i64 %inc23, 50
+ br i1 %exitcond13, label %for.cond1.preheader, label %for.end24
for.end24: ; preds = %for.inc22
ret void
@@ -74,30 +83,37 @@ for.end24: ; preds = %for.inc22
;; for (long int i = 0; i < 50; i++)
;; for (long int j = 0; j < 50; j++)
;; for (long int k = 0; k < 50; k++)
-;; for (long int l = 0; l < 50; l++)
-;; A[i][i][j + k] = ...
-;; ... = A[10][i + 10][2*j - l];
+;; for (long int l = 0; l < 50; l++) {
+;; A[i][i][j + k] = i;
+;; *B++ = A[10][i + 10][2*j - l];
define void @sep1([100 x [100 x i32]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc22, %entry
- %B.addr.08 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc22 ]
+; CHECK: da analyze - output [0 * * S]!
+; CHECK: da analyze - flow [> * * *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [0 * S *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc22
+ %B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc22 ]
%i.07 = phi i64 [ 0, %entry ], [ %inc23, %for.inc22 ]
br label %for.cond4.preheader
-for.cond4.preheader: ; preds = %for.inc19, %for.cond1.preheader
- %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %incdec.ptr, %for.inc19 ]
+for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc19
+ %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc19 ]
%j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc20, %for.inc19 ]
br label %for.cond7.preheader
-for.cond7.preheader: ; preds = %for.inc16, %for.cond4.preheader
- %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %incdec.ptr, %for.inc16 ]
+for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc16
+ %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc16 ]
%k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc17, %for.inc16 ]
br label %for.body9
-for.body9: ; preds = %for.body9, %for.cond7.preheader
+for.body9: ; preds = %for.cond7.preheader, %for.body9
%l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ]
%B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ]
%conv = trunc i64 %i.07 to i32
@@ -109,27 +125,29 @@ for.body9: ; preds = %for.body9, %for.con
%add12 = add nsw i64 %i.07, 10
%arrayidx15 = getelementptr inbounds [100 x [100 x i32]]* %A, i64 10, i64 %add12, i64 %sub
%0 = load i32* %arrayidx15, align 4
-; CHECK: da analyze - flow [> * * *]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.31, i64 1
store i32 %0, i32* %B.addr.31, align 4
%inc = add nsw i64 %l.02, 1
- %cmp8 = icmp slt i64 %inc, 50
- br i1 %cmp8, label %for.body9, label %for.inc16
+ %exitcond = icmp ne i64 %inc, 50
+ br i1 %exitcond, label %for.body9, label %for.inc16
for.inc16: ; preds = %for.body9
+ %scevgep = getelementptr i32* %B.addr.24, i64 50
%inc17 = add nsw i64 %k.03, 1
- %cmp5 = icmp slt i64 %inc17, 50
- br i1 %cmp5, label %for.cond7.preheader, label %for.inc19
+ %exitcond10 = icmp ne i64 %inc17, 50
+ br i1 %exitcond10, label %for.cond7.preheader, label %for.inc19
for.inc19: ; preds = %for.inc16
+ %scevgep9 = getelementptr i32* %B.addr.16, i64 2500
%inc20 = add nsw i64 %j.05, 1
- %cmp2 = icmp slt i64 %inc20, 50
- br i1 %cmp2, label %for.cond4.preheader, label %for.inc22
+ %exitcond12 = icmp ne i64 %inc20, 50
+ br i1 %exitcond12, label %for.cond4.preheader, label %for.inc22
for.inc22: ; preds = %for.inc19
+ %scevgep11 = getelementptr i32* %B.addr.08, i64 125000
%inc23 = add nsw i64 %i.07, 1
- %cmp = icmp slt i64 %inc23, 50
- br i1 %cmp, label %for.cond1.preheader, label %for.end24
+ %exitcond13 = icmp ne i64 %inc23, 50
+ br i1 %exitcond13, label %for.cond1.preheader, label %for.end24
for.end24: ; preds = %for.inc22
ret void
@@ -139,30 +157,37 @@ for.end24: ; preds = %for.inc22
;; for (long int i = 0; i < 50; i++)
;; for (long int j = 0; j < 50; j++)
;; for (long int k = 0; k < 50; k++)
-;; for (long int l = 0; l < 50; l++)
-;; A[i][i][i + k][l] = ...
-;; ... = A[10][i + 10][j + k][l + 10];
+;; for (long int l = 0; l < 50; l++) {
+;; A[i][i][i + k][l] = i;
+;; *B++ = A[10][i + 10][j + k][l + 10];
define void @sep2([100 x [100 x [100 x i32]]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc26, %entry
- %B.addr.08 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc26 ]
+; CHECK: da analyze - consistent output [0 S 0 0]!
+; CHECK: da analyze - flow [> * * -10]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [0 * * 0]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc26
+ %B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc26 ]
%i.07 = phi i64 [ 0, %entry ], [ %inc27, %for.inc26 ]
br label %for.cond4.preheader
-for.cond4.preheader: ; preds = %for.inc23, %for.cond1.preheader
- %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %incdec.ptr, %for.inc23 ]
+for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc23
+ %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc23 ]
%j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc24, %for.inc23 ]
br label %for.cond7.preheader
-for.cond7.preheader: ; preds = %for.inc20, %for.cond4.preheader
- %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %incdec.ptr, %for.inc20 ]
+for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc20
+ %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc20 ]
%k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc21, %for.inc20 ]
br label %for.body9
-for.body9: ; preds = %for.body9, %for.cond7.preheader
+for.body9: ; preds = %for.cond7.preheader, %for.body9
%l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ]
%B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ]
%conv = trunc i64 %i.07 to i32
@@ -174,27 +199,29 @@ for.body9: ; preds = %for.body9, %for.con
%add15 = add nsw i64 %i.07, 10
%arrayidx19 = getelementptr inbounds [100 x [100 x [100 x i32]]]* %A, i64 10, i64 %add15, i64 %add14, i64 %add13
%0 = load i32* %arrayidx19, align 4
-; CHECK: da analyze - flow [> * * -10]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.31, i64 1
store i32 %0, i32* %B.addr.31, align 4
%inc = add nsw i64 %l.02, 1
- %cmp8 = icmp slt i64 %inc, 50
- br i1 %cmp8, label %for.body9, label %for.inc20
+ %exitcond = icmp ne i64 %inc, 50
+ br i1 %exitcond, label %for.body9, label %for.inc20
for.inc20: ; preds = %for.body9
+ %scevgep = getelementptr i32* %B.addr.24, i64 50
%inc21 = add nsw i64 %k.03, 1
- %cmp5 = icmp slt i64 %inc21, 50
- br i1 %cmp5, label %for.cond7.preheader, label %for.inc23
+ %exitcond10 = icmp ne i64 %inc21, 50
+ br i1 %exitcond10, label %for.cond7.preheader, label %for.inc23
for.inc23: ; preds = %for.inc20
+ %scevgep9 = getelementptr i32* %B.addr.16, i64 2500
%inc24 = add nsw i64 %j.05, 1
- %cmp2 = icmp slt i64 %inc24, 50
- br i1 %cmp2, label %for.cond4.preheader, label %for.inc26
+ %exitcond12 = icmp ne i64 %inc24, 50
+ br i1 %exitcond12, label %for.cond4.preheader, label %for.inc26
for.inc26: ; preds = %for.inc23
+ %scevgep11 = getelementptr i32* %B.addr.08, i64 125000
%inc27 = add nsw i64 %i.07, 1
- %cmp = icmp slt i64 %inc27, 50
- br i1 %cmp, label %for.cond1.preheader, label %for.end28
+ %exitcond13 = icmp ne i64 %inc27, 50
+ br i1 %exitcond13, label %for.cond1.preheader, label %for.end28
for.end28: ; preds = %for.inc26
ret void
@@ -204,30 +231,37 @@ for.end28: ; preds = %for.inc26
;; for (long int i = 0; i < 50; i++)
;; for (long int j = 0; j < 50; j++)
;; for (long int k = 0; k < 50; k++)
-;; for (long int l = 0; l < 50; l++)
-;; A[i][i][i + k][l + k] = ...
-;; ... = A[10][i + 10][j + k][l + 10];
+;; for (long int l = 0; l < 50; l++) {
+;; A[i][i][i + k][l + k] = i;
+;; *B++ = A[10][i + 10][j + k][l + 10];
define void @sep3([100 x [100 x [100 x i32]]]* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc27, %entry
- %B.addr.08 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.inc27 ]
+; CHECK: da analyze - consistent output [0 S 0 0]!
+; CHECK: da analyze - flow [> * * *]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - input [0 * * 0]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.cond1.preheader: ; preds = %entry, %for.inc27
+ %B.addr.08 = phi i32* [ %B, %entry ], [ %scevgep11, %for.inc27 ]
%i.07 = phi i64 [ 0, %entry ], [ %inc28, %for.inc27 ]
br label %for.cond4.preheader
-for.cond4.preheader: ; preds = %for.inc24, %for.cond1.preheader
- %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %incdec.ptr, %for.inc24 ]
+for.cond4.preheader: ; preds = %for.cond1.preheader, %for.inc24
+ %B.addr.16 = phi i32* [ %B.addr.08, %for.cond1.preheader ], [ %scevgep9, %for.inc24 ]
%j.05 = phi i64 [ 0, %for.cond1.preheader ], [ %inc25, %for.inc24 ]
br label %for.cond7.preheader
-for.cond7.preheader: ; preds = %for.inc21, %for.cond4.preheader
- %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %incdec.ptr, %for.inc21 ]
+for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc21
+ %B.addr.24 = phi i32* [ %B.addr.16, %for.cond4.preheader ], [ %scevgep, %for.inc21 ]
%k.03 = phi i64 [ 0, %for.cond4.preheader ], [ %inc22, %for.inc21 ]
br label %for.body9
-for.body9: ; preds = %for.body9, %for.cond7.preheader
+for.body9: ; preds = %for.cond7.preheader, %for.body9
%l.02 = phi i64 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ]
%B.addr.31 = phi i32* [ %B.addr.24, %for.cond7.preheader ], [ %incdec.ptr, %for.body9 ]
%conv = trunc i64 %i.07 to i32
@@ -240,27 +274,29 @@ for.body9: ; preds = %for.body9, %for.con
%add16 = add nsw i64 %i.07, 10
%arrayidx20 = getelementptr inbounds [100 x [100 x [100 x i32]]]* %A, i64 10, i64 %add16, i64 %add15, i64 %add14
%0 = load i32* %arrayidx20, align 4
-; CHECK: da analyze - flow [> * * *]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.31, i64 1
store i32 %0, i32* %B.addr.31, align 4
%inc = add nsw i64 %l.02, 1
- %cmp8 = icmp slt i64 %inc, 50
- br i1 %cmp8, label %for.body9, label %for.inc21
+ %exitcond = icmp ne i64 %inc, 50
+ br i1 %exitcond, label %for.body9, label %for.inc21
for.inc21: ; preds = %for.body9
+ %scevgep = getelementptr i32* %B.addr.24, i64 50
%inc22 = add nsw i64 %k.03, 1
- %cmp5 = icmp slt i64 %inc22, 50
- br i1 %cmp5, label %for.cond7.preheader, label %for.inc24
+ %exitcond10 = icmp ne i64 %inc22, 50
+ br i1 %exitcond10, label %for.cond7.preheader, label %for.inc24
for.inc24: ; preds = %for.inc21
+ %scevgep9 = getelementptr i32* %B.addr.16, i64 2500
%inc25 = add nsw i64 %j.05, 1
- %cmp2 = icmp slt i64 %inc25, 50
- br i1 %cmp2, label %for.cond4.preheader, label %for.inc27
+ %exitcond12 = icmp ne i64 %inc25, 50
+ br i1 %exitcond12, label %for.cond4.preheader, label %for.inc27
for.inc27: ; preds = %for.inc24
+ %scevgep11 = getelementptr i32* %B.addr.08, i64 125000
%inc28 = add nsw i64 %i.07, 1
- %cmp = icmp slt i64 %inc28, 50
- br i1 %cmp, label %for.cond1.preheader, label %for.end29
+ %exitcond13 = icmp ne i64 %inc28, 50
+ br i1 %exitcond13, label %for.cond1.preheader, label %for.end29
for.end29: ; preds = %for.inc27
ret void
diff --git a/test/Analysis/DependenceAnalysis/StrongSIV.ll b/test/Analysis/DependenceAnalysis/StrongSIV.ll
index be336c3580ce..f499e84d4844 100644
--- a/test/Analysis/DependenceAnalysis/StrongSIV.ll
+++ b/test/Analysis/DependenceAnalysis/StrongSIV.ll
@@ -1,143 +1,196 @@
-; RUN: opt < %s -analyze -basicaa -indvars -da | FileCheck %s
+; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
; ModuleID = 'StrongSIV.bc'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.6.0"
-;; for (int i = 0; i < n; i++)
-;; A[i + 2] = ...
-;; ... = A[i];
+;; for (int i = 0; i < n; i++) {
+;; A[i + 2] = i;
+;; *B++ = A[i];
define void @strong0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp sgt i64 %n, 0
- br i1 %cmp1, label %for.body, label %for.end
+ br i1 %cmp1, label %for.body.preheader, label %for.end
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
- %add = add nsw i32 %i.03, 2
- %idxprom = sext i32 %add to i64
- %arrayidx = getelementptr inbounds i32* %A, i64 %idxprom
- store i32 %i.03, i32* %arrayidx, align 4
- %idxprom2 = sext i32 %i.03 to i64
- %arrayidx3 = getelementptr inbounds i32* %A, i64 %idxprom2
- %0 = load i32* %arrayidx3, align 4
+; CHECK: da analyze - none!
; CHECK: da analyze - consistent flow [2]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
+ %0 = add nsw i64 %indvars.iv, 2
+ %arrayidx = getelementptr inbounds i32* %A, i64 %0
+ %1 = trunc i64 %indvars.iv to i32
+ store i32 %1, i32* %arrayidx, align 4
+ %arrayidx3 = getelementptr inbounds i32* %A, i64 %indvars.iv
+ %2 = load i32* %arrayidx3, align 4
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
- store i32 %0, i32* %B.addr.02, align 4
- %inc = add nsw i32 %i.03, 1
- %conv = sext i32 %inc to i64
- %cmp = icmp slt i64 %conv, %n
- br i1 %cmp, label %for.body, label %for.end
+ store i32 %2, i32* %B.addr.02, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %exitcond = icmp ne i64 %indvars.iv.next, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
+
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
-for.end: ; preds = %for.body, %entry
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long int i = 0; i < n; i++)
-;; A[i + 2] = ...
-;; ... = A[i];
+;; for (long int i = 0; i < n; i++) {
+;; A[i + 2] = i;
+;; *B++ = A[i];
define void @strong1(i32* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
- %conv = sext i32 %n to i64
%cmp1 = icmp sgt i32 %n, 0
- br i1 %cmp1, label %for.body, label %for.end
+ br i1 %cmp1, label %for.body.preheader, label %for.end
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - consistent flow [2]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ %0 = sext i32 %n to i64
+ br label %for.body
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv2 = trunc i64 %i.03 to i32
%add = add nsw i64 %i.03, 2
%arrayidx = getelementptr inbounds i32* %A, i64 %add
store i32 %conv2, i32* %arrayidx, align 4
%arrayidx3 = getelementptr inbounds i32* %A, i64 %i.03
- %0 = load i32* %arrayidx3, align 4
-; CHECK: da analyze - consistent flow [2]!
+ %1 = load i32* %arrayidx3, align 4
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
- store i32 %0, i32* %B.addr.02, align 4
+ store i32 %1, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp slt i64 %inc, %conv
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %0
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
-for.end: ; preds = %for.body, %entry
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
+
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long unsigned i = 0; i < n; i++)
-;; A[i + 2] = ...
-;; ... = A[i];
+;; for (long unsigned i = 0; i < n; i++) {
+;; A[i + 2] = i;
+;; *B++ = A[i];
define void @strong2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - consistent flow [2]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%add = add i64 %i.03, 2
%arrayidx = getelementptr inbounds i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32* %A, i64 %i.03
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - consistent flow [2]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
+
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
-for.end: ; preds = %for.body, %entry
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (int i = 0; i < n; i++)
-;; A[i + 2] = ...
-;; ... = A[i];
+;; for (int i = 0; i < n; i++) {
+;; A[i + 2] = i;
+;; *B++ = A[i];
define void @strong3(i32* %A, i32* %B, i32 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp sgt i32 %n, 0
- br i1 %cmp1, label %for.body, label %for.end
+ br i1 %cmp1, label %for.body.preheader, label %for.end
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
- %add = add nsw i32 %i.03, 2
- %idxprom = sext i32 %add to i64
- %arrayidx = getelementptr inbounds i32* %A, i64 %idxprom
- store i32 %i.03, i32* %arrayidx, align 4
- %idxprom1 = sext i32 %i.03 to i64
- %arrayidx2 = getelementptr inbounds i32* %A, i64 %idxprom1
- %0 = load i32* %arrayidx2, align 4
+; CHECK: da analyze - none!
; CHECK: da analyze - consistent flow [2]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
+ %0 = add nsw i64 %indvars.iv, 2
+ %arrayidx = getelementptr inbounds i32* %A, i64 %0
+ %1 = trunc i64 %indvars.iv to i32
+ store i32 %1, i32* %arrayidx, align 4
+ %arrayidx2 = getelementptr inbounds i32* %A, i64 %indvars.iv
+ %2 = load i32* %arrayidx2, align 4
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
- store i32 %0, i32* %B.addr.02, align 4
- %inc = add nsw i32 %i.03, 1
- %cmp = icmp slt i32 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ store i32 %2, i32* %B.addr.02, align 4
+ %indvars.iv.next = add i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp ne i32 %lftr.wideiv, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
-for.end: ; preds = %for.body, %entry
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
+
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long unsigned i = 0; i < 19; i++)
-;; A[i + 19] = ...
-;; ... = A[i];
+;; for (long unsigned i = 0; i < 19; i++) {
+;; A[i + 19] = i;
+;; *B++ = A[i];
define void @strong4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -146,27 +199,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32* %A, i64 %i.02
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 19
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 19
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < 20; i++)
-;; A[i + 19] = ...
-;; ... = A[i];
+;; for (long unsigned i = 0; i < 20; i++) {
+;; A[i + 19] = i;
+;; *B++ = A[i];
define void @strong5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - consistent flow [19]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -175,27 +234,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32* %A, i64 %i.02
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - consistent flow [19]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 20
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 20
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < 20; i++)
-;; A[2*i + 6] = ...
-;; ... = A[2*i];
+;; for (long unsigned i = 0; i < 20; i++) {
+;; A[2*i + 6] = i;
+;; *B++ = A[2*i];
define void @strong6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - consistent flow [3]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -206,27 +271,33 @@ for.body: ; preds = %for.body, %entry
%mul1 = shl i64 %i.02, 1
%arrayidx2 = getelementptr inbounds i32* %A, i64 %mul1
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - consistent flow [3]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 20
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 20
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < 20; i++)
-;; A[2*i + 7] = ...
-;; ... = A[2*i];
+;; for (long unsigned i = 0; i < 20; i++) {
+;; A[2*i + 7] = i;
+;; *B++ = A[2*i];
define void @strong7(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -237,27 +308,33 @@ for.body: ; preds = %for.body, %entry
%mul1 = shl i64 %i.02, 1
%arrayidx2 = getelementptr inbounds i32* %A, i64 %mul1
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 20
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 20
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < 20; i++)
-;; A[i + n] = ...
-;; ... = A[i];
+;; for (long unsigned i = 0; i < 20; i++) {
+;; A[i + n] = i;
+;; *B++ = A[i];
define void @strong8(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - consistent flow [%n|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -266,30 +343,39 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32* %A, i64 %i.02
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - consistent flow [%n|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 20
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 20
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < n; i++)
-;; A[i + n] = ...
-;; ... = A[i + 2*n];
+;; for (long unsigned i = 0; i < n; i++) {
+;; A[i + n] = i;
+;; *B++ = A[i + 2*n];
define void @strong9(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%add = add i64 %i.03, %n
%arrayidx = getelementptr inbounds i32* %A, i64 %add
@@ -298,27 +384,36 @@ for.body: ; preds = %for.body, %entry
%add1 = add i64 %i.03, %mul
%arrayidx2 = getelementptr inbounds i32* %A, i64 %add1
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
-for.end: ; preds = %for.body, %entry
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
+
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long unsigned i = 0; i < 1000; i++)
-;; A[n*i + 5] = ...
-;; ... = A[n*i + 5];
+;; for (long unsigned i = 0; i < 1000; i++) {
+;; A[n*i + 5] = i;
+;; *B++ = A[n*i + 5];
define void @strong10(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - consistent flow [0|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -330,12 +425,11 @@ for.body: ; preds = %for.body, %entry
%add2 = add i64 %mul1, 5
%arrayidx3 = getelementptr inbounds i32* %A, i64 %add2
%0 = load i32* %arrayidx3, align 4
-; CHECK: da analyze - consistent flow [0|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 1000
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 1000
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
diff --git a/test/Analysis/DependenceAnalysis/SymbolicRDIV.ll b/test/Analysis/DependenceAnalysis/SymbolicRDIV.ll
index 2a1b4e7e971d..81e61892d8e8 100644
--- a/test/Analysis/DependenceAnalysis/SymbolicRDIV.ll
+++ b/test/Analysis/DependenceAnalysis/SymbolicRDIV.ll
@@ -6,65 +6,99 @@ target triple = "x86_64-apple-macosx10.6.0"
;; for (long int i = 0; i < n1; i++)
-;; A[2*i + n1] = ...
+;; A[2*i + n1] = i;
;; for (long int j = 0; j < n2; j++)
-;; ... = A[3*j + 3*n1];
+;; *B++ = A[3*j + 3*n1];
define void @symbolicrdiv0(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
- br i1 %cmp4, label %for.cond1.preheader, label %for.body
+ br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
-for.cond1.preheader: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.cond1.preheader.loopexit: ; preds = %for.body
+ br label %for.cond1.preheader
+
+for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
%cmp21 = icmp eq i64 %n2, 0
- br i1 %cmp21, label %for.end11, label %for.body4
+ br i1 %cmp21, label %for.end11, label %for.body4.preheader
-for.body: ; preds = %for.body, %entry
- %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
+for.body4.preheader: ; preds = %for.cond1.preheader
+ br label %for.body4
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%conv = trunc i64 %i.05 to i32
%mul = shl nsw i64 %i.05, 1
%add = add i64 %mul, %n1
%arrayidx = getelementptr inbounds i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.05, 1
- %cmp = icmp ult i64 %inc, %n1
- br i1 %cmp, label %for.body, label %for.cond1.preheader
+ %exitcond = icmp ne i64 %inc, %n1
+ br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
-for.body4: ; preds = %for.body4, %for.cond1.preheader
- %j.03 = phi i64 [ %inc10, %for.body4 ], [ 0, %for.cond1.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ]
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.03 = phi i64 [ %inc10, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%mul56 = add i64 %j.03, %n1
%add7 = mul i64 %mul56, 3
%arrayidx8 = getelementptr inbounds i32* %A, i64 %add7
%0 = load i32* %arrayidx8, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc10 = add nsw i64 %j.03, 1
- %cmp2 = icmp ult i64 %inc10, %n2
- br i1 %cmp2, label %for.body4, label %for.end11
+ %exitcond7 = icmp ne i64 %inc10, %n2
+ br i1 %exitcond7, label %for.body4, label %for.end11.loopexit
-for.end11: ; preds = %for.body4, %for.cond1.preheader
+for.end11.loopexit: ; preds = %for.body4
+ br label %for.end11
+
+for.end11: ; preds = %for.end11.loopexit, %for.cond1.preheader
ret void
}
;; for (long int i = 0; i < n1; i++)
-;; A[2*i + 5*n2] = ...
+;; A[2*i + 5*n2] = i;
;; for (long int j = 0; j < n2; j++)
-;; ... = A[3*j + 2*n2];
+;; *B++ = A[3*j + 2*n2];
define void @symbolicrdiv1(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
- br i1 %cmp4, label %for.cond2.preheader, label %for.body
+ br i1 %cmp4, label %for.cond2.preheader, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.cond2.preheader.loopexit: ; preds = %for.body
+ br label %for.cond2.preheader
-for.cond2.preheader: ; preds = %for.body, %entry
+for.cond2.preheader: ; preds = %for.cond2.preheader.loopexit, %entry
%cmp31 = icmp eq i64 %n2, 0
- br i1 %cmp31, label %for.end12, label %for.body5
+ br i1 %cmp31, label %for.end12, label %for.body5.preheader
-for.body: ; preds = %for.body, %entry
- %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
+for.body5.preheader: ; preds = %for.cond2.preheader
+ br label %for.body5
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%conv = trunc i64 %i.05 to i32
%mul = shl nsw i64 %i.05, 1
%mul1 = mul i64 %n2, 5
@@ -72,220 +106,307 @@ for.body: ; preds = %for.body, %entry
%arrayidx = getelementptr inbounds i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.05, 1
- %cmp = icmp ult i64 %inc, %n1
- br i1 %cmp, label %for.body, label %for.cond2.preheader
+ %exitcond = icmp ne i64 %inc, %n1
+ br i1 %exitcond, label %for.body, label %for.cond2.preheader.loopexit
-for.body5: ; preds = %for.body5, %for.cond2.preheader
- %j.03 = phi i64 [ %inc11, %for.body5 ], [ 0, %for.cond2.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body5 ], [ %B, %for.cond2.preheader ]
+for.body5: ; preds = %for.body5.preheader, %for.body5
+ %j.03 = phi i64 [ %inc11, %for.body5 ], [ 0, %for.body5.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body5 ], [ %B, %for.body5.preheader ]
%mul6 = mul nsw i64 %j.03, 3
%mul7 = shl i64 %n2, 1
%add8 = add i64 %mul6, %mul7
%arrayidx9 = getelementptr inbounds i32* %A, i64 %add8
%0 = load i32* %arrayidx9, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc11 = add nsw i64 %j.03, 1
- %cmp3 = icmp ult i64 %inc11, %n2
- br i1 %cmp3, label %for.body5, label %for.end12
+ %exitcond6 = icmp ne i64 %inc11, %n2
+ br i1 %exitcond6, label %for.body5, label %for.end12.loopexit
+
+for.end12.loopexit: ; preds = %for.body5
+ br label %for.end12
-for.end12: ; preds = %for.body5, %for.cond2.preheader
+for.end12: ; preds = %for.end12.loopexit, %for.cond2.preheader
ret void
}
;; for (long int i = 0; i < n1; i++)
-;; A[2*i - n2] = ...
+;; A[2*i - n2] = i;
;; for (long int j = 0; j < n2; j++)
-;; ... = A[-j + 2*n1];
+;; *B++ = A[-j + 2*n1];
define void @symbolicrdiv2(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
- br i1 %cmp4, label %for.cond1.preheader, label %for.body
+ br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
-for.cond1.preheader: ; preds = %for.body, %entry
+for.cond1.preheader.loopexit: ; preds = %for.body
+ br label %for.cond1.preheader
+
+for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
%cmp21 = icmp eq i64 %n2, 0
- br i1 %cmp21, label %for.end10, label %for.body4
+ br i1 %cmp21, label %for.end10, label %for.body4.preheader
+
+for.body4.preheader: ; preds = %for.cond1.preheader
+ br label %for.body4
-for.body: ; preds = %for.body, %entry
- %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%conv = trunc i64 %i.05 to i32
%mul = shl nsw i64 %i.05, 1
%sub = sub i64 %mul, %n2
%arrayidx = getelementptr inbounds i32* %A, i64 %sub
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.05, 1
- %cmp = icmp ult i64 %inc, %n1
- br i1 %cmp, label %for.body, label %for.cond1.preheader
+ %exitcond = icmp ne i64 %inc, %n1
+ br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
-for.body4: ; preds = %for.body4, %for.cond1.preheader
- %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.cond1.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ]
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%mul6 = shl i64 %n1, 1
%add = sub i64 %mul6, %j.03
%arrayidx7 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx7, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc9 = add nsw i64 %j.03, 1
- %cmp2 = icmp ult i64 %inc9, %n2
- br i1 %cmp2, label %for.body4, label %for.end10
+ %exitcond6 = icmp ne i64 %inc9, %n2
+ br i1 %exitcond6, label %for.body4, label %for.end10.loopexit
+
+for.end10.loopexit: ; preds = %for.body4
+ br label %for.end10
-for.end10: ; preds = %for.body4, %for.cond1.preheader
+for.end10: ; preds = %for.end10.loopexit, %for.cond1.preheader
ret void
}
;; for (long int i = 0; i < n1; i++)
-;; A[-i + n2] = ...
+;; A[-i + n2] = i;
;; for (long int j = 0; j < n2; j++)
-;; ... = A[j - n1];
+;; *B++ = A[j - n1];
define void @symbolicrdiv3(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
- br i1 %cmp4, label %for.cond1.preheader, label %for.body
+ br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
-for.cond1.preheader: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.cond1.preheader.loopexit: ; preds = %for.body
+ br label %for.cond1.preheader
+
+for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
%cmp21 = icmp eq i64 %n2, 0
- br i1 %cmp21, label %for.end9, label %for.body4
+ br i1 %cmp21, label %for.end9, label %for.body4.preheader
-for.body: ; preds = %for.body, %entry
- %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
+for.body4.preheader: ; preds = %for.cond1.preheader
+ br label %for.body4
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%conv = trunc i64 %i.05 to i32
%add = sub i64 %n2, %i.05
%arrayidx = getelementptr inbounds i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.05, 1
- %cmp = icmp ult i64 %inc, %n1
- br i1 %cmp, label %for.body, label %for.cond1.preheader
+ %exitcond = icmp ne i64 %inc, %n1
+ br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
-for.body4: ; preds = %for.body4, %for.cond1.preheader
- %j.03 = phi i64 [ %inc8, %for.body4 ], [ 0, %for.cond1.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ]
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.03 = phi i64 [ %inc8, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%sub5 = sub i64 %j.03, %n1
%arrayidx6 = getelementptr inbounds i32* %A, i64 %sub5
%0 = load i32* %arrayidx6, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc8 = add nsw i64 %j.03, 1
- %cmp2 = icmp ult i64 %inc8, %n2
- br i1 %cmp2, label %for.body4, label %for.end9
+ %exitcond6 = icmp ne i64 %inc8, %n2
+ br i1 %exitcond6, label %for.body4, label %for.end9.loopexit
-for.end9: ; preds = %for.body4, %for.cond1.preheader
+for.end9.loopexit: ; preds = %for.body4
+ br label %for.end9
+
+for.end9: ; preds = %for.end9.loopexit, %for.cond1.preheader
ret void
}
;; for (long int i = 0; i < n1; i++)
-;; A[-i + 2*n1] = ...
+;; A[-i + 2*n1] = i;
;; for (long int j = 0; j < n2; j++)
-;; ... = A[-j + n1];
+;; *B++ = A[-j + n1];
define void @symbolicrdiv4(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
- br i1 %cmp4, label %for.cond1.preheader, label %for.body
+ br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
-for.cond1.preheader: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.cond1.preheader.loopexit: ; preds = %for.body
+ br label %for.cond1.preheader
+
+for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
%cmp21 = icmp eq i64 %n2, 0
- br i1 %cmp21, label %for.end10, label %for.body4
+ br i1 %cmp21, label %for.end10, label %for.body4.preheader
-for.body: ; preds = %for.body, %entry
- %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
+for.body4.preheader: ; preds = %for.cond1.preheader
+ br label %for.body4
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%conv = trunc i64 %i.05 to i32
%mul = shl i64 %n1, 1
%add = sub i64 %mul, %i.05
%arrayidx = getelementptr inbounds i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.05, 1
- %cmp = icmp ult i64 %inc, %n1
- br i1 %cmp, label %for.body, label %for.cond1.preheader
+ %exitcond = icmp ne i64 %inc, %n1
+ br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
-for.body4: ; preds = %for.body4, %for.cond1.preheader
- %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.cond1.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ]
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%add6 = sub i64 %n1, %j.03
%arrayidx7 = getelementptr inbounds i32* %A, i64 %add6
%0 = load i32* %arrayidx7, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc9 = add nsw i64 %j.03, 1
- %cmp2 = icmp ult i64 %inc9, %n2
- br i1 %cmp2, label %for.body4, label %for.end10
+ %exitcond6 = icmp ne i64 %inc9, %n2
+ br i1 %exitcond6, label %for.body4, label %for.end10.loopexit
-for.end10: ; preds = %for.body4, %for.cond1.preheader
+for.end10.loopexit: ; preds = %for.body4
+ br label %for.end10
+
+for.end10: ; preds = %for.end10.loopexit, %for.cond1.preheader
ret void
}
;; for (long int i = 0; i < n1; i++)
-;; A[-i + n2] = ...
+;; A[-i + n2] = i;
;; for (long int j = 0; j < n2; j++)
-;; ... = A[-j + 2*n2];
+;; *B++ = A[-j + 2*n2];
define void @symbolicrdiv5(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
- br i1 %cmp4, label %for.cond1.preheader, label %for.body
+ br i1 %cmp4, label %for.cond1.preheader, label %for.body.preheader
-for.cond1.preheader: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.cond1.preheader.loopexit: ; preds = %for.body
+ br label %for.cond1.preheader
+
+for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit, %entry
%cmp21 = icmp eq i64 %n2, 0
- br i1 %cmp21, label %for.end10, label %for.body4
+ br i1 %cmp21, label %for.end10, label %for.body4.preheader
-for.body: ; preds = %for.body, %entry
- %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
+for.body4.preheader: ; preds = %for.cond1.preheader
+ br label %for.body4
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.05 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
%conv = trunc i64 %i.05 to i32
%add = sub i64 %n2, %i.05
%arrayidx = getelementptr inbounds i32* %A, i64 %add
store i32 %conv, i32* %arrayidx, align 4
%inc = add nsw i64 %i.05, 1
- %cmp = icmp ult i64 %inc, %n1
- br i1 %cmp, label %for.body, label %for.cond1.preheader
+ %exitcond = icmp ne i64 %inc, %n1
+ br i1 %exitcond, label %for.body, label %for.cond1.preheader.loopexit
-for.body4: ; preds = %for.body4, %for.cond1.preheader
- %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.cond1.preheader ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.cond1.preheader ]
+for.body4: ; preds = %for.body4.preheader, %for.body4
+ %j.03 = phi i64 [ %inc9, %for.body4 ], [ 0, %for.body4.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body4 ], [ %B, %for.body4.preheader ]
%mul = shl i64 %n2, 1
%add6 = sub i64 %mul, %j.03
%arrayidx7 = getelementptr inbounds i32* %A, i64 %add6
%0 = load i32* %arrayidx7, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc9 = add nsw i64 %j.03, 1
- %cmp2 = icmp ult i64 %inc9, %n2
- br i1 %cmp2, label %for.body4, label %for.end10
+ %exitcond6 = icmp ne i64 %inc9, %n2
+ br i1 %exitcond6, label %for.body4, label %for.end10.loopexit
-for.end10: ; preds = %for.body4, %for.cond1.preheader
+for.end10.loopexit: ; preds = %for.body4
+ br label %for.end10
+
+for.end10: ; preds = %for.end10.loopexit, %for.cond1.preheader
ret void
}
;; for (long int i = 0; i < n1; i++)
-;; for (long int j = 0; j < n2; j++)
-;; A[j -i + n2] = ...
-;; ... = A[2*n2];
+;; for (long int j = 0; j < n2; j++) {
+;; A[j -i + n2] = i;
+;; *B++ = A[2*n2];
define void @symbolicrdiv6(i32* %A, i32* %B, i64 %n1, i64 %n2) nounwind uwtable ssp {
entry:
%cmp4 = icmp eq i64 %n1, 0
- br i1 %cmp4, label %for.end7, label %for.cond1.preheader
+ br i1 %cmp4, label %for.end7, label %for.cond1.preheader.preheader
+
+; CHECK: da analyze - output [* *]!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [S S]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - output [* *]!
+
+for.cond1.preheader.preheader: ; preds = %entry
+ br label %for.cond1.preheader
-for.cond1.preheader: ; preds = %for.inc5, %entry
- %B.addr.06 = phi i32* [ %B.addr.1.lcssa, %for.inc5 ], [ %B, %entry ]
- %i.05 = phi i64 [ %inc6, %for.inc5 ], [ 0, %entry ]
+for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.inc5
+ %B.addr.06 = phi i32* [ %B.addr.1.lcssa, %for.inc5 ], [ %B, %for.cond1.preheader.preheader ]
+ %i.05 = phi i64 [ %inc6, %for.inc5 ], [ 0, %for.cond1.preheader.preheader ]
%cmp21 = icmp eq i64 %n2, 0
- br i1 %cmp21, label %for.inc5, label %for.body3
+ br i1 %cmp21, label %for.inc5, label %for.body3.preheader
-for.body3: ; preds = %for.body3, %for.cond1.preheader
- %j.03 = phi i64 [ %inc, %for.body3 ], [ 0, %for.cond1.preheader ]
- %B.addr.12 = phi i32* [ %incdec.ptr, %for.body3 ], [ %B.addr.06, %for.cond1.preheader ]
+for.body3.preheader: ; preds = %for.cond1.preheader
+ br label %for.body3
+
+for.body3: ; preds = %for.body3.preheader, %for.body3
+ %j.03 = phi i64 [ %inc, %for.body3 ], [ 0, %for.body3.preheader ]
+ %B.addr.12 = phi i32* [ %incdec.ptr, %for.body3 ], [ %B.addr.06, %for.body3.preheader ]
%conv = trunc i64 %i.05 to i32
%sub = sub nsw i64 %j.03, %i.05
%add = add i64 %sub, %n2
@@ -294,19 +415,25 @@ for.body3: ; preds = %for.body3, %for.con
%mul = shl i64 %n2, 1
%arrayidx4 = getelementptr inbounds i32* %A, i64 %mul
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.12, i64 1
store i32 %0, i32* %B.addr.12, align 4
%inc = add nsw i64 %j.03, 1
- %cmp2 = icmp ult i64 %inc, %n2
- br i1 %cmp2, label %for.body3, label %for.inc5
+ %exitcond = icmp ne i64 %inc, %n2
+ br i1 %exitcond, label %for.body3, label %for.inc5.loopexit
-for.inc5: ; preds = %for.body3, %for.cond1.preheader
- %B.addr.1.lcssa = phi i32* [ %B.addr.06, %for.cond1.preheader ], [ %incdec.ptr, %for.body3 ]
+for.inc5.loopexit: ; preds = %for.body3
+ %scevgep = getelementptr i32* %B.addr.06, i64 %n2
+ br label %for.inc5
+
+for.inc5: ; preds = %for.inc5.loopexit, %for.cond1.preheader
+ %B.addr.1.lcssa = phi i32* [ %B.addr.06, %for.cond1.preheader ], [ %scevgep, %for.inc5.loopexit ]
%inc6 = add nsw i64 %i.05, 1
- %cmp = icmp ult i64 %inc6, %n1
- br i1 %cmp, label %for.cond1.preheader, label %for.end7
+ %exitcond7 = icmp ne i64 %inc6, %n1
+ br i1 %exitcond7, label %for.cond1.preheader, label %for.end7.loopexit
+
+for.end7.loopexit: ; preds = %for.inc5
+ br label %for.end7
-for.end7: ; preds = %for.inc5, %entry
+for.end7: ; preds = %for.end7.loopexit, %entry
ret void
}
diff --git a/test/Analysis/DependenceAnalysis/SymbolicSIV.ll b/test/Analysis/DependenceAnalysis/SymbolicSIV.ll
index ee2343fa51e9..297096ce135d 100644
--- a/test/Analysis/DependenceAnalysis/SymbolicSIV.ll
+++ b/test/Analysis/DependenceAnalysis/SymbolicSIV.ll
@@ -5,18 +5,28 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-apple-macosx10.6.0"
-;; for (long int i = 0; i < n; i++)
-;; A[2*i + n] = ...
-;; ... = A[3*i + 3*n];
+;; for (long int i = 0; i < n; i++) {
+;; A[2*i + n] = i;
+;; *B++ = A[3*i + 3*n];
define void @symbolicsiv0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = shl nsw i64 %i.03, 1
%add = add i64 %mul, %n
@@ -26,30 +36,42 @@ for.body: ; preds = %for.body, %entry
%add3 = mul i64 %mul14, 3
%arrayidx4 = getelementptr inbounds i32* %A, i64 %add3
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
-for.end: ; preds = %for.body, %entry
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
+
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long int i = 0; i < n; i++)
-;; A[2*i + 5*n] = ...
-;; ... = A[3*i + 2*n];
+;; for (long int i = 0; i < n; i++) {
+;; A[2*i + 5*n] = i;
+;; *B++ = A[3*i + 2*n];
define void @symbolicsiv1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = shl nsw i64 %i.03, 1
%mul1 = mul i64 %n, 5
@@ -61,30 +83,42 @@ for.body: ; preds = %for.body, %entry
%add4 = add i64 %mul2, %mul3
%arrayidx5 = getelementptr inbounds i32* %A, i64 %add4
%0 = load i32* %arrayidx5, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
+
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
-for.end: ; preds = %for.body, %entry
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long int i = 0; i < n; i++)
-;; A[2*i - n] = ...
-;; ... = A[-i + 2*n];
+;; for (long int i = 0; i < n; i++) {
+;; A[2*i - n] = i;
+;; *B++ = A[-i + 2*n];
define void @symbolicsiv2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = shl nsw i64 %i.03, 1
%sub = sub i64 %mul, %n
@@ -94,30 +128,42 @@ for.body: ; preds = %for.body, %entry
%add = sub i64 %mul2, %i.03
%arrayidx3 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx3, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
+
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
-for.end: ; preds = %for.body, %entry
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long int i = 0; i < n; i++)
-;; A[-2*i + n + 1] = ...
-;; ... = A[i - 2*n];
+;; for (long int i = 0; i < n; i++) {
+;; A[-2*i + n + 1] = i;
+;; *B++ = A[i - 2*n];
define void @symbolicsiv3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, -2
%add = add i64 %mul, %n
@@ -128,30 +174,42 @@ for.body: ; preds = %for.body, %entry
%sub = sub i64 %i.03, %mul2
%arrayidx3 = getelementptr inbounds i32* %A, i64 %sub
%0 = load i32* %arrayidx3, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
-for.end: ; preds = %for.body, %entry
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
+
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long int i = 0; i < n; i++)
-;; A[-2*i + 3*n] = ...
-;; ... = A[-i + n];
+;; for (long int i = 0; i < n; i++) {
+;; A[-2*i + 3*n] = i;
+;; *B++ = A[-i + n];
define void @symbolicsiv4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, -2
%mul1 = mul i64 %n, 3
@@ -161,30 +219,42 @@ for.body: ; preds = %for.body, %entry
%add2 = sub i64 %n, %i.03
%arrayidx3 = getelementptr inbounds i32* %A, i64 %add2
%0 = load i32* %arrayidx3, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
-for.end: ; preds = %for.body, %entry
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
+
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long int i = 0; i < n; i++)
-;; A[-2*i - 2*n] = ...
-;; ... = A[-i - n];
+;; for (long int i = 0; i < n; i++) {
+;; A[-2*i - 2*n] = i;
+;; *B++ = A[-i - n];
define void @symbolicsiv5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = mul nsw i64 %i.03, -2
%mul1 = shl i64 %n, 1
@@ -195,32 +265,44 @@ for.body: ; preds = %for.body, %entry
%sub3 = sub i64 %sub2, %n
%arrayidx4 = getelementptr inbounds i32* %A, i64 %sub3
%0 = load i32* %arrayidx4, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
-for.end: ; preds = %for.body, %entry
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
+
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
;; why doesn't SCEV package understand that n >= 0?
-;;void weaktest(int *A, int *B, long unsigned n)
-;; for (long unsigned i = 0; i < n; i++)
-;; A[i + n + 1] = ...
-;; ... = A[-i];
+;; for (long unsigned i = 0; i < n; i++) {
+;; A[i + n + 1] = i;
+;; *B++ = A[-i];
define void @weaktest(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [*|<] splitable!
+; CHECK: da analyze - split level = 1, iteration = ((0 smax (-1 + (-1 * %n))) /u 2)!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%add = add i64 %i.03, %n
%add1 = add i64 %add, 1
@@ -229,29 +311,36 @@ for.body: ; preds = %for.body, %entry
%sub = sub i64 0, %i.03
%arrayidx2 = getelementptr inbounds i32* %A, i64 %sub
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - flow [*|<] splitable!
-; CHECK: da analyze - split level = 1, iteration = ((0 smax (-1 + (-1 * %n))) /u 2)!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
+
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
-for.end: ; preds = %for.body, %entry
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; void symbolicsiv6(int *A, int *B, long unsigned n, long unsigned N, long unsigned M) {
-;; for (long int i = 0; i < n; i++) {
-;; A[4*N*i + M] = i;
-;; *B++ = A[4*N*i + 3*M + 1];
+;; for (long int i = 0; i < n; i++) {
+;; A[4*N*i + M] = i;
+;; *B++ = A[4*N*i + 3*M + 1];
define void @symbolicsiv6(i32* %A, i32* %B, i64 %n, i64 %N, i64 %M) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.body.preheader: ; preds = %entry
br label %for.body
@@ -272,7 +361,6 @@ for.body: ; preds = %for.body.preheader,
%arrayidx7 = getelementptr inbounds i32* %A, i64 %add6
%0 = load i32* %arrayidx7, align 4
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
-; CHECK: da analyze - none!
store i32 %0, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
@@ -286,16 +374,22 @@ for.end: ; preds = %for.end.loopexit, %
}
-;; void symbolicsiv7(int *A, int *B, long unsigned n, long unsigned N, long unsigned M) {
-;; for (long int i = 0; i < n; i++) {
-;; A[2*N*i + M] = i;
-;; *B++ = A[2*N*i - 3*M + 2];
+;; for (long int i = 0; i < n; i++) {
+;; A[2*N*i + M] = i;
+;; *B++ = A[2*N*i - 3*M + 2];
define void @symbolicsiv7(i32* %A, i32* %B, i64 %n, i64 %N, i64 %M) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %for.end, label %for.body.preheader
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [<>]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
for.body.preheader: ; preds = %entry
br label %for.body
@@ -316,7 +410,6 @@ for.body: ; preds = %for.body.preheader,
%arrayidx6 = getelementptr inbounds i32* %A, i64 %add5
%1 = load i32* %arrayidx6, align 4
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
-; CHECK: da analyze - flow [<>]!
store i32 %1, i32* %B.addr.02, align 4
%inc = add nsw i64 %i.03, 1
%exitcond = icmp ne i64 %inc, %n
diff --git a/test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll b/test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll
index 343e8f49bf9e..8b2e43f3d868 100644
--- a/test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll
+++ b/test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll
@@ -5,18 +5,28 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-apple-macosx10.6.0"
-;; for (long unsigned i = 0; i < n; i++)
-;; A[1 + n*i] = ...
-;; ... = A[1 - n*i];
+;; for (long unsigned i = 0; i < n; i++) {
+;; A[1 + n*i] = i;
+;; *B++ = A[1 - n*i];
define void @weakcrossing0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [0|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = mul i64 %i.03, %n
%add = add i64 %mul, 1
@@ -26,30 +36,43 @@ for.body: ; preds = %for.body, %entry
%sub = sub i64 1, %mul1
%arrayidx2 = getelementptr inbounds i32* %A, i64 %sub
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - flow [0|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
+
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
-for.end: ; preds = %for.body, %entry
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long unsigned i = 0; i < n; i++)
-;; A[n + i] = ...
-;; ... = A[1 + n - i];
+;; for (long unsigned i = 0; i < n; i++) {
+;; A[n + i] = i;
+;; *B++ = A[1 + n - i];
define void @weakcrossing1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [<>] splitable!
+; CHECK: da analyze - split level = 1, iteration = 0!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%add = add i64 %i.03, %n
%arrayidx = getelementptr inbounds i32* %A, i64 %add
@@ -58,28 +81,36 @@ for.body: ; preds = %for.body, %entry
%sub = sub i64 %add1, %i.03
%arrayidx2 = getelementptr inbounds i32* %A, i64 %sub
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - flow [<>] splitable!
-; CHECK: da analyze - split level = 1, iteration = 0!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
+
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
-for.end: ; preds = %for.body, %entry
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long unsigned i = 0; i < 3; i++)
-;; A[i] = ...
-;; ... = A[6 - i];
+;; for (long unsigned i = 0; i < 3; i++) {
+;; A[i] = i;
+;; *B++ = A[6 - i];
define void @weakcrossing2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -88,27 +119,33 @@ for.body: ; preds = %for.body, %entry
%sub = sub i64 6, %i.02
%arrayidx1 = getelementptr inbounds i32* %A, i64 %sub
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 3
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 3
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < 4; i++)
-;; A[i] = ...
-;; ... = A[6 - i];
+;; for (long unsigned i = 0; i < 4; i++) {
+;; A[i] = i;
+;; *B++ = A[6 - i];
define void @weakcrossing3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [0|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -117,27 +154,33 @@ for.body: ; preds = %for.body, %entry
%sub = sub i64 6, %i.02
%arrayidx1 = getelementptr inbounds i32* %A, i64 %sub
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [0|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 4
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 4
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < 10; i++)
-;; A[i] = ...
-;; ... = A[-6 - i];
+;; for (long unsigned i = 0; i < 10; i++) {
+;; A[i] = i;
+;; *B++ = A[-6 - i];
define void @weakcrossing4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -146,30 +189,39 @@ for.body: ; preds = %for.body, %entry
%sub = sub i64 -6, %i.02
%arrayidx1 = getelementptr inbounds i32* %A, i64 %sub
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 10
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 10
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < n; i++)
-;; A[3*i] = ...
-;; ... = A[5 - 3*i];
+;; for (long unsigned i = 0; i < n; i++) {
+;; A[3*i] = i;
+;; *B++ = A[5 - 3*i];
define void @weakcrossing5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
+
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = mul i64 %i.03, 3
%arrayidx = getelementptr inbounds i32* %A, i64 %mul
@@ -178,27 +230,37 @@ for.body: ; preds = %for.body, %entry
%sub = add i64 %0, 5
%arrayidx2 = getelementptr inbounds i32* %A, i64 %sub
%1 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %1, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
-for.end: ; preds = %for.body, %entry
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
+
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long unsigned i = 0; i < 4; i++)
-;; A[i] = ...
-;; ... = A[5 - i];
+;; for (long unsigned i = 0; i < 4; i++) {
+;; A[i] = i;
+;; *B++ = A[5 - i];
define void @weakcrossing6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [<>] splitable!
+; CHECK: da analyze - split level = 1, iteration = 2!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -207,13 +269,11 @@ for.body: ; preds = %for.body, %entry
%sub = sub i64 5, %i.02
%arrayidx1 = getelementptr inbounds i32* %A, i64 %sub
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [<>] splitable!
-; CHECK: da analyze - split level = 1, iteration = 2!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 4
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 4
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
diff --git a/test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll b/test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll
index a59871602b6c..bc85e6c8b690 100644
--- a/test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll
+++ b/test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll
@@ -5,15 +5,22 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-apple-macosx10.6.0"
-;; for (long unsigned i = 0; i < 30; i++)
-;; A[2*i + 10] = ...
-;; ... = A[10];
+;; for (long unsigned i = 0; i < 30; i++) {
+;; A[2*i + 10] = i;
+;; *B++ = A[10];
define void @weakzerodst0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [p<=|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [S]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -23,30 +30,39 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32* %A, i64 10
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [p<=|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 30
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 30
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < n; i++)
-;; A[n*i + 10] = ...
-;; ... = A[10];
+;; for (long unsigned i = 0; i < n; i++) {
+;; A[n*i + 10] = i;
+;; *B++ = A[10];
define void @weakzerodst1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [p<=|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [S]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = mul i64 %i.03, %n
%add = add i64 %mul, 10
@@ -54,27 +70,36 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32* %A, i64 10
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [p<=|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
+
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
-for.end: ; preds = %for.body, %entry
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long unsigned i = 0; i < 5; i++)
-;; A[2*i] = ...
-;; ... = A[10];
+;; for (long unsigned i = 0; i < 5; i++) {
+;; A[2*i] = i;
+;; *B++ = A[10];
define void @weakzerodst2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [S]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -83,27 +108,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32* %A, i64 10
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 5
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 5
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < 6; i++)
-;; A[2*i] = ...
-;; ... = A[10];
+;; for (long unsigned i = 0; i < 6; i++) {
+;; A[2*i] = i;
+;; *B++ = A[10];
define void @weakzerodst3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [=>p|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [S]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -112,27 +143,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32* %A, i64 10
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [=>p|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 6
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 6
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < 7; i++)
-;; A[2*i] = ...
-;; ... = A[10];
+;; for (long unsigned i = 0; i < 7; i++) {
+;; A[2*i] = i;
+;; *B++ = A[10];
define void @weakzerodst4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [*|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [S]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -141,27 +178,33 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32* %A, i64 10
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [*|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 7
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 7
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < 7; i++)
-;; A[2*i] = ...
-;; ... = A[-10];
+;; for (long unsigned i = 0; i < 7; i++) {
+;; A[2*i] = i;
+;; *B++ = A[-10];
define void @weakzerodst5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [S]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -170,43 +213,54 @@ for.body: ; preds = %for.body, %entry
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32* %A, i64 -10
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 7
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 7
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < n; i++)
-;; A[3*i] = ...
-;; ... = A[10];
+;; for (long unsigned i = 0; i < n; i++) {
+;; A[3*i] = i;
+;; *B++ = A[10];
define void @weakzerodst6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - consistent input [S]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%mul = mul i64 %i.03, 3
%arrayidx = getelementptr inbounds i32* %A, i64 %mul
store i32 %conv, i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32* %A, i64 10
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
+
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
-for.end: ; preds = %for.body, %entry
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
diff --git a/test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll b/test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll
index fd4f46269546..2b3b2d00ecac 100644
--- a/test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll
+++ b/test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll
@@ -5,15 +5,22 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-apple-macosx10.6.0"
-;; for (long unsigned i = 0; i < 30; i++)
-;; A[10] = ...
-;; ... = A[2*i + 10];
+;; for (long unsigned i = 0; i < 30; i++) {
+;; A[10] = i;
+;; *B++ = A[2*i + 10];
define void @weakzerosrc0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - consistent output [S]!
+; CHECK: da analyze - flow [p<=|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -23,30 +30,39 @@ for.body: ; preds = %for.body, %entry
%add = add i64 %mul, 10
%arrayidx1 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [p<=|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 30
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 30
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < n; i++)
-;; A[10] = ...
-;; ... = A[n*i + 10];
+;; for (long unsigned i = 0; i < n; i++) {
+;; A[10] = i;
+;; *B++ = A[n*i + 10];
define void @weakzerosrc1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - consistent output [S]!
+; CHECK: da analyze - flow [p<=|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%arrayidx = getelementptr inbounds i32* %A, i64 10
store i32 %conv, i32* %arrayidx, align 4
@@ -54,27 +70,36 @@ for.body: ; preds = %for.body, %entry
%add = add i64 %mul, 10
%arrayidx1 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [p<=|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
+
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
-for.end: ; preds = %for.body, %entry
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
-;; for (long unsigned i = 0; i < 5; i++)
-;; A[10] = ...
-;; ... = A[2*i];
+;; for (long unsigned i = 0; i < 5; i++) {
+;; A[10] = i;
+;; *B++ = A[2*i];
define void @weakzerosrc2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - consistent output [S]!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -83,27 +108,33 @@ for.body: ; preds = %for.body, %entry
%mul = shl i64 %i.02, 1
%arrayidx1 = getelementptr inbounds i32* %A, i64 %mul
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 5
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 5
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < 6; i++)
-;; A[10] = ...
-;; ... = A[2*i];
+;; for (long unsigned i = 0; i < 6; i++) {
+;; A[10] = i;
+;; *B++ = A[2*i];
define void @weakzerosrc3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - consistent output [S]!
+; CHECK: da analyze - flow [=>p|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -112,27 +143,33 @@ for.body: ; preds = %for.body, %entry
%mul = shl i64 %i.02, 1
%arrayidx1 = getelementptr inbounds i32* %A, i64 %mul
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [=>p|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 6
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 6
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < 7; i++)
-;; A[10] = ...
-;; ... = A[2*i];
+;; for (long unsigned i = 0; i < 7; i++) {
+;; A[10] = i;
+;; *B++ = A[2*i];
define void @weakzerosrc4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - consistent output [S]!
+; CHECK: da analyze - flow [*|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -141,27 +178,33 @@ for.body: ; preds = %for.body, %entry
%mul = shl i64 %i.02, 1
%arrayidx1 = getelementptr inbounds i32* %A, i64 %mul
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow [*|<]!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 7
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 7
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < 7; i++)
-;; A[-10] = ...
-;; ... = A[2*i];
+;; for (long unsigned i = 0; i < 7; i++) {
+;; A[-10] = i;
+;; *B++ = A[2*i];
define void @weakzerosrc5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
br label %for.body
-for.body: ; preds = %for.body, %entry
+; CHECK: da analyze - consistent output [S]!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body: ; preds = %entry, %for.body
%i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
%conv = trunc i64 %i.02 to i32
@@ -170,43 +213,54 @@ for.body: ; preds = %for.body, %entry
%mul = shl i64 %i.02, 1
%arrayidx1 = getelementptr inbounds i32* %A, i64 %mul
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.01, i64 1
store i32 %0, i32* %B.addr.01, align 4
%inc = add i64 %i.02, 1
- %cmp = icmp ult i64 %inc, 7
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, 7
+ br i1 %exitcond, label %for.body, label %for.end
for.end: ; preds = %for.body
ret void
}
-;; for (long unsigned i = 0; i < n; i++)
-;; A[10] = ...
-;; ... = A[3*i];
+;; for (long unsigned i = 0; i < n; i++) {
+;; A[10] = i;
+;; *B++ = A[3*i];
define void @weakzerosrc6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%cmp1 = icmp eq i64 %n, 0
- br i1 %cmp1, label %for.end, label %for.body
+ br i1 %cmp1, label %for.end, label %for.body.preheader
+
+; CHECK: da analyze - consistent output [S]!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
+for.body.preheader: ; preds = %entry
+ br label %for.body
-for.body: ; preds = %for.body, %entry
- %i.03 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
- %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
+for.body: ; preds = %for.body.preheader, %for.body
+ %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
+ %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
%conv = trunc i64 %i.03 to i32
%arrayidx = getelementptr inbounds i32* %A, i64 10
store i32 %conv, i32* %arrayidx, align 4
%mul = mul i64 %i.03, 3
%arrayidx1 = getelementptr inbounds i32* %A, i64 %mul
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - none!
%incdec.ptr = getelementptr inbounds i32* %B.addr.02, i64 1
store i32 %0, i32* %B.addr.02, align 4
%inc = add i64 %i.03, 1
- %cmp = icmp ult i64 %inc, %n
- br i1 %cmp, label %for.body, label %for.end
+ %exitcond = icmp ne i64 %inc, %n
+ br i1 %exitcond, label %for.body, label %for.end.loopexit
+
+for.end.loopexit: ; preds = %for.body
+ br label %for.end
-for.end: ; preds = %for.body, %entry
+for.end: ; preds = %for.end.loopexit, %entry
ret void
}
diff --git a/test/Analysis/DependenceAnalysis/ZIV.ll b/test/Analysis/DependenceAnalysis/ZIV.ll
index 42b2389df268..5463c63ba3fb 100644
--- a/test/Analysis/DependenceAnalysis/ZIV.ll
+++ b/test/Analysis/DependenceAnalysis/ZIV.ll
@@ -5,49 +5,70 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-apple-macosx10.6.0"
-;; A[n + 1] = ...
-;; ... = A[1 + n];
+;; A[n + 1] = 0;
+;; *B = A[1 + n];
define void @z0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%add = add i64 %n, 1
%arrayidx = getelementptr inbounds i32* %A, i64 %add
store i32 0, i32* %arrayidx, align 4
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - consistent flow [|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
%add1 = add i64 %n, 1
%arrayidx2 = getelementptr inbounds i32* %A, i64 %add1
%0 = load i32* %arrayidx2, align 4
-; CHECK: da analyze - consistent flow!
store i32 %0, i32* %B, align 4
ret void
}
-;; A[n] = ...
-;; ... = A[n + 1];
+;; A[n] = 0;
+;; *B = A[n + 1];
define void @z1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
entry:
%arrayidx = getelementptr inbounds i32* %A, i64 %n
store i32 0, i32* %arrayidx, align 4
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
%add = add i64 %n, 1
%arrayidx1 = getelementptr inbounds i32* %A, i64 %add
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - none!
store i32 %0, i32* %B, align 4
ret void
}
-;; A[n] = ...
-;; ... = A[m];
+;; A[n] = 0;
+;; *B = A[m];
define void @z2(i32* %A, i32* %B, i64 %n, i64 %m) nounwind uwtable ssp {
entry:
%arrayidx = getelementptr inbounds i32* %A, i64 %n
store i32 0, i32* %arrayidx, align 4
+
+; CHECK: da analyze - none!
+; CHECK: da analyze - flow [|<]!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+; CHECK: da analyze - confused!
+; CHECK: da analyze - none!
+
%arrayidx1 = getelementptr inbounds i32* %A, i64 %m
%0 = load i32* %arrayidx1, align 4
-; CHECK: da analyze - flow!
store i32 %0, i32* %B, align 4
ret void
}
diff --git a/test/Analysis/Dominators/invoke.ll b/test/Analysis/Dominators/invoke.ll
index f935750c987e..da0b2461656c 100644
--- a/test/Analysis/Dominators/invoke.ll
+++ b/test/Analysis/Dominators/invoke.ll
@@ -1,4 +1,4 @@
-; RUN: opt -verify -disable-output %s
+; RUN: opt -verify -disable-output < %s
; This tests that we handle unreachable blocks correctly
define void @f() {
diff --git a/test/Analysis/Profiling/lit.local.cfg b/test/Analysis/Profiling/lit.local.cfg
index 19eebc0ac7ac..444b7dc27410 100644
--- a/test/Analysis/Profiling/lit.local.cfg
+++ b/test/Analysis/Profiling/lit.local.cfg
@@ -1 +1,16 @@
config.suffixes = ['.ll', '.c', '.cpp']
+
+def getRoot(config):
+ if not config.parent:
+ return config
+ return getRoot(config.parent)
+
+root = getRoot(config)
+
+# Most profiling tests rely on a JIT being present to gather their data; AArch64
+# doesn't have any JIT at present so they will fail when run there.
+if root.host_arch in ['AArch64']:
+ config.unsupported = True
+
+if 'hexagon' in root.target_triple:
+ config.unsupported = True
diff --git a/test/Analysis/RegionInfo/20100809_bb_not_in_domtree.ll b/test/Analysis/RegionInfo/20100809_bb_not_in_domtree.ll
index 218b4375f70c..0dfa0bf9cd8d 100644
--- a/test/Analysis/RegionInfo/20100809_bb_not_in_domtree.ll
+++ b/test/Analysis/RegionInfo/20100809_bb_not_in_domtree.ll
@@ -1,4 +1,4 @@
-; RUN: opt -regions %s
+; RUN: opt -regions < %s
define i32 @main() nounwind {
entry:
br label %for.cond
diff --git a/test/Analysis/RegionInfo/block_sort.ll b/test/Analysis/RegionInfo/block_sort.ll
index ac77ab36e6f5..d7ef79cf6b55 100644
--- a/test/Analysis/RegionInfo/block_sort.ll
+++ b/test/Analysis/RegionInfo/block_sort.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats -analyze < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/cond_loop.ll b/test/Analysis/RegionInfo/cond_loop.ll
index 1145ffdba039..0da4e5dca3d3 100644
--- a/test/Analysis/RegionInfo/cond_loop.ll
+++ b/test/Analysis/RegionInfo/cond_loop.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/condition_complicated.ll b/test/Analysis/RegionInfo/condition_complicated.ll
index 6b398800db9c..53f13c10eaf3 100644
--- a/test/Analysis/RegionInfo/condition_complicated.ll
+++ b/test/Analysis/RegionInfo/condition_complicated.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/condition_complicated_2.ll b/test/Analysis/RegionInfo/condition_complicated_2.ll
index f551108d6083..fd04afc20dca 100644
--- a/test/Analysis/RegionInfo/condition_complicated_2.ll
+++ b/test/Analysis/RegionInfo/condition_complicated_2.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/condition_forward_edge.ll b/test/Analysis/RegionInfo/condition_forward_edge.ll
index 5e4d9d2f8b23..88c45c2e6efd 100644
--- a/test/Analysis/RegionInfo/condition_forward_edge.ll
+++ b/test/Analysis/RegionInfo/condition_forward_edge.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/condition_same_exit.ll b/test/Analysis/RegionInfo/condition_same_exit.ll
index e48413a4c2dd..bfb0df84b44d 100644
--- a/test/Analysis/RegionInfo/condition_same_exit.ll
+++ b/test/Analysis/RegionInfo/condition_same_exit.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/condition_simple.ll b/test/Analysis/RegionInfo/condition_simple.ll
index 00d9ed24e17d..3f93a6ecd358 100644
--- a/test/Analysis/RegionInfo/condition_simple.ll
+++ b/test/Analysis/RegionInfo/condition_simple.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/exit_in_condition.ll b/test/Analysis/RegionInfo/exit_in_condition.ll
index b84abecc1649..ac409ec1bb25 100644
--- a/test/Analysis/RegionInfo/exit_in_condition.ll
+++ b/test/Analysis/RegionInfo/exit_in_condition.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/infinite_loop.ll b/test/Analysis/RegionInfo/infinite_loop.ll
index 8e588286a58a..61abef8ff7a9 100644
--- a/test/Analysis/RegionInfo/infinite_loop.ll
+++ b/test/Analysis/RegionInfo/infinite_loop.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
diff --git a/test/Analysis/RegionInfo/infinite_loop_2.ll b/test/Analysis/RegionInfo/infinite_loop_2.ll
index a8227e340c5e..56e83cfdebb9 100644
--- a/test/Analysis/RegionInfo/infinite_loop_2.ll
+++ b/test/Analysis/RegionInfo/infinite_loop_2.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/infinite_loop_3.ll b/test/Analysis/RegionInfo/infinite_loop_3.ll
index b09c9c1e5919..4538f0f78587 100644
--- a/test/Analysis/RegionInfo/infinite_loop_3.ll
+++ b/test/Analysis/RegionInfo/infinite_loop_3.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
diff --git a/test/Analysis/RegionInfo/infinite_loop_4.ll b/test/Analysis/RegionInfo/infinite_loop_4.ll
index 681c305ce971..4ac9068f0dd8 100644
--- a/test/Analysis/RegionInfo/infinite_loop_4.ll
+++ b/test/Analysis/RegionInfo/infinite_loop_4.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/loop_with_condition.ll b/test/Analysis/RegionInfo/loop_with_condition.ll
index 08d2ba8e35a9..4c1c8654ca4f 100644
--- a/test/Analysis/RegionInfo/loop_with_condition.ll
+++ b/test/Analysis/RegionInfo/loop_with_condition.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
diff --git a/test/Analysis/RegionInfo/loops_1.ll b/test/Analysis/RegionInfo/loops_1.ll
index 6449949df843..9efe619ad9d7 100644
--- a/test/Analysis/RegionInfo/loops_1.ll
+++ b/test/Analysis/RegionInfo/loops_1.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/loops_2.ll b/test/Analysis/RegionInfo/loops_2.ll
index dc4a1adffbac..ca7eca75affd 100644
--- a/test/Analysis/RegionInfo/loops_2.ll
+++ b/test/Analysis/RegionInfo/loops_2.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/mix_1.ll b/test/Analysis/RegionInfo/mix_1.ll
index 1474e033e574..55001c7f435c 100644
--- a/test/Analysis/RegionInfo/mix_1.ll
+++ b/test/Analysis/RegionInfo/mix_1.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
diff --git a/test/Analysis/RegionInfo/nested_loops.ll b/test/Analysis/RegionInfo/nested_loops.ll
index a3707a19872f..3e73b3a328f6 100644
--- a/test/Analysis/RegionInfo/nested_loops.ll
+++ b/test/Analysis/RegionInfo/nested_loops.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
diff --git a/test/Analysis/RegionInfo/next.ll b/test/Analysis/RegionInfo/next.ll
index 890b4f23001e..b22bbcc2b6d5 100644
--- a/test/Analysis/RegionInfo/next.ll
+++ b/test/Analysis/RegionInfo/next.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/paper.ll b/test/Analysis/RegionInfo/paper.ll
index 96c87e0559b4..0398d2baa225 100644
--- a/test/Analysis/RegionInfo/paper.ll
+++ b/test/Analysis/RegionInfo/paper.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/RegionInfo/two_loops_same_header.ll b/test/Analysis/RegionInfo/two_loops_same_header.ll
index e75661e8905b..25713420a3b7 100644
--- a/test/Analysis/RegionInfo/two_loops_same_header.ll
+++ b/test/Analysis/RegionInfo/two_loops_same_header.ll
@@ -1,3 +1,4 @@
+; REQUIRES: asserts
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt -regions -stats < %s 2>&1 | FileCheck -check-prefix=STAT %s
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
diff --git a/test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll b/test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll
index aba0ce74678f..5a0239810418 100644
--- a/test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll
+++ b/test/Analysis/ScalarEvolution/2010-09-03-RequiredTransitive.ll
@@ -1,8 +1,10 @@
-; RUN: opt -indvars -scalar-evolution -analyze %s
+; RUN: opt -indvars -scalar-evolution -analyze < %s | FileCheck %s
; This test checks if the SCEV analysis is printed out at all.
; It failed once as the RequiredTransitive option was not implemented
; correctly.
+; CHECK: Classifying expressions for: @main
+
define i32 @main() nounwind {
entry:
br label %for.cond
diff --git a/test/Analysis/ScalarEvolution/2011-03-09-ExactNoMaxBECount.ll b/test/Analysis/ScalarEvolution/2011-03-09-ExactNoMaxBECount.ll
index 9f17e27577c2..49e944dcd266 100644
--- a/test/Analysis/ScalarEvolution/2011-03-09-ExactNoMaxBECount.ll
+++ b/test/Analysis/ScalarEvolution/2011-03-09-ExactNoMaxBECount.ll
@@ -1,4 +1,4 @@
-; RUN: opt -indvars %s
+; RUN: opt -indvars < %s
; PR9424: Attempt to use a SCEVCouldNotCompute object!
; The inner loop computes the Step and Start of the outer loop.
; Call that Vexit. The outer End value is max(2,Vexit), because
diff --git a/test/Analysis/ScalarEvolution/fold.ll b/test/Analysis/ScalarEvolution/fold.ll
index 4e2adf187e8b..57006dd9bb42 100644
--- a/test/Analysis/ScalarEvolution/fold.ll
+++ b/test/Analysis/ScalarEvolution/fold.ll
@@ -1,4 +1,4 @@
-; RUN: opt -analyze -scalar-evolution %s -S | FileCheck %s
+; RUN: opt -analyze -scalar-evolution -S < %s | FileCheck %s
define i16 @test1(i8 %x) {
%A = zext i8 %x to i12
diff --git a/test/Analysis/ScalarEvolution/scev-invalid.ll b/test/Analysis/ScalarEvolution/scev-invalid.ll
new file mode 100644
index 000000000000..aac0d319ae84
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/scev-invalid.ll
@@ -0,0 +1,34 @@
+; RUN: opt < %s -S -indvars -loop-unroll | FileCheck %s
+;
+; PR15570: SEGV: SCEV back-edge info invalid after dead code removal.
+;
+; Indvars creates a SCEV expression for the loop's back edge taken
+; count, then determines that the comparison is always true and
+; removes it.
+;
+; When loop-unroll asks for the expression, it contains a NULL
+; SCEVUnknkown (as a CallbackVH).
+;
+; forgetMemoizedResults should invalidate the backedge taken count expression.
+
+; CHECK: @test
+; CHECK-NOT: phi
+; CHECK-NOT: icmp
+; CHECK: ret void
+define void @test() {
+entry:
+ %xor1 = xor i32 0, 1
+ br label %b17
+
+b17:
+ br i1 undef, label %b22, label %b18
+
+b18:
+ %phi1 = phi i32 [ %add1, %b18 ], [ %xor1, %b17 ]
+ %add1 = add nsw i32 %phi1, -1
+ %cmp1 = icmp sgt i32 %add1, 0
+ br i1 %cmp1, label %b18, label %b22
+
+b22:
+ ret void
+}
diff --git a/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll b/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
index 1ac59278e7ea..c6cc26a24106 100644
--- a/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
+++ b/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
@@ -9,13 +9,13 @@
; invalid, as it's possible that this only happens after optimization on a
; code path which isn't ever executed.
-; CHECK: define void @test0_yes(i32* nocapture %p) nounwind readnone {
+; CHECK: define void @test0_yes(i32* nocapture %p) #0 {
define void @test0_yes(i32* %p) nounwind {
store i32 0, i32* %p, !tbaa !1
ret void
}
-; CHECK: define void @test0_no(i32* nocapture %p) nounwind {
+; CHECK: define void @test0_no(i32* nocapture %p) #1 {
define void @test0_no(i32* %p) nounwind {
store i32 0, i32* %p, !tbaa !2
ret void
@@ -24,13 +24,13 @@ define void @test0_no(i32* %p) nounwind {
; Add the readonly attribute, since there's just a call to a function which
; TBAA says doesn't modify any memory.
-; CHECK: define void @test1_yes(i32* nocapture %p) nounwind readonly {
+; CHECK: define void @test1_yes(i32* nocapture %p) #2 {
define void @test1_yes(i32* %p) nounwind {
call void @callee(i32* %p), !tbaa !1
ret void
}
-; CHECK: define void @test1_no(i32* %p) nounwind {
+; CHECK: define void @test1_no(i32* %p) #1 {
define void @test1_no(i32* %p) nounwind {
call void @callee(i32* %p), !tbaa !2
ret void
@@ -43,13 +43,13 @@ define void @test1_no(i32* %p) nounwind {
; This is unusual, since the function is memcpy, but as above, this
; isn't necessarily invalid.
-; CHECK: define void @test2_yes(i8* nocapture %p, i8* nocapture %q, i64 %n) nounwind readnone {
+; CHECK: define void @test2_yes(i8* nocapture %p, i8* nocapture %q, i64 %n) #0 {
define void @test2_yes(i8* %p, i8* %q, i64 %n) nounwind {
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i32 1, i1 false), !tbaa !1
ret void
}
-; CHECK: define void @test2_no(i8* nocapture %p, i8* nocapture %q, i64 %n) nounwind {
+; CHECK: define void @test2_no(i8* nocapture %p, i8* nocapture %q, i64 %n) #1 {
define void @test2_no(i8* %p, i8* %q, i64 %n) nounwind {
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %p, i8* %q, i64 %n, i32 1, i1 false), !tbaa !2
ret void
@@ -57,13 +57,13 @@ define void @test2_no(i8* %p, i8* %q, i64 %n) nounwind {
; Similar to the others, va_arg only accesses memory through its operand.
-; CHECK: define i32 @test3_yes(i8* nocapture %p) nounwind readnone {
+; CHECK: define i32 @test3_yes(i8* nocapture %p) #0 {
define i32 @test3_yes(i8* %p) nounwind {
%t = va_arg i8* %p, i32, !tbaa !1
ret i32 %t
}
-; CHECK: define i32 @test3_no(i8* nocapture %p) nounwind {
+; CHECK: define i32 @test3_no(i8* nocapture %p) #1 {
define i32 @test3_no(i8* %p) nounwind {
%t = va_arg i8* %p, i32, !tbaa !2
ret i32 %t
@@ -72,6 +72,10 @@ define i32 @test3_no(i8* %p) nounwind {
declare void @callee(i32* %p) nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64(i8*, i8*, i64, i32, i1) nounwind
+; CHECK: attributes #0 = { nounwind readnone }
+; CHECK: attributes #1 = { nounwind }
+; CHECK: attributes #2 = { nounwind readonly }
+
; Root note.
!0 = metadata !{ }
diff --git a/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll b/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll
index 8f080e2108bd..6f1c22da3ac5 100644
--- a/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll
+++ b/test/Analysis/TypeBasedAliasAnalysis/intrinsics.ll
@@ -7,7 +7,7 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-
; CHECK: define <8 x i16> @test0(i8* %p, i8* %q, <8 x i16> %y) {
; CHECK-NEXT: entry:
-; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) nounwind
+; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16(i8* %p, i32 16) [[NUW:#[0-9]+]]
; CHECK-NEXT: call void @llvm.arm.neon.vst1.v8i16(i8* %q, <8 x i16> %y, i32 16)
; CHECK-NEXT: %c = add <8 x i16> %a, %a
define <8 x i16> @test0(i8* %p, i8* %q, <8 x i16> %y) {
@@ -22,6 +22,9 @@ entry:
declare <8 x i16> @llvm.arm.neon.vld1.v8i16(i8*, i32) nounwind readonly
declare void @llvm.arm.neon.vst1.v8i16(i8*, <8 x i16>, i32) nounwind
+; CHECK: attributes #0 = { nounwind readonly }
+; CHECK: attributes [[NUW]] = { nounwind }
+
!0 = metadata !{metadata !"tbaa root", null}
!1 = metadata !{metadata !"A", metadata !0}
!2 = metadata !{metadata !"B", metadata !0}
diff --git a/test/Analysis/TypeBasedAliasAnalysis/placement-tbaa.ll b/test/Analysis/TypeBasedAliasAnalysis/placement-tbaa.ll
new file mode 100644
index 000000000000..f1edb4482cf1
--- /dev/null
+++ b/test/Analysis/TypeBasedAliasAnalysis/placement-tbaa.ll
@@ -0,0 +1,104 @@
+; RUN: opt < %s -tbaa -basicaa -aa-eval -evaluate-tbaa -print-no-aliases -print-may-aliases -disable-output 2>&1 | FileCheck %s
+
+; Generated with "clang -cc1 -disable-llvm-optzns -O1 -emit-llvm"
+; #include <new>
+; struct Foo { long i; };
+; struct Bar { void *p; };
+; long foo(int n) {
+; Foo *f = new Foo;
+; f->i = 1;
+; for (int i=0; i<n; ++i) {
+; Bar *b = new (f) Bar;
+; b->p = 0;
+; f = new (f) Foo;
+; f->i = i;
+; }
+; return f->i;
+; }
+
+; Basic AA says MayAlias, TBAA says NoAlias
+; CHECK: MayAlias: i64* %i5, i8** %p
+; CHECK: NoAlias: store i64 %conv, i64* %i5, align 8, !tbaa !4 <-> store i8* null, i8** %p, align 8, !tbaa !3
+
+%struct.Foo = type { i64 }
+%struct.Bar = type { i8* }
+
+define i64 @_Z3fooi(i32 %n) #0 {
+entry:
+ %n.addr = alloca i32, align 4
+ %f = alloca %struct.Foo*, align 8
+ %i1 = alloca i32, align 4
+ %b = alloca %struct.Bar*, align 8
+ store i32 %n, i32* %n.addr, align 4, !tbaa !0
+ %call = call noalias i8* @_Znwm(i64 8)
+ %0 = bitcast i8* %call to %struct.Foo*
+ store %struct.Foo* %0, %struct.Foo** %f, align 8, !tbaa !3
+ %1 = load %struct.Foo** %f, align 8, !tbaa !3
+ %i = getelementptr inbounds %struct.Foo* %1, i32 0, i32 0
+ store i64 1, i64* %i, align 8, !tbaa !4
+ store i32 0, i32* %i1, align 4, !tbaa !0
+ br label %for.cond
+
+for.cond:
+ %2 = load i32* %i1, align 4, !tbaa !0
+ %3 = load i32* %n.addr, align 4, !tbaa !0
+ %cmp = icmp slt i32 %2, %3
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body:
+ %4 = load %struct.Foo** %f, align 8, !tbaa !3
+ %5 = bitcast %struct.Foo* %4 to i8*
+ %new.isnull = icmp eq i8* %5, null
+ br i1 %new.isnull, label %new.cont, label %new.notnull
+
+new.notnull:
+ %6 = bitcast i8* %5 to %struct.Bar*
+ br label %new.cont
+
+new.cont:
+ %7 = phi %struct.Bar* [ %6, %new.notnull ], [ null, %for.body ]
+ store %struct.Bar* %7, %struct.Bar** %b, align 8, !tbaa !3
+ %8 = load %struct.Bar** %b, align 8, !tbaa !3
+ %p = getelementptr inbounds %struct.Bar* %8, i32 0, i32 0
+ store i8* null, i8** %p, align 8, !tbaa !3
+ %9 = load %struct.Foo** %f, align 8, !tbaa !3
+ %10 = bitcast %struct.Foo* %9 to i8*
+ %new.isnull2 = icmp eq i8* %10, null
+ br i1 %new.isnull2, label %new.cont4, label %new.notnull3
+
+new.notnull3:
+ %11 = bitcast i8* %10 to %struct.Foo*
+ br label %new.cont4
+
+new.cont4:
+ %12 = phi %struct.Foo* [ %11, %new.notnull3 ], [ null, %new.cont ]
+ store %struct.Foo* %12, %struct.Foo** %f, align 8, !tbaa !3
+ %13 = load i32* %i1, align 4, !tbaa !0
+ %conv = sext i32 %13 to i64
+ %14 = load %struct.Foo** %f, align 8, !tbaa !3
+ %i5 = getelementptr inbounds %struct.Foo* %14, i32 0, i32 0
+ store i64 %conv, i64* %i5, align 8, !tbaa !4
+ br label %for.inc
+
+for.inc:
+ %15 = load i32* %i1, align 4, !tbaa !0
+ %inc = add nsw i32 %15, 1
+ store i32 %inc, i32* %i1, align 4, !tbaa !0
+ br label %for.cond
+
+for.end:
+ %16 = load %struct.Foo** %f, align 8, !tbaa !3
+ %i6 = getelementptr inbounds %struct.Foo* %16, i32 0, i32 0
+ %17 = load i64* %i6, align 8, !tbaa !4
+ ret i64 %17
+}
+
+declare noalias i8* @_Znwm(i64)
+
+attributes #0 = { nounwind }
+
+!0 = metadata !{metadata !"int", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA"}
+!3 = metadata !{metadata !"any pointer", metadata !1}
+!4 = metadata !{metadata !"long", metadata !1}