aboutsummaryrefslogtreecommitdiffstats
path: root/test/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/GlobalsModRef/pr12351.ll33
-rw-r--r--test/Analysis/ScalarEvolution/2012-03-26-LoadConstant.ll47
-rw-r--r--test/Analysis/ScalarEvolution/avoid-smax-1.ll20
3 files changed, 89 insertions, 11 deletions
diff --git a/test/Analysis/GlobalsModRef/pr12351.ll b/test/Analysis/GlobalsModRef/pr12351.ll
new file mode 100644
index 0000000..1c5ac43
--- /dev/null
+++ b/test/Analysis/GlobalsModRef/pr12351.ll
@@ -0,0 +1,33 @@
+; RUN: opt < %s -basicaa -globalsmodref-aa -gvn -S | FileCheck %s
+
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
+define void @foo(i8* %x, i8* %y) {
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %x, i8* %y, i32 1, i32 1, i1 false);
+ ret void
+}
+
+define void @bar(i8* %y, i8* %z) {
+ %x = alloca i8
+ call void @foo(i8* %x, i8* %y)
+ %t = load i8* %x
+ store i8 %t, i8* %y
+; CHECK: store i8 %t, i8* %y
+ ret void
+}
+
+
+define i32 @foo2() {
+ %foo = alloca i32
+ call void @bar2(i32* %foo)
+ %t0 = load i32* %foo, align 4
+; CHECK: %t0 = load i32* %foo, align 4
+ ret i32 %t0
+}
+
+define void @bar2(i32* %foo) {
+ store i32 0, i32* %foo, align 4
+ tail call void @llvm.dbg.value(metadata !{}, i64 0, metadata !{})
+ ret void
+}
+
+declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
diff --git a/test/Analysis/ScalarEvolution/2012-03-26-LoadConstant.ll b/test/Analysis/ScalarEvolution/2012-03-26-LoadConstant.ll
new file mode 100644
index 0000000..138c015
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/2012-03-26-LoadConstant.ll
@@ -0,0 +1,47 @@
+; RUN: opt < %s -basicaa -globalopt -instcombine -loop-rotate -licm -instcombine -indvars -loop-deletion -constmerge -S
+; PR11882: ComputeLoadConstantCompareExitLimit crash.
+;
+; for.body is deleted leaving a loop-invariant load.
+; CHECK-NOT: for.body
+target datalayout = "e-p:64:64:64-n32:64"
+
+@func_21_l_773 = external global i32, align 4
+@g_814 = external global i32, align 4
+@g_244 = internal global [1 x [0 x i32]] zeroinitializer, align 4
+
+define void @func_21() nounwind uwtable ssp {
+entry:
+ br label %lbl_818
+
+lbl_818: ; preds = %for.end, %entry
+ call void (...)* @func_27()
+ store i32 0, i32* @g_814, align 4, !tbaa !0
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %lbl_818
+ %0 = load i32* @g_814, align 4, !tbaa !0
+ %cmp = icmp sle i32 %0, 0
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %idxprom = sext i32 %0 to i64
+ %arrayidx = getelementptr inbounds [0 x i32]* getelementptr inbounds ([1 x [0 x i32]]* @g_244, i32 0, i64 0), i32 0, i64 %idxprom
+ %1 = load i32* %arrayidx, align 1, !tbaa !0
+ store i32 %1, i32* @func_21_l_773, align 4, !tbaa !0
+ store i32 1, i32* @g_814, align 4, !tbaa !0
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ %2 = load i32* @func_21_l_773, align 4, !tbaa !0
+ %tobool = icmp ne i32 %2, 0
+ br i1 %tobool, label %lbl_818, label %if.end
+
+if.end: ; preds = %for.end
+ ret void
+}
+
+declare void @func_27(...)
+
+!0 = metadata !{metadata !"int", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
diff --git a/test/Analysis/ScalarEvolution/avoid-smax-1.ll b/test/Analysis/ScalarEvolution/avoid-smax-1.ll
index e90a555..d9b83a9 100644
--- a/test/Analysis/ScalarEvolution/avoid-smax-1.ll
+++ b/test/Analysis/ScalarEvolution/avoid-smax-1.ll
@@ -1,14 +1,12 @@
-; RUN: opt < %s -indvars -S -enable-iv-rewrite | FileCheck %s
-
-; Indvars should be able to insert a canonical induction variable
-; for the bb6 loop without using a maximum calculation (icmp, select)
-; because it should be able to prove that the comparison is guarded
-; by an appropriate conditional branch. Unfortunately, indvars is
-; not yet able to find the comparison for the other two loops in
-; this testcase.
-; CHECK: entry:
-; CHECK-NOT: select
-; CHECK: bb6:
+; RUN: opt < %s -analyze -scalar-evolution -S | FileCheck %s
+
+; Indvars should be able to find the trip count for the bb6 loop
+; without using a maximum calculation (icmp, select) because it should
+; be able to prove that the comparison is guarded by an appropriate
+; conditional branch. Unfortunately, indvars is not yet able to find
+; the comparison for the other two loops in this testcase.
+;
+; CHECK: Loop %bb6: backedge-taken count is (-1 + %w)
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin9"