aboutsummaryrefslogtreecommitdiffstats
path: root/test/Analysis
diff options
context:
space:
mode:
authorDan Gohman <djg@cray.com>2007-07-18 16:29:46 +0000
committerDan Gohman <djg@cray.com>2007-07-18 16:29:46 +0000
commitf17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc (patch)
treeebb79ea1ee5e3bc1fdf38541a811a8b804f0679a /test/Analysis
downloadexternal_llvm-f17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc.zip
external_llvm-f17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc.tar.gz
external_llvm-f17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc.tar.bz2
It's not necessary to do rounding for alloca operations when the requested
alignment is equal to the stack alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40004 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/Andersens/arg-must-alias.ll17
-rw-r--r--test/Analysis/Andersens/basictest.ll30
-rw-r--r--test/Analysis/Andersens/dg.exp4
-rw-r--r--test/Analysis/Andersens/external.ll22
-rw-r--r--test/Analysis/Andersens/modreftest.ll15
-rw-r--r--test/Analysis/Andersens/trivialtest.ll3
-rw-r--r--test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll18
-rw-r--r--test/Analysis/BasicAA/2003-03-04-GEPCrash.ll7
-rw-r--r--test/Analysis/BasicAA/2003-04-22-GEPProblem.ll15
-rw-r--r--test/Analysis/BasicAA/2003-04-25-GEPCrash.ll7
-rw-r--r--test/Analysis/BasicAA/2003-05-21-GEP-Problem.ll21
-rw-r--r--test/Analysis/BasicAA/2003-06-01-AliasCrash.ll11
-rw-r--r--test/Analysis/BasicAA/2003-07-03-BasicAACrash.ll12
-rw-r--r--test/Analysis/BasicAA/2003-09-19-LocalArgument.ll12
-rw-r--r--test/Analysis/BasicAA/2003-11-04-SimpleCases.ll16
-rw-r--r--test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll18
-rw-r--r--test/Analysis/BasicAA/2004-01-29-InvariantMemory.llx13
-rw-r--r--test/Analysis/BasicAA/2004-07-28-MustAliasbug.llx10
-rw-r--r--test/Analysis/BasicAA/2004-12-08-BasicAACrash.ll24
-rw-r--r--test/Analysis/BasicAA/2004-12-08-BasicAACrash2.ll22
-rw-r--r--test/Analysis/BasicAA/2005-03-09-BrokenBasicAA.ll15
-rw-r--r--test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll32
-rw-r--r--test/Analysis/BasicAA/2006-11-03-BasicAAVectorCrash.ll51
-rw-r--r--test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll35
-rw-r--r--test/Analysis/BasicAA/dg.exp3
-rw-r--r--test/Analysis/BasicAA/featuretest.ll85
-rw-r--r--test/Analysis/BasicAA/gcsetest.ll46
-rw-r--r--test/Analysis/BasicAA/global-size.ll17
-rw-r--r--test/Analysis/BasicAA/licmtest.ll42
-rw-r--r--test/Analysis/BasicAA/modref.ll16
-rw-r--r--test/Analysis/BasicAA/tailcall-modref.ll17
-rw-r--r--test/Analysis/Dominators/2006-09-26-PostDominanceFrontier.ll102
-rw-r--r--test/Analysis/Dominators/2006-10-02-BreakCritEdges.ll21
-rw-r--r--test/Analysis/Dominators/2007-01-14-BreakCritEdges.ll187
-rw-r--r--test/Analysis/Dominators/2007-04-17-PostDominanceFrontier.ll692
-rw-r--r--test/Analysis/Dominators/2007-04-20-PostDom-Reset.ll28
-rw-r--r--test/Analysis/Dominators/dg.exp3
-rw-r--r--test/Analysis/GlobalsModRef/aliastest.ll9
-rw-r--r--test/Analysis/GlobalsModRef/chaining-analysis.ll20
-rw-r--r--test/Analysis/GlobalsModRef/dg.exp3
-rw-r--r--test/Analysis/GlobalsModRef/indirect-global.ll26
-rw-r--r--test/Analysis/GlobalsModRef/modreftest.ll13
-rw-r--r--test/Analysis/GlobalsModRef/purecse.ll23
-rw-r--r--test/Analysis/LoadVN/RLE-Eliminate.ll23
-rw-r--r--test/Analysis/LoadVN/RLE-Preserve-Volatile.ll9
-rw-r--r--test/Analysis/LoadVN/RLE-Preserve.ll25
-rw-r--r--test/Analysis/LoadVN/call_cse.ll11
-rw-r--r--test/Analysis/LoadVN/call_pure_function.ll13
-rw-r--r--test/Analysis/LoadVN/casts.ll13
-rw-r--r--test/Analysis/LoadVN/dependent_loads.ll27
-rw-r--r--test/Analysis/LoadVN/dg.exp3
-rw-r--r--test/Analysis/LoadVN/undefined_load.ll14
-rw-r--r--test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll30
-rw-r--r--test/Analysis/LoopInfo/dg.exp3
-rw-r--r--test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll20
-rw-r--r--test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll32
-rw-r--r--test/Analysis/ScalarEvolution/dg.exp3
-rw-r--r--test/Analysis/ScalarEvolution/trip-count.ll29
-rw-r--r--test/Analysis/ScalarEvolution/trip-count2.ll35
59 files changed, 2073 insertions, 0 deletions
diff --git a/test/Analysis/Andersens/arg-must-alias.ll b/test/Analysis/Andersens/arg-must-alias.ll
new file mode 100644
index 0000000..d19b381
--- /dev/null
+++ b/test/Analysis/Andersens/arg-must-alias.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -anders-aa -load-vn -gcse -deadargelim | llvm-dis | not grep ARG
+
+%G = internal constant int* null
+
+implementation
+
+internal int %internal(int* %ARG) {
+ ;; The 'Arg' argument must-aliases the null pointer, so it can be subsituted
+ ;; directly here, making it dead.
+ store int* %ARG, int** %G
+ ret int 0
+}
+
+int %foo() {
+ %V = call int %internal(int* null)
+ ret int %V
+}
diff --git a/test/Analysis/Andersens/basictest.ll b/test/Analysis/Andersens/basictest.ll
new file mode 100644
index 0000000..5730f75
--- /dev/null
+++ b/test/Analysis/Andersens/basictest.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -anders-aa -aa-eval
+
+implementation
+
+void %test1() {
+ %X = malloc int*
+ %Y = malloc int
+ %Z = cast int* %Y to int
+ %W = cast int %Z to int*
+ store int* %W, int** %X
+ ret void
+}
+
+void %test2(int* %P) {
+ %X = malloc int*
+ %Y = malloc int
+ store int* %P, int** %X
+ ret void
+}
+
+internal int *%test3(int* %P) {
+ ret int* %P
+}
+
+void %test4() {
+ %X = malloc int
+ %Y = call int* %test3(int* %X)
+ %ZZ = getelementptr int* null, int 17
+ ret void
+}
diff --git a/test/Analysis/Andersens/dg.exp b/test/Analysis/Andersens/dg.exp
new file mode 100644
index 0000000..a40d51c
--- /dev/null
+++ b/test/Analysis/Andersens/dg.exp
@@ -0,0 +1,4 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
+
diff --git a/test/Analysis/Andersens/external.ll b/test/Analysis/Andersens/external.ll
new file mode 100644
index 0000000..a829999
--- /dev/null
+++ b/test/Analysis/Andersens/external.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -anders-aa -load-vn -gcse -deadargelim | llvm-dis | grep store | not grep null
+
+; Because the 'internal' function is passed to an external function, we don't
+; know what the incoming values will alias. As such, we cannot do the
+; optimization checked by the 'arg-must-alias.llx' test.
+
+declare void %external(int(int*)*)
+%G = internal constant int* null
+
+implementation
+
+internal int %internal(int* %ARG) {
+ ;;; We *DON'T* know that ARG always points to null!
+ store int* %ARG, int** %G
+ ret int 0
+}
+
+int %foo() {
+ call void %external(int(int*)* %internal)
+ %V = call int %internal(int* null)
+ ret int %V
+}
diff --git a/test/Analysis/Andersens/modreftest.ll b/test/Analysis/Andersens/modreftest.ll
new file mode 100644
index 0000000..0716614
--- /dev/null
+++ b/test/Analysis/Andersens/modreftest.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-upgrade < %s | llvm-as | \
+; RUN: opt -anders-aa -load-vn -gcse -instcombine | llvm-dis | \
+; RUN: grep {ret i1 true}
+
+%G = internal global int* null
+declare int *%ext()
+bool %bar() {
+ %V1 = load int** %G
+ %X2 = call int *%ext()
+ %V2 = load int** %G
+ store int* %X2, int** %G
+
+ %C = seteq int* %V1, %V2
+ ret bool %C
+}
diff --git a/test/Analysis/Andersens/trivialtest.ll b/test/Analysis/Andersens/trivialtest.ll
new file mode 100644
index 0000000..9e447d6
--- /dev/null
+++ b/test/Analysis/Andersens/trivialtest.ll
@@ -0,0 +1,3 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -anders-aa -disable-output
+
+void %foo() { ret void }
diff --git a/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll b/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll
new file mode 100644
index 0000000..cb2b27e
--- /dev/null
+++ b/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll
@@ -0,0 +1,18 @@
+; This testcase makes sure that size is taken to account when alias analysis
+; is performed. It is not legal to delete the second load instruction because
+; the value computed by the first load instruction is changed by the store.
+
+; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -instcombine | llvm-dis | grep DONOTREMOVE
+
+int %test() {
+ %A = alloca int
+ store int 0, int* %A
+ %X = load int* %A
+ %B = cast int* %A to sbyte*
+ %C = getelementptr sbyte* %B, long 1
+ store sbyte 1, sbyte* %C ; Aliases %A
+ %Y.DONOTREMOVE = load int* %A
+ %Z = sub int %X, %Y.DONOTREMOVE
+ ret int %Z
+}
+
diff --git a/test/Analysis/BasicAA/2003-03-04-GEPCrash.ll b/test/Analysis/BasicAA/2003-03-04-GEPCrash.ll
new file mode 100644
index 0000000..ee008a8
--- /dev/null
+++ b/test/Analysis/BasicAA/2003-03-04-GEPCrash.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -aa-eval -disable-output
+; Test for a bug in BasicAA which caused a crash when querying equality of P1&P2
+void %test({[2 x int],[2 x int]}* %A, long %X, long %Y) {
+ %P1 = getelementptr {[2 x int],[2 x int]}* %A, long 0, uint 0, long %X
+ %P2 = getelementptr {[2 x int],[2 x int]}* %A, long 0, uint 1, long %Y
+ ret void
+}
diff --git a/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll b/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll
new file mode 100644
index 0000000..ddadc8e
--- /dev/null
+++ b/test/Analysis/BasicAA/2003-04-22-GEPProblem.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -instcombine | llvm-dis | grep sub
+
+; BasicAA was incorrectly concluding that P1 and P2 didn't conflict!
+
+int %test(int *%Ptr, long %V) {
+ %P2 = getelementptr int* %Ptr, long 1
+ %P1 = getelementptr int* %Ptr, long %V
+ %X = load int* %P1
+ store int 5, int* %P2
+
+ %Y = load int* %P1
+
+ %Z = sub int %X, %Y
+ ret int %Z
+}
diff --git a/test/Analysis/BasicAA/2003-04-25-GEPCrash.ll b/test/Analysis/BasicAA/2003-04-25-GEPCrash.ll
new file mode 100644
index 0000000..7e39f13
--- /dev/null
+++ b/test/Analysis/BasicAA/2003-04-25-GEPCrash.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -aa-eval -disable-output
+; Test for a bug in BasicAA which caused a crash when querying equality of P1&P2
+void %test([17 x ushort]* %mask_bits) {
+ %P1 = getelementptr [17 x ushort]* %mask_bits, long 0, long 0
+ %P2 = getelementptr [17 x ushort]* %mask_bits, long 252645134, long 0
+ ret void
+}
diff --git a/test/Analysis/BasicAA/2003-05-21-GEP-Problem.ll b/test/Analysis/BasicAA/2003-05-21-GEP-Problem.ll
new file mode 100644
index 0000000..146fc54
--- /dev/null
+++ b/test/Analysis/BasicAA/2003-05-21-GEP-Problem.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -licm -disable-output
+ %struct..apr_array_header_t = type { int*, int, int, int, sbyte* }
+ %struct..apr_table_t = type { %struct..apr_array_header_t, uint, [32 x int], [32 x int] }
+
+void %table_reindex(%struct..apr_table_t* %t.1) { ; No predecessors!
+ br label %loopentry
+
+loopentry: ; preds = %0, %no_exit
+ %tmp.101 = getelementptr %struct..apr_table_t* %t.1, long 0, uint 0, uint 2
+ %tmp.11 = load int* %tmp.101 ; <int> [#uses=0]
+ br bool false, label %no_exit, label %UnifiedExitNode
+
+no_exit: ; preds = %loopentry
+ %tmp.25 = cast int 0 to long ; <long> [#uses=1]
+ %tmp.261 = getelementptr %struct..apr_table_t* %t.1, long 0, uint 3, long %tmp.25 ; <int*> [#uses=1]
+ store int 0, int* %tmp.261
+ br label %loopentry
+
+UnifiedExitNode: ; preds = %loopentry
+ ret void
+}
diff --git a/test/Analysis/BasicAA/2003-06-01-AliasCrash.ll b/test/Analysis/BasicAA/2003-06-01-AliasCrash.ll
new file mode 100644
index 0000000..772bca9
--- /dev/null
+++ b/test/Analysis/BasicAA/2003-06-01-AliasCrash.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -aa-eval -disable-output
+
+int %MTConcat([3 x int]* %a.1) {
+ %tmp.961 = getelementptr [3 x int]* %a.1, long 0, long 4
+ %tmp.97 = load int* %tmp.961
+ %tmp.119 = getelementptr [3 x int]* %a.1, long 1, long 0
+ %tmp.120 = load int* %tmp.119
+ %tmp.1541 = getelementptr [3 x int]* %a.1, long 0, long 4
+ %tmp.155 = load int* %tmp.1541
+ ret int 0
+}
diff --git a/test/Analysis/BasicAA/2003-07-03-BasicAACrash.ll b/test/Analysis/BasicAA/2003-07-03-BasicAACrash.ll
new file mode 100644
index 0000000..61f3957
--- /dev/null
+++ b/test/Analysis/BasicAA/2003-07-03-BasicAACrash.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -aa-eval -disable-output
+
+ %struct..RefPoint = type { int, { uint, ushort, ushort } }
+ %struct..RefRect = type { %struct..RefPoint, %struct..RefPoint }
+
+implementation ; Functions:
+
+uint %BMT_CommitPartDrawObj() {
+ %tmp.19111 = getelementptr %struct..RefRect* null, long 0, uint 0, uint 1, uint 2
+ %tmp.20311 = getelementptr %struct..RefRect* null, long 0, uint 1, uint 1, uint 2
+ ret uint 0
+}
diff --git a/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll b/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll
new file mode 100644
index 0000000..ee6ac9c
--- /dev/null
+++ b/test/Analysis/BasicAA/2003-09-19-LocalArgument.ll
@@ -0,0 +1,12 @@
+; In this test, a local alloca cannot alias an incoming argument.
+
+; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -instcombine | llvm-dis | not grep sub
+
+int %test(int* %P) {
+ %X = alloca int
+ %V1 = load int* %P
+ store int 0, int* %X
+ %V2 = load int* %P
+ %Diff = sub int %V1, %V2
+ ret int %Diff
+}
diff --git a/test/Analysis/BasicAA/2003-11-04-SimpleCases.ll b/test/Analysis/BasicAA/2003-11-04-SimpleCases.ll
new file mode 100644
index 0000000..1d122fd
--- /dev/null
+++ b/test/Analysis/BasicAA/2003-11-04-SimpleCases.ll
@@ -0,0 +1,16 @@
+; This testcase consists of alias relations which should be completely
+; resolvable by basicaa.
+
+; RUN: llvm-upgrade < %s | llvm-as | \
+; RUN: opt -aa-eval -print-may-aliases -disable-output |& not grep May:
+
+%T = type { uint, [10 x ubyte] }
+
+void %test(%T* %P) {
+ %A = getelementptr %T* %P, long 0
+ %B = getelementptr %T* %P, long 0, uint 0
+ %C = getelementptr %T* %P, long 0, uint 1
+ %D = getelementptr %T* %P, long 0, uint 1, long 0
+ %E = getelementptr %T* %P, long 0, uint 1, long 5
+ ret void
+}
diff --git a/test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll b/test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll
new file mode 100644
index 0000000..5f602b8
--- /dev/null
+++ b/test/Analysis/BasicAA/2003-12-11-ConstExprGEP.ll
@@ -0,0 +1,18 @@
+; This testcase consists of alias relations which should be completely
+; resolvable by basicaa, but require analysis of getelementptr constant exprs.
+
+; RUN: llvm-upgrade < %s | llvm-as | \
+; RUN: opt -aa-eval -print-may-aliases -disable-output |& not grep May:
+
+%T = type { uint, [10 x ubyte] }
+
+%G = external global %T
+
+void %test() {
+ %D = getelementptr %T* %G, long 0, uint 0
+ %E = getelementptr %T* %G, long 0, uint 1, long 5
+ %F = getelementptr uint* getelementptr (%T* %G, long 0, uint 0), long 0
+ %X = getelementptr [10 x ubyte]* getelementptr (%T* %G, long 0, uint 1), long 0, long 5
+
+ ret void
+}
diff --git a/test/Analysis/BasicAA/2004-01-29-InvariantMemory.llx b/test/Analysis/BasicAA/2004-01-29-InvariantMemory.llx
new file mode 100644
index 0000000..c8c30f9
--- /dev/null
+++ b/test/Analysis/BasicAA/2004-01-29-InvariantMemory.llx
@@ -0,0 +1,13 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -instcombine | \
+; RUN: llvm-dis | not grep load
+
+%X = constant [2 x int] [int 4, int 5]
+
+int %test(int* %Y, long %idx) {
+ %P = getelementptr [2 x int]* %X, long 0, long %idx
+ %A = load int* %P ; Load from invariant memory
+ store int 4, int* %Y ; Store could not be to %X
+ %B = load int* %P
+ %C = sub int %A, %B
+ ret int %C
+}
diff --git a/test/Analysis/BasicAA/2004-07-28-MustAliasbug.llx b/test/Analysis/BasicAA/2004-07-28-MustAliasbug.llx
new file mode 100644
index 0000000..65bc21a
--- /dev/null
+++ b/test/Analysis/BasicAA/2004-07-28-MustAliasbug.llx
@@ -0,0 +1,10 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -dse | llvm-dis | grep {store i32 0}
+
+void %test({int,int }* %P) {
+ %Q = getelementptr {int,int}* %P, int 1
+ %X = getelementptr {int,int}* %Q, int 0, uint 1
+ %Y = getelementptr {int,int}* %Q, int 1, uint 1
+ store int 0, int* %X
+ store int 1, int* %Y
+ ret void
+}
diff --git a/test/Analysis/BasicAA/2004-12-08-BasicAACrash.ll b/test/Analysis/BasicAA/2004-12-08-BasicAACrash.ll
new file mode 100644
index 0000000..2539c45
--- /dev/null
+++ b/test/Analysis/BasicAA/2004-12-08-BasicAACrash.ll
@@ -0,0 +1,24 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -licm
+
+"java/lang/Object" = type { %struct.llvm_java_object_base }
+ "java/lang/StringBuffer" = type { "java/lang/Object", int, { "java/lang/Object", uint, [0 x ushort] }*, bool }
+ %struct.llvm_java_object_base = type opaque
+
+implementation ; Functions:
+
+void "java/lang/StringBuffer/setLength(I)V"(%struct.llvm_java_object_base*) {
+bc0:
+ br bool false, label %bc40, label %bc65
+
+bc65: ; preds = %bc0, %bc40
+ ret void
+
+bc40: ; preds = %bc0, %bc40
+ %tmp75 = cast %struct.llvm_java_object_base* %0 to "java/lang/StringBuffer"* ; <"java/lang/StringBuffer"*> [#uses=1]
+ %tmp76 = getelementptr "java/lang/StringBuffer"* %tmp75, int 0, uint 1 ; <int*> [#uses=1]
+ store int 0, int* %tmp76
+ %tmp381 = cast %struct.llvm_java_object_base* %0 to "java/lang/StringBuffer"* ; <"java/lang/StringBuffer"*> [#uses=1]
+ %tmp392 = getelementptr "java/lang/StringBuffer"* %tmp381, int 0, uint 1 ; <int*> [#uses=1]
+ %tmp403 = load int* %tmp392 ; <int> [#uses=0]
+ br bool false, label %bc40, label %bc65
+}
diff --git a/test/Analysis/BasicAA/2004-12-08-BasicAACrash2.ll b/test/Analysis/BasicAA/2004-12-08-BasicAACrash2.ll
new file mode 100644
index 0000000..d5d16d8
--- /dev/null
+++ b/test/Analysis/BasicAA/2004-12-08-BasicAACrash2.ll
@@ -0,0 +1,22 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -dse
+
+"java/lang/Object" = type { %struct.llvm_java_object_base }
+ "java/lang/StringBuffer" = type { "java/lang/Object", int, { "java/lang/Object", uint, [0 x ushort] }*, bool }
+ %struct.llvm_java_object_base = type opaque
+
+implementation ; Functions:
+
+void "java/lang/StringBuffer/ensureCapacity_unsynchronized(I)V"() {
+bc0:
+ %tmp = getelementptr "java/lang/StringBuffer"* null, int 0, uint 3 ; <bool*> [#uses=1]
+ br bool false, label %bc16, label %bc7
+
+bc16: ; preds = %bc0
+ %tmp91 = getelementptr "java/lang/StringBuffer"* null, int 0, uint 2 ; <{ "java/lang/Object", uint, [0 x ushort] }**> [#uses=1]
+ store { "java/lang/Object", uint, [0 x ushort] }* null, { "java/lang/Object", uint, [0 x ushort] }** %tmp91
+ store bool false, bool* %tmp
+ ret void
+
+bc7: ; preds = %bc0
+ ret void
+}
diff --git a/test/Analysis/BasicAA/2005-03-09-BrokenBasicAA.ll b/test/Analysis/BasicAA/2005-03-09-BrokenBasicAA.ll
new file mode 100644
index 0000000..f7f42ba
--- /dev/null
+++ b/test/Analysis/BasicAA/2005-03-09-BrokenBasicAA.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine |\
+; RUN: llvm-dis | grep {load i32\\* %A}
+
+declare double* %useit(int*)
+
+int %foo(uint %Amt) {
+ %A = malloc int, uint %Amt
+ %P = call double* %useit(int* %A)
+
+ %X = load int* %A
+ store double 0.0, double* %P
+ %Y = load int* %A
+ %Z = sub int %X, %Y
+ ret int %Z
+}
diff --git a/test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll b/test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll
new file mode 100644
index 0000000..f29e9a0
--- /dev/null
+++ b/test/Analysis/BasicAA/2006-03-03-BadArraySubscript.ll
@@ -0,0 +1,32 @@
+; RUN: llvm-upgrade < %s | llvm-as | \
+; RUN: opt -aa-eval -disable-output |& grep {2 no alias respon}
+
+;; TEST that A[1][0] may alias A[0][i].
+
+void %test(int %N) {
+entry:
+ %X = alloca [3 x [3 x int]] ; <[3 x [3 x int]]*> [#uses=4]
+ %tmp.24 = setgt int %N, 0 ; <bool> [#uses=1]
+ br bool %tmp.24, label %no_exit, label %loopexit
+
+no_exit: ; preds = %no_exit, %entry
+ %i.0.0 = phi int [ 0, %entry ], [ %inc, %no_exit ] ; <int> [#uses=2]
+ %tmp.6 = getelementptr [3 x [3 x int]]* %X, int 0, int 0, int %i.0.0 ; <int*> [#uses=1]
+ store int 1, int* %tmp.6
+ %tmp.8 = getelementptr [3 x [3 x int]]* %X, int 0, int 0, int 0 ; <int*> [#uses=1]
+ %tmp.9 = load int* %tmp.8 ; <int> [#uses=1]
+ %tmp.11 = getelementptr [3 x [3 x int]]* %X, int 0, int 1, int 0 ; <int*> [#uses=1]
+ %tmp.12 = load int* %tmp.11 ; <int> [#uses=1]
+ %tmp.13 = add int %tmp.12, %tmp.9 ; <int> [#uses=1]
+ %inc = add int %i.0.0, 1 ; <int> [#uses=2]
+ %tmp.2 = setlt int %inc, %N ; <bool> [#uses=1]
+ br bool %tmp.2, label %no_exit, label %loopexit
+
+loopexit: ; preds = %no_exit, %entry
+ %Y.0.1 = phi int [ 0, %entry ], [ %tmp.13, %no_exit ] ; <int> [#uses=1]
+ %tmp.4 = getelementptr [3 x [3 x int]]* %X, int 0, int 0 ; <[3 x int]*> [#uses=1]
+ %tmp.15 = call int (...)* %foo( [3 x int]* %tmp.4, int %Y.0.1 ) ; <int> [#uses=0]
+ ret void
+}
+
+declare int %foo(...)
diff --git a/test/Analysis/BasicAA/2006-11-03-BasicAAVectorCrash.ll b/test/Analysis/BasicAA/2006-11-03-BasicAAVectorCrash.ll
new file mode 100644
index 0000000..0503fac
--- /dev/null
+++ b/test/Analysis/BasicAA/2006-11-03-BasicAAVectorCrash.ll
@@ -0,0 +1,51 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -licm -disable-output
+target endian = big
+target pointersize = 32
+target triple = "powerpc-apple-darwin8.7.0"
+
+implementation ; Functions:
+
+void %glgRunProcessor() {
+entry:
+ br bool false, label %bb2037.i, label %cond_true.i18
+
+cond_true.i18: ; preds = %entry
+ ret void
+
+bb205.i: ; preds = %bb2037.i
+ switch uint 0, label %bb1013.i [
+ uint 14, label %bb239.i
+ uint 15, label %bb917.i
+ ]
+
+bb239.i: ; preds = %bb205.i
+ br bool false, label %cond_false277.i, label %cond_true264.i
+
+cond_true264.i: ; preds = %bb239.i
+ ret void
+
+cond_false277.i: ; preds = %bb239.i
+ %tmp1062.i = getelementptr [2 x <4 x int>]* null, int 0, int 1 ; <<4 x int>*> [#uses=1]
+ store <4 x int> zeroinitializer, <4 x int>* %tmp1062.i
+ br bool false, label %cond_true1032.i, label %cond_false1063.i85
+
+bb917.i: ; preds = %bb205.i
+ ret void
+
+bb1013.i: ; preds = %bb205.i
+ ret void
+
+cond_true1032.i: ; preds = %cond_false277.i
+ %tmp1187.i = getelementptr [2 x <4 x int>]* null, int 0, int 0, int 7 ; <int*> [#uses=1]
+ store int 0, int* %tmp1187.i
+ br label %bb2037.i
+
+cond_false1063.i85: ; preds = %cond_false277.i
+ ret void
+
+bb2037.i: ; preds = %cond_true1032.i, %entry
+ br bool false, label %bb205.i, label %cond_next2042.i
+
+cond_next2042.i: ; preds = %bb2037.i
+ ret void
+}
diff --git a/test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll b/test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll
new file mode 100644
index 0000000..683e07d
--- /dev/null
+++ b/test/Analysis/BasicAA/2007-01-13-BasePointerBadNoAlias.ll
@@ -0,0 +1,35 @@
+; PR1109
+; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | \
+; RUN: grep {sub i32}
+; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | \
+; RUN: not grep {ret i32 0}
+; END.
+
+target datalayout = "e-p:32:32"
+target triple = "i686-apple-darwin8"
+ %struct.CONSTRAINT = type { i32, i32, i32, i32 }
+ %struct.FILE_POS = type { i8, i8, i16, i32 }
+ %struct.FIRST_UNION = type { %struct.FILE_POS }
+ %struct.FOURTH_UNION = type { %struct.CONSTRAINT }
+ %struct.GAP = type { i8, i8, i16 }
+ %struct.LIST = type { %struct.rec*, %struct.rec* }
+ %struct.SECOND_UNION = type { { i16, i8, i8 } }
+ %struct.STYLE = type { { %struct.GAP }, { %struct.GAP }, i16, i16, i16, i8, i8 }
+ %struct.THIRD_UNION = type { { [2 x i32], [2 x i32] } }
+ %struct.closure_type = type { [2 x %struct.LIST], %struct.FIRST_UNION, %struct.SECOND_UNION, %struct.THIRD_UNION, %struct.FOURTH_UNION, %struct.rec*, { %struct.rec* } }
+ %struct.head_type = type { [2 x %struct.LIST], %struct.FIRST_UNION, %struct.SECOND_UNION, %struct.THIRD_UNION, %struct.FOURTH_UNION, %struct.rec*, { %struct.rec* }, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, i32 }
+ %struct.rec = type { %struct.head_type }
+
+
+define i32 @test(%struct.closure_type* %tmp18169) {
+ %tmp18174 = getelementptr %struct.closure_type* %tmp18169, i32 0, i32 4, i32 0, i32 0 ; <i32*> [#uses=2]
+ %tmp18269 = bitcast i32* %tmp18174 to %struct.STYLE* ; <%struct.STYLE*> [#uses=1]
+ %A = load i32* %tmp18174 ; <i32> [#uses=1]
+
+ %tmp18272 = getelementptr %struct.STYLE* %tmp18269, i32 0, i32 0, i32 0, i32 2 ; <i16*> [#uses=1]
+ store i16 123, i16* %tmp18272
+
+ %Q = load i32* %tmp18174 ; <i32> [#uses=1]
+ %Z = sub i32 %A, %Q ; <i32> [#uses=1]
+ ret i32 %Z
+}
diff --git a/test/Analysis/BasicAA/dg.exp b/test/Analysis/BasicAA/dg.exp
new file mode 100644
index 0000000..879685c
--- /dev/null
+++ b/test/Analysis/BasicAA/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
diff --git a/test/Analysis/BasicAA/featuretest.ll b/test/Analysis/BasicAA/featuretest.ll
new file mode 100644
index 0000000..52e0a52
--- /dev/null
+++ b/test/Analysis/BasicAA/featuretest.ll
@@ -0,0 +1,85 @@
+; This testcase tests for various features the basicaa test should be able to
+; determine, as noted in the comments.
+
+; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine -dce | llvm-dis | not grep REMOVE
+
+%Global = external global { int }
+
+implementation
+
+
+; Array test: Test that operations on one local array do not invalidate
+; operations on another array. Important for scientific codes.
+;
+int %different_array_test(long %A, long %B) {
+ %Array1 = alloca int, uint 100
+ %Array2 = alloca int, uint 200
+
+ %pointer = getelementptr int* %Array1, long %A
+ %val = load int* %pointer
+
+ %pointer2 = getelementptr int* %Array2, long %B
+ store int 7, int* %pointer2
+
+ %REMOVE = load int* %pointer ; redundant with above load
+ %retval = sub int %REMOVE, %val
+ ret int %retval
+}
+
+; Constant index test: Constant indexes into the same array should not
+; interfere with each other. Again, important for scientific codes.
+;
+int %constant_array_index_test() {
+ %Array = alloca int, uint 100
+ %P1 = getelementptr int* %Array, long 7
+ %P2 = getelementptr int* %Array, long 6
+
+ %A = load int* %P1
+ store int 1, int* %P2 ; Should not invalidate load
+ %BREMOVE = load int* %P1
+ %Val = sub int %A, %BREMOVE
+ ret int %Val
+}
+
+; Test that if two pointers are spaced out by a constant getelementptr, that
+; they cannot alias.
+int %gep_distance_test(int* %A) {
+ %REMOVEu = load int* %A
+ %B = getelementptr int* %A, long 2 ; Cannot alias A
+ store int 7, int* %B
+ %REMOVEv = load int* %A
+ %r = sub int %REMOVEu, %REMOVEv
+ ret int %r
+}
+
+; Test that if two pointers are spaced out by a constant offset, that they
+; cannot alias, even if there is a variable offset between them...
+int %gep_distance_test2({int,int}* %A, long %distance) {
+ %A = getelementptr {int,int}* %A, long 0, uint 0
+ %REMOVEu = load int* %A
+ %B = getelementptr {int,int}* %A, long %distance, uint 1
+ store int 7, int* %B ; B cannot alias A, it's at least 4 bytes away
+ %REMOVEv = load int* %A
+ %r = sub int %REMOVEu, %REMOVEv
+ ret int %r
+}
+
+; Test that we can do funny pointer things and that distance calc will still
+; work.
+int %gep_distance_test3(int * %A) {
+ %X = load int* %A
+ %B = cast int* %A to sbyte*
+ %C = getelementptr sbyte* %B, long 4
+ %Y = load sbyte* %C
+ ret int 8
+}
+
+; Test that we can disambiguate globals reached through constantexpr geps
+int %constexpr_test() {
+ %X = alloca int
+ %Y = load int* %X
+ store int 5, int* getelementptr ({ int }* %Global, long 0, uint 0)
+ %REMOVE = load int* %X
+ %retval = sub int %Y, %REMOVE
+ ret int %retval
+}
diff --git a/test/Analysis/BasicAA/gcsetest.ll b/test/Analysis/BasicAA/gcsetest.ll
new file mode 100644
index 0000000..cd1286f
--- /dev/null
+++ b/test/Analysis/BasicAA/gcsetest.ll
@@ -0,0 +1,46 @@
+; Test that GCSE uses basicaa to do alias analysis, which is capable of
+; disambiguating some obvious cases. All loads should be removable in
+; this testcase.
+
+; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine -dce | llvm-dis | not grep load
+
+%A = global int 7
+%B = global int 8
+implementation
+
+int %test() {
+ %A1 = load int* %A
+
+ store int 123, int* %B ; Store cannot alias %A
+
+ %A2 = load int* %A
+ %X = sub int %A1, %A2
+ ret int %X
+}
+
+int %test2() {
+ %A1 = load int* %A
+ br label %Loop
+Loop:
+ %AP = phi int [0, %0], [%X, %Loop]
+ store int %AP, int* %B ; Store cannot alias %A
+
+ %A2 = load int* %A
+ %X = sub int %A1, %A2
+ %c = seteq int %X, 0
+ br bool %c, label %out, label %Loop
+
+out:
+ ret int %X
+}
+
+declare void %external()
+
+int %test3() {
+ %X = alloca int
+ store int 7, int* %X
+ call void %external()
+ %V = load int* %X
+ ret int %V
+}
+
diff --git a/test/Analysis/BasicAA/global-size.ll b/test/Analysis/BasicAA/global-size.ll
new file mode 100644
index 0000000..5e75249
--- /dev/null
+++ b/test/Analysis/BasicAA/global-size.ll
@@ -0,0 +1,17 @@
+; A store or load cannot alias a global if the accessed amount is larger then
+; the global.
+
+; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep load
+
+%B = global short 8
+
+implementation
+
+short %test(int *%P) {
+ %X = load short* %B
+ store int 7, int* %P
+ %Y = load short* %B
+ %Z = sub short %Y, %X
+ ret short %Z
+}
+
diff --git a/test/Analysis/BasicAA/licmtest.ll b/test/Analysis/BasicAA/licmtest.ll
new file mode 100644
index 0000000..0b13943
--- /dev/null
+++ b/test/Analysis/BasicAA/licmtest.ll
@@ -0,0 +1,42 @@
+; Test that LICM uses basicaa to do alias analysis, which is capable of
+; disambiguating some obvious cases. If LICM is able to disambiguate the
+; two pointers, then the load should be hoisted, and the store sunk. Thus
+; the loop becomes empty and can be deleted by ADCE.
+
+; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -licm --adce | llvm-dis | not grep Loop
+
+%A = global int 7
+%B = global int 8
+%C = global [2 x int ] [ int 4, int 8 ]
+implementation
+
+int %test(bool %c) {
+ %Atmp = load int* %A
+ br label %Loop
+Loop:
+ %ToRemove = load int* %A
+ store int %Atmp, int* %B ; Store cannot alias %A
+
+ br bool %c, label %Out, label %Loop
+Out:
+ %X = sub int %ToRemove, %Atmp
+ ret int %X
+}
+
+int %test2(bool %c) {
+ br label %Loop
+Loop:
+ %AVal = load int* %A
+ %C0 = getelementptr [2 x int ]* %C, long 0, long 0
+ store int %AVal, int* %C0 ; Store cannot alias %A
+
+ %BVal = load int* %B
+ %C1 = getelementptr [2 x int ]* %C, long 0, long 1
+ store int %BVal, int* %C1 ; Store cannot alias %A, %B, or %C0
+
+ br bool %c, label %Out, label %Loop
+Out:
+ %X = sub int %AVal, %BVal
+ ret int %X
+}
+
diff --git a/test/Analysis/BasicAA/modref.ll b/test/Analysis/BasicAA/modref.ll
new file mode 100644
index 0000000..adf195e
--- /dev/null
+++ b/test/Analysis/BasicAA/modref.ll
@@ -0,0 +1,16 @@
+; A very rudimentary test on AliasAnalysis::getModRefInfo.
+; RUN: llvm-upgrade < %s | llvm-as | \
+; RUN: opt -print-all-alias-modref-info -aa-eval -disable-output |& \
+; RUN: not grep NoModRef
+
+int %callee() {
+ %X = alloca { int, int }
+ %Y = getelementptr { int, int }* %X, uint 0, uint 0
+ %Z = load int* %Y
+ ret int %Z
+}
+
+int %caller() {
+ %X = call int %callee()
+ ret int %X
+}
diff --git a/test/Analysis/BasicAA/tailcall-modref.ll b/test/Analysis/BasicAA/tailcall-modref.ll
new file mode 100644
index 0000000..9d447d9
--- /dev/null
+++ b/test/Analysis/BasicAA/tailcall-modref.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine |\
+; RUN: llvm-dis | grep {ret i32 0}
+declare void %foo(int*)
+declare void %bar()
+
+int %test() {
+ %A = alloca int
+ call void %foo(int* %A)
+
+ %X = load int* %A
+ tail call void %bar() ;; Cannot modify *%A because it's on the stack.
+ %Y = load int* %A
+ %Z = sub int %X, %Y
+ ret int %Z
+}
+
+
diff --git a/test/Analysis/Dominators/2006-09-26-PostDominanceFrontier.ll b/test/Analysis/Dominators/2006-09-26-PostDominanceFrontier.ll
new file mode 100644
index 0000000..719150d
--- /dev/null
+++ b/test/Analysis/Dominators/2006-09-26-PostDominanceFrontier.ll
@@ -0,0 +1,102 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -analyze -postdomfrontier \
+; RUN: -disable-verify
+; END.
+;
+; ModuleID = '2006-09-26-PostDominanceFrontier.bc'
+target endian = little
+target pointersize = 64
+target triple = "alphaev67-unknown-linux-gnu"
+ %struct.FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct.FILE*, int, int, long, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, int, [44 x sbyte] }
+ %struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, int }
+%TOP = external global ulong* ; <ulong**> [#uses=1]
+%BOT = external global ulong* ; <ulong**> [#uses=1]
+%str = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0]
+
+implementation ; Functions:
+
+declare void %fopen()
+
+void %main(sbyte** %argv) {
+entry:
+ %netSelect.i507 = alloca ulong, align 8 ; <ulong*> [#uses=0]
+ %topStart.i = alloca ulong, align 8 ; <ulong*> [#uses=0]
+ %topEnd.i = alloca ulong, align 8 ; <ulong*> [#uses=0]
+ %botStart.i = alloca ulong, align 8 ; <ulong*> [#uses=0]
+ %botEnd.i = alloca ulong, align 8 ; <ulong*> [#uses=0]
+ %c1.i154 = alloca uint, align 4 ; <uint*> [#uses=0]
+ %b1.i155 = alloca uint, align 4 ; <uint*> [#uses=0]
+ %t1.i156 = alloca uint, align 4 ; <uint*> [#uses=0]
+ %c1.i = alloca uint, align 4 ; <uint*> [#uses=0]
+ %b1.i = alloca uint, align 4 ; <uint*> [#uses=0]
+ %t1.i = alloca uint, align 4 ; <uint*> [#uses=0]
+ %netSelect.i5 = alloca ulong, align 8 ; <ulong*> [#uses=0]
+ %netSelect.i = alloca ulong, align 8 ; <ulong*> [#uses=0]
+ %tmp2.i = getelementptr sbyte** %argv, int 1 ; <sbyte**> [#uses=1]
+ %tmp3.i4 = load sbyte** %tmp2.i ; <sbyte*> [#uses=0]
+ call void %fopen( )
+ br bool false, label %DimensionChannel.exit, label %bb.backedge.i
+
+bb.backedge.i: ; preds = %entry
+ ret void
+
+DimensionChannel.exit: ; preds = %entry
+ %tmp13.i137 = malloc ulong, uint 0 ; <ulong*> [#uses=1]
+ %tmp610.i = malloc ulong, uint 0 ; <ulong*> [#uses=1]
+ br label %cond_true.i143
+
+cond_true.i143: ; preds = %cond_true.i143, %DimensionChannel.exit
+ %tmp9.i140 = getelementptr ulong* %tmp13.i137, ulong 0 ; <ulong*> [#uses=0]
+ %tmp12.i = getelementptr ulong* %tmp610.i, ulong 0 ; <ulong*> [#uses=0]
+ br bool false, label %bb18.i144, label %cond_true.i143
+
+bb18.i144: ; preds = %cond_true.i143
+ call void %fopen( )
+ %tmp76.i105 = malloc ulong, uint 0 ; <ulong*> [#uses=3]
+ %tmp674.i = malloc ulong, uint 0 ; <ulong*> [#uses=2]
+ %tmp1072.i = malloc ulong, uint 0 ; <ulong*> [#uses=2]
+ %tmp1470.i = malloc ulong, uint 0 ; <ulong*> [#uses=1]
+ br label %cond_true.i114
+
+cond_true.i114: ; preds = %cond_true.i114, %bb18.i144
+ %tmp17.i108 = getelementptr ulong* %tmp76.i105, ulong 0 ; <ulong*> [#uses=0]
+ %tmp20.i = getelementptr ulong* %tmp674.i, ulong 0 ; <ulong*> [#uses=0]
+ %tmp23.i111 = getelementptr ulong* %tmp1470.i, ulong 0 ; <ulong*> [#uses=0]
+ br bool false, label %cond_true40.i, label %cond_true.i114
+
+cond_true40.i: ; preds = %cond_true40.i, %cond_true.i114
+ %tmp33.i115 = getelementptr ulong* %tmp1072.i, ulong 0 ; <ulong*> [#uses=0]
+ br bool false, label %bb142.i, label %cond_true40.i
+
+cond_next54.i: ; preds = %cond_true76.i
+ %tmp57.i = getelementptr ulong* %tmp55.i, ulong 0 ; <ulong*> [#uses=0]
+ br bool false, label %bb64.i, label %bb69.i
+
+bb64.i: ; preds = %cond_true76.i, %cond_next54.i
+ %tmp67.i117 = getelementptr ulong* %tmp76.i105, ulong 0 ; <ulong*> [#uses=0]
+ br bool false, label %bb114.i, label %cond_true111.i
+
+bb69.i: ; preds = %cond_next54.i
+ br bool false, label %bb79.i, label %cond_true76.i
+
+cond_true76.i: ; preds = %bb142.i, %bb69.i
+ %tmp48.i = getelementptr ulong* %tmp46.i, ulong 0 ; <ulong*> [#uses=0]
+ br bool false, label %bb64.i, label %cond_next54.i
+
+bb79.i: ; preds = %bb69.i
+ br bool false, label %bb114.i, label %cond_true111.i
+
+cond_true111.i: ; preds = %bb79.i, %bb64.i
+ %tmp84.i127 = getelementptr ulong* %tmp46.i, ulong 0 ; <ulong*> [#uses=0]
+ ret void
+
+bb114.i: ; preds = %bb142.i, %bb79.i, %bb64.i
+ %tmp117.i = getelementptr ulong* %tmp76.i105, ulong 0 ; <ulong*> [#uses=0]
+ %tmp132.i131 = getelementptr ulong* %tmp674.i, ulong 0 ; <ulong*> [#uses=0]
+ %tmp122.i = getelementptr ulong* %tmp1072.i, ulong 0 ; <ulong*> [#uses=0]
+ ret void
+
+bb142.i: ; preds = %cond_true40.i
+ %tmp46.i = load ulong** %BOT ; <ulong*> [#uses=2]
+ %tmp55.i = load ulong** %TOP ; <ulong*> [#uses=1]
+ br bool false, label %bb114.i, label %cond_true76.i
+}
diff --git a/test/Analysis/Dominators/2006-10-02-BreakCritEdges.ll b/test/Analysis/Dominators/2006-10-02-BreakCritEdges.ll
new file mode 100644
index 0000000..40d2760
--- /dev/null
+++ b/test/Analysis/Dominators/2006-10-02-BreakCritEdges.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -domtree -break-crit-edges -analyze \
+; RUN: -domtree | grep {3.*%brtrue$}
+; PR932
+implementation ; Functions:
+
+declare void %use1(int)
+
+void %f(int %i, bool %c) {
+entry:
+ %A = seteq int %i, 0 ; <bool> [#uses=1]
+ br bool %A, label %brtrue, label %brfalse
+
+brtrue: ; preds = %brtrue, %entry
+ %B = phi bool [ true, %brtrue ], [ false, %entry ] ; <bool> [#uses=1]
+ call void %use1( int %i )
+ br bool %B, label %brtrue, label %brfalse
+
+brfalse: ; preds = %brtrue, %entry
+ call void %use1( int %i )
+ ret void
+}
diff --git a/test/Analysis/Dominators/2007-01-14-BreakCritEdges.ll b/test/Analysis/Dominators/2007-01-14-BreakCritEdges.ll
new file mode 100644
index 0000000..697dad2
--- /dev/null
+++ b/test/Analysis/Dominators/2007-01-14-BreakCritEdges.ll
@@ -0,0 +1,187 @@
+; RUN: llvm-as < %s | opt -domtree -break-crit-edges -domtree -disable-output
+; PR1110
+
+ %struct.OggVorbis_File = type { i8*, i32, i64, i64, %struct.ogg_sync_state, i32, i64*, i64*, i32*, i64*, %struct.vorbis_info*, %struct.vorbis_comment*, i64, i32, i32, i32, double, double, %struct.ogg_stream_state, %struct.vorbis_dsp_state, %struct.vorbis_block, %struct.ov_callbacks }
+ %struct.alloc_chain = type { i8*, %struct.alloc_chain* }
+ %struct.ogg_stream_state = type { i8*, i32, i32, i32, i32*, i64*, i32, i32, i32, i32, [282 x i8], i32, i32, i32, i32, i32, i64, i64 }
+ %struct.ogg_sync_state = type { i8*, i32, i32, i32, i32, i32, i32 }
+ %struct.oggpack_buffer = type { i32, i32, i8*, i8*, i32 }
+ %struct.ov_callbacks = type { i32 (i8*, i32, i32, i8*)*, i32 (i8*, i64, i32)*, i32 (i8*)*, i32 (i8*)* }
+ %struct.vorbis_block = type { float**, %struct.oggpack_buffer, i32, i32, i32, i32, i32, i32, i64, i64, %struct.vorbis_dsp_state*, i8*, i32, i32, i32, %struct.alloc_chain*, i32, i32, i32, i32, i8* }
+ %struct.vorbis_comment = type { i8**, i32*, i32, i8* }
+ %struct.vorbis_dsp_state = type { i32, %struct.vorbis_info*, float**, float**, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i8* }
+ %struct.vorbis_info = type { i32, i32, i32, i32, i32, i32, i32, i8* }
+
+
+define void @ov_read() {
+entry:
+ br i1 false, label %bb, label %return
+
+bb: ; preds = %cond_next22, %entry
+ br i1 false, label %cond_true8, label %cond_next15
+
+cond_true8: ; preds = %bb
+ br i1 false, label %cond_next15, label %bb29
+
+cond_next15: ; preds = %cond_true8, %bb
+ br i1 false, label %return, label %cond_next22
+
+cond_next22: ; preds = %cond_next15
+ br i1 false, label %bb, label %return
+
+bb29: ; preds = %cond_true8
+ br i1 false, label %cond_true32, label %return
+
+cond_true32: ; preds = %bb29
+ br i1 false, label %cond_false37.i, label %cond_true.i11
+
+cond_true.i11: ; preds = %cond_true32
+ br i1 false, label %cond_true8.i, label %ov_info.exit
+
+cond_true8.i: ; preds = %cond_true.i11
+ br i1 false, label %cond_true44, label %cond_next48
+
+cond_false37.i: ; preds = %cond_true32
+ br label %ov_info.exit
+
+ov_info.exit: ; preds = %cond_false37.i, %cond_true.i11
+ br i1 false, label %cond_true44, label %cond_next48
+
+cond_true44: ; preds = %ov_info.exit, %cond_true8.i
+ br label %cond_next48
+
+cond_next48: ; preds = %cond_true44, %ov_info.exit, %cond_true8.i
+ br i1 false, label %cond_next53, label %return
+
+cond_next53: ; preds = %cond_next48
+ br i1 false, label %cond_true56, label %cond_false97
+
+cond_true56: ; preds = %cond_next53
+ br i1 false, label %bb85, label %cond_next304
+
+bb63: ; preds = %bb85
+ br i1 false, label %cond_next78, label %cond_false73
+
+cond_false73: ; preds = %bb63
+ br i1 false, label %cond_true76, label %cond_next78
+
+cond_true76: ; preds = %cond_false73
+ br label %cond_next78
+
+cond_next78: ; preds = %cond_true76, %cond_false73, %bb63
+ br label %bb85
+
+bb85: ; preds = %bb89, %cond_next78, %cond_true56
+ br i1 false, label %bb63, label %bb89
+
+bb89: ; preds = %bb85
+ br i1 false, label %bb85, label %cond_next304
+
+cond_false97: ; preds = %cond_next53
+ br i1 false, label %cond_true108, label %bb248
+
+cond_true108: ; preds = %cond_false97
+ br i1 false, label %bb196, label %bb149
+
+bb112: ; preds = %bb149, %bb146
+ br i1 false, label %bb119, label %bb146
+
+bb119: ; preds = %cond_next134, %bb112
+ br i1 false, label %cond_next134, label %cond_false129
+
+cond_false129: ; preds = %bb119
+ br i1 false, label %cond_true132, label %cond_next134
+
+cond_true132: ; preds = %cond_false129
+ br label %cond_next134
+
+cond_next134: ; preds = %cond_true132, %cond_false129, %bb119
+ br i1 false, label %bb119, label %bb146
+
+bb146: ; preds = %cond_next134, %bb112
+ br i1 false, label %bb112, label %cond_next304
+
+bb149: ; preds = %cond_true108
+ br i1 false, label %bb112, label %cond_next304
+
+bb155: ; preds = %bb196, %bb193
+ br i1 false, label %bb165, label %bb193
+
+bb165: ; preds = %cond_next180, %bb155
+ br i1 false, label %cond_next180, label %cond_false175
+
+cond_false175: ; preds = %bb165
+ br i1 false, label %cond_true178, label %cond_next180
+
+cond_true178: ; preds = %cond_false175
+ br label %cond_next180
+
+cond_next180: ; preds = %cond_true178, %cond_false175, %bb165
+ br i1 false, label %bb165, label %bb193
+
+bb193: ; preds = %cond_next180, %bb155
+ br i1 false, label %bb155, label %cond_next304
+
+bb196: ; preds = %cond_true108
+ br i1 false, label %bb155, label %cond_next304
+
+bb207: ; preds = %bb241
+ br i1 false, label %cond_next225, label %cond_false220
+
+cond_false220: ; preds = %bb207
+ br i1 false, label %cond_true223, label %cond_next225
+
+cond_true223: ; preds = %cond_false220
+ br label %cond_next225
+
+cond_next225: ; preds = %cond_true223, %cond_false220, %bb207
+ br label %bb241
+
+bb241: ; preds = %bb248, %bb245, %cond_next225
+ br i1 false, label %bb207, label %bb245
+
+bb245: ; preds = %bb241
+ br i1 false, label %bb241, label %cond_next304
+
+bb248: ; preds = %cond_false97
+ br i1 false, label %bb241, label %cond_next304
+
+bb256: ; preds = %bb290
+ br i1 false, label %cond_next274, label %cond_false269
+
+cond_false269: ; preds = %bb256
+ br i1 false, label %cond_true272, label %cond_next274
+
+cond_true272: ; preds = %cond_false269
+ br label %cond_next274
+
+cond_next274: ; preds = %cond_true272, %cond_false269, %bb256
+ br label %bb290
+
+bb290: ; preds = %bb294, %cond_next274
+ br i1 false, label %bb256, label %bb294
+
+bb294: ; preds = %bb290
+ br i1 false, label %bb290, label %cond_next304
+
+cond_next304: ; preds = %bb294, %bb248, %bb245, %bb196, %bb193, %bb149, %bb146, %bb89, %cond_true56
+ br i1 false, label %cond_next11.i, label %cond_true.i
+
+cond_true.i: ; preds = %cond_next304
+ br i1 false, label %vorbis_synthesis_read.exit, label %cond_next11.i
+
+cond_next11.i: ; preds = %cond_true.i, %cond_next304
+ br label %vorbis_synthesis_read.exit
+
+vorbis_synthesis_read.exit: ; preds = %cond_next11.i, %cond_true.i
+ br i1 false, label %cond_next321, label %cond_true316
+
+cond_true316: ; preds = %vorbis_synthesis_read.exit
+ ret void
+
+cond_next321: ; preds = %vorbis_synthesis_read.exit
+ ret void
+
+return: ; preds = %cond_next48, %bb29, %cond_next22, %cond_next15, %entry
+ ret void
+}
diff --git a/test/Analysis/Dominators/2007-04-17-PostDominanceFrontier.ll b/test/Analysis/Dominators/2007-04-17-PostDominanceFrontier.ll
new file mode 100644
index 0000000..1699b90
--- /dev/null
+++ b/test/Analysis/Dominators/2007-04-17-PostDominanceFrontier.ll
@@ -0,0 +1,692 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -postdomfrontier -disable-output
+
+void @SManager() {
+entry:
+ br label %bb.outer
+
+bb.outer: ; preds = %bb193, %entry
+ br label %bb.outer156
+
+bb.loopexit: ; preds = %bb442
+ br label %bb.outer156
+
+bb.outer156: ; preds = %bb.loopexit, %bb.outer
+ br label %bb
+
+bb: ; preds = %bb.backedge, %bb.outer156
+ br i1 false, label %cond_true, label %bb.cond_next_crit_edge
+
+bb.cond_next_crit_edge: ; preds = %bb
+ br label %cond_next
+
+cond_true: ; preds = %bb
+ br label %cond_next
+
+cond_next: ; preds = %cond_true, %bb.cond_next_crit_edge
+ br i1 false, label %cond_next.bb.backedge_crit_edge, label %cond_next107
+
+cond_next.bb.backedge_crit_edge: ; preds = %cond_next
+ br label %bb.backedge
+
+bb.backedge: ; preds = %cond_true112.bb.backedge_crit_edge, %cond_next.bb.backedge_crit_edge
+ br label %bb
+
+cond_next107: ; preds = %cond_next
+ br i1 false, label %cond_true112, label %cond_next197
+
+cond_true112: ; preds = %cond_next107
+ br i1 false, label %cond_true118, label %cond_true112.bb.backedge_crit_edge
+
+cond_true112.bb.backedge_crit_edge: ; preds = %cond_true112
+ br label %bb.backedge
+
+cond_true118: ; preds = %cond_true112
+ br i1 false, label %bb123.preheader, label %cond_true118.bb148_crit_edge
+
+cond_true118.bb148_crit_edge: ; preds = %cond_true118
+ br label %bb148
+
+bb123.preheader: ; preds = %cond_true118
+ br label %bb123
+
+bb123: ; preds = %bb142.bb123_crit_edge, %bb123.preheader
+ br i1 false, label %bb123.bb142_crit_edge, label %cond_next.i57
+
+bb123.bb142_crit_edge: ; preds = %bb123
+ br label %bb142
+
+cond_next.i57: ; preds = %bb123
+ br i1 false, label %cond_true135, label %cond_next.i57.bb142_crit_edge
+
+cond_next.i57.bb142_crit_edge: ; preds = %cond_next.i57
+ br label %bb142
+
+cond_true135: ; preds = %cond_next.i57
+ br label %bb142
+
+bb142: ; preds = %cond_true135, %cond_next.i57.bb142_crit_edge, %bb123.bb142_crit_edge
+ br i1 false, label %bb148.loopexit, label %bb142.bb123_crit_edge
+
+bb142.bb123_crit_edge: ; preds = %bb142
+ br label %bb123
+
+bb148.loopexit: ; preds = %bb142
+ br label %bb148
+
+bb148: ; preds = %bb148.loopexit, %cond_true118.bb148_crit_edge
+ br i1 false, label %bb151.preheader, label %bb148.bb177_crit_edge
+
+bb148.bb177_crit_edge: ; preds = %bb148
+ br label %bb177
+
+bb151.preheader: ; preds = %bb148
+ br label %bb151
+
+bb151: ; preds = %bb171.bb151_crit_edge, %bb151.preheader
+ br i1 false, label %bb151.bb171_crit_edge, label %cond_next.i49
+
+bb151.bb171_crit_edge: ; preds = %bb151
+ br label %bb171
+
+cond_next.i49: ; preds = %bb151
+ br i1 false, label %cond_true164, label %cond_next.i49.bb171_crit_edge
+
+cond_next.i49.bb171_crit_edge: ; preds = %cond_next.i49
+ br label %bb171
+
+cond_true164: ; preds = %cond_next.i49
+ br label %bb171
+
+bb171: ; preds = %cond_true164, %cond_next.i49.bb171_crit_edge, %bb151.bb171_crit_edge
+ br i1 false, label %bb177.loopexit, label %bb171.bb151_crit_edge
+
+bb171.bb151_crit_edge: ; preds = %bb171
+ br label %bb151
+
+bb177.loopexit: ; preds = %bb171
+ br label %bb177
+
+bb177: ; preds = %bb177.loopexit, %bb148.bb177_crit_edge
+ br i1 false, label %bb180.preheader, label %bb177.bb193_crit_edge
+
+bb177.bb193_crit_edge: ; preds = %bb177
+ br label %bb193
+
+bb180.preheader: ; preds = %bb177
+ br label %bb180
+
+bb180: ; preds = %bb180.bb180_crit_edge, %bb180.preheader
+ br i1 false, label %bb193.loopexit, label %bb180.bb180_crit_edge
+
+bb180.bb180_crit_edge: ; preds = %bb180
+ br label %bb180
+
+bb193.loopexit: ; preds = %bb180
+ br label %bb193
+
+bb193: ; preds = %bb193.loopexit, %bb177.bb193_crit_edge
+ br label %bb.outer
+
+cond_next197: ; preds = %cond_next107
+ br i1 false, label %cond_next210, label %cond_true205
+
+cond_true205: ; preds = %cond_next197
+ br i1 false, label %cond_true205.bb213_crit_edge, label %cond_true205.bb299_crit_edge
+
+cond_true205.bb299_crit_edge: ; preds = %cond_true205
+ br label %bb299
+
+cond_true205.bb213_crit_edge: ; preds = %cond_true205
+ br label %bb213
+
+cond_next210: ; preds = %cond_next197
+ br label %bb293
+
+bb213: ; preds = %bb293.bb213_crit_edge, %cond_true205.bb213_crit_edge
+ br i1 false, label %bb213.cond_next290_crit_edge, label %cond_true248
+
+bb213.cond_next290_crit_edge: ; preds = %bb213
+ br label %cond_next290
+
+cond_true248: ; preds = %bb213
+ br i1 false, label %cond_true248.cond_next290_crit_edge, label %cond_true255
+
+cond_true248.cond_next290_crit_edge: ; preds = %cond_true248
+ br label %cond_next290
+
+cond_true255: ; preds = %cond_true248
+ br i1 false, label %cond_true266, label %cond_true255.cond_next271_crit_edge
+
+cond_true255.cond_next271_crit_edge: ; preds = %cond_true255
+ br label %cond_next271
+
+cond_true266: ; preds = %cond_true255
+ br label %cond_next271
+
+cond_next271: ; preds = %cond_true266, %cond_true255.cond_next271_crit_edge
+ br label %cond_next290
+
+cond_next290: ; preds = %cond_next271, %cond_true248.cond_next290_crit_edge, %bb213.cond_next290_crit_edge
+ br label %bb293
+
+bb293: ; preds = %cond_next290, %cond_next210
+ br i1 false, label %bb293.bb213_crit_edge, label %bb293.bb299_crit_edge
+
+bb293.bb299_crit_edge: ; preds = %bb293
+ br label %bb299
+
+bb293.bb213_crit_edge: ; preds = %bb293
+ br label %bb213
+
+bb299: ; preds = %bb293.bb299_crit_edge, %cond_true205.bb299_crit_edge
+ br i1 false, label %bb302.preheader, label %bb299.bb390_crit_edge
+
+bb299.bb390_crit_edge: ; preds = %bb299
+ br label %bb390
+
+bb302.preheader: ; preds = %bb299
+ br label %bb302
+
+bb302: ; preds = %bb384.bb302_crit_edge, %bb302.preheader
+ br i1 false, label %bb302.bb384_crit_edge, label %cond_true339
+
+bb302.bb384_crit_edge: ; preds = %bb302
+ br label %bb384
+
+cond_true339: ; preds = %bb302
+ br i1 false, label %cond_true339.bb384_crit_edge, label %cond_true346
+
+cond_true339.bb384_crit_edge: ; preds = %cond_true339
+ br label %bb384
+
+cond_true346: ; preds = %cond_true339
+ br i1 false, label %cond_true357, label %cond_true346.cond_next361_crit_edge
+
+cond_true346.cond_next361_crit_edge: ; preds = %cond_true346
+ br label %cond_next361
+
+cond_true357: ; preds = %cond_true346
+ br label %cond_next361
+
+cond_next361: ; preds = %cond_true357, %cond_true346.cond_next361_crit_edge
+ br label %bb384
+
+bb384: ; preds = %cond_next361, %cond_true339.bb384_crit_edge, %bb302.bb384_crit_edge
+ br i1 false, label %bb390.loopexit, label %bb384.bb302_crit_edge
+
+bb384.bb302_crit_edge: ; preds = %bb384
+ br label %bb302
+
+bb390.loopexit: ; preds = %bb384
+ br label %bb390
+
+bb390: ; preds = %bb390.loopexit, %bb299.bb390_crit_edge
+ br i1 false, label %bb391.preheader, label %bb390.bb442.preheader_crit_edge
+
+bb390.bb442.preheader_crit_edge: ; preds = %bb390
+ br label %bb442.preheader
+
+bb391.preheader: ; preds = %bb390
+ br label %bb391
+
+bb391: ; preds = %bb413.bb391_crit_edge, %bb391.preheader
+ br i1 false, label %bb391.bb413_crit_edge, label %cond_next404
+
+bb391.bb413_crit_edge: ; preds = %bb391
+ br label %bb413
+
+cond_next404: ; preds = %bb391
+ br i1 false, label %cond_next404.HWrite.exit_crit_edge, label %cond_next.i13
+
+cond_next404.HWrite.exit_crit_edge: ; preds = %cond_next404
+ br label %HWrite.exit
+
+cond_next.i13: ; preds = %cond_next404
+ br i1 false, label %cond_next.i13.cond_next13.i_crit_edge, label %cond_true12.i
+
+cond_next.i13.cond_next13.i_crit_edge: ; preds = %cond_next.i13
+ br label %cond_next13.i
+
+cond_true12.i: ; preds = %cond_next.i13
+ br label %cond_next13.i
+
+cond_next13.i: ; preds = %cond_true12.i, %cond_next.i13.cond_next13.i_crit_edge
+ br i1 false, label %cond_next13.i.bb.i22_crit_edge, label %cond_next43.i
+
+cond_next13.i.bb.i22_crit_edge: ; preds = %cond_next13.i
+ br label %bb.i22
+
+cond_next43.i: ; preds = %cond_next13.i
+ br i1 false, label %cond_next43.i.bb.i22_crit_edge, label %bb60.i
+
+cond_next43.i.bb.i22_crit_edge: ; preds = %cond_next43.i
+ br label %bb.i22
+
+bb.i22: ; preds = %cond_next43.i.bb.i22_crit_edge, %cond_next13.i.bb.i22_crit_edge
+ br label %bb413
+
+bb60.i: ; preds = %cond_next43.i
+ br i1 false, label %bb60.i.HWrite.exit_crit_edge, label %cond_true81.i
+
+bb60.i.HWrite.exit_crit_edge: ; preds = %bb60.i
+ br label %HWrite.exit
+
+cond_true81.i: ; preds = %bb60.i
+ br label %bb413
+
+HWrite.exit: ; preds = %bb60.i.HWrite.exit_crit_edge, %cond_next404.HWrite.exit_crit_edge
+ br label %bb413
+
+bb413: ; preds = %HWrite.exit, %cond_true81.i, %bb.i22, %bb391.bb413_crit_edge
+ br i1 false, label %bb442.preheader.loopexit, label %bb413.bb391_crit_edge
+
+bb413.bb391_crit_edge: ; preds = %bb413
+ br label %bb391
+
+bb442.preheader.loopexit: ; preds = %bb413
+ br label %bb442.preheader
+
+bb442.preheader: ; preds = %bb442.preheader.loopexit, %bb390.bb442.preheader_crit_edge
+ br label %bb442.outer
+
+bb420: ; preds = %bb442
+ br i1 false, label %bb439.loopexit, label %cond_next433
+
+cond_next433: ; preds = %bb420
+ br i1 false, label %cond_next433.HRead.exit.loopexit_crit_edge, label %cond_next.i
+
+cond_next433.HRead.exit.loopexit_crit_edge: ; preds = %cond_next433
+ br label %HRead.exit.loopexit
+
+cond_next.i: ; preds = %cond_next433
+ br i1 false, label %cond_true9.i, label %cond_false223.i
+
+cond_true9.i: ; preds = %cond_next.i
+ switch i32 0, label %cond_false.i [
+ i32 1, label %cond_true9.i.cond_true15.i_crit_edge
+ i32 5, label %cond_true9.i.cond_true15.i_crit_edge9
+ ]
+
+cond_true9.i.cond_true15.i_crit_edge9: ; preds = %cond_true9.i
+ br label %cond_true15.i
+
+cond_true9.i.cond_true15.i_crit_edge: ; preds = %cond_true9.i
+ br label %cond_true15.i
+
+cond_true15.i: ; preds = %cond_true9.i.cond_true15.i_crit_edge, %cond_true9.i.cond_true15.i_crit_edge9
+ br i1 false, label %cond_true15.i.cond_true44.i_crit_edge, label %cond_true15.i.cond_false49.i_crit_edge
+
+cond_true15.i.cond_false49.i_crit_edge: ; preds = %cond_true15.i
+ br label %cond_false49.i
+
+cond_true15.i.cond_true44.i_crit_edge: ; preds = %cond_true15.i
+ br label %cond_true44.i
+
+cond_false.i: ; preds = %cond_true9.i
+ br i1 false, label %cond_false.i.cond_next39.i_crit_edge, label %cond_true30.i
+
+cond_false.i.cond_next39.i_crit_edge: ; preds = %cond_false.i
+ br label %cond_next39.i
+
+cond_true30.i: ; preds = %cond_false.i
+ br label %cond_next39.i
+
+cond_next39.i: ; preds = %cond_true30.i, %cond_false.i.cond_next39.i_crit_edge
+ br i1 false, label %cond_next39.i.cond_true44.i_crit_edge, label %cond_next39.i.cond_false49.i_crit_edge
+
+cond_next39.i.cond_false49.i_crit_edge: ; preds = %cond_next39.i
+ br label %cond_false49.i
+
+cond_next39.i.cond_true44.i_crit_edge: ; preds = %cond_next39.i
+ br label %cond_true44.i
+
+cond_true44.i: ; preds = %cond_next39.i.cond_true44.i_crit_edge, %cond_true15.i.cond_true44.i_crit_edge
+ br i1 false, label %cond_true44.i.cond_next70.i_crit_edge, label %cond_true44.i.cond_true61.i_crit_edge
+
+cond_true44.i.cond_true61.i_crit_edge: ; preds = %cond_true44.i
+ br label %cond_true61.i
+
+cond_true44.i.cond_next70.i_crit_edge: ; preds = %cond_true44.i
+ br label %cond_next70.i
+
+cond_false49.i: ; preds = %cond_next39.i.cond_false49.i_crit_edge, %cond_true15.i.cond_false49.i_crit_edge
+ br i1 false, label %cond_false49.i.cond_next70.i_crit_edge, label %cond_false49.i.cond_true61.i_crit_edge
+
+cond_false49.i.cond_true61.i_crit_edge: ; preds = %cond_false49.i
+ br label %cond_true61.i
+
+cond_false49.i.cond_next70.i_crit_edge: ; preds = %cond_false49.i
+ br label %cond_next70.i
+
+cond_true61.i: ; preds = %cond_false49.i.cond_true61.i_crit_edge, %cond_true44.i.cond_true61.i_crit_edge
+ br i1 false, label %cond_true61.i.cond_next70.i_crit_edge, label %cond_true67.i
+
+cond_true61.i.cond_next70.i_crit_edge: ; preds = %cond_true61.i
+ br label %cond_next70.i
+
+cond_true67.i: ; preds = %cond_true61.i
+ br label %cond_next70.i
+
+cond_next70.i: ; preds = %cond_true67.i, %cond_true61.i.cond_next70.i_crit_edge, %cond_false49.i.cond_next70.i_crit_edge, %cond_true44.i.cond_next70.i_crit_edge
+ br i1 false, label %cond_true77.i, label %cond_next81.i
+
+cond_true77.i: ; preds = %cond_next70.i
+ br label %bb442.outer.backedge
+
+cond_next81.i: ; preds = %cond_next70.i
+ br i1 false, label %cond_true87.i, label %cond_false94.i
+
+cond_true87.i: ; preds = %cond_next81.i
+ br i1 false, label %cond_true87.i.cond_true130.i_crit_edge, label %cond_true87.i.cond_next135.i_crit_edge
+
+cond_true87.i.cond_next135.i_crit_edge: ; preds = %cond_true87.i
+ br label %cond_next135.i
+
+cond_true87.i.cond_true130.i_crit_edge: ; preds = %cond_true87.i
+ br label %cond_true130.i
+
+cond_false94.i: ; preds = %cond_next81.i
+ switch i32 0, label %cond_false94.i.cond_next125.i_crit_edge [
+ i32 1, label %cond_false94.i.cond_true100.i_crit_edge
+ i32 5, label %cond_false94.i.cond_true100.i_crit_edge10
+ ]
+
+cond_false94.i.cond_true100.i_crit_edge10: ; preds = %cond_false94.i
+ br label %cond_true100.i
+
+cond_false94.i.cond_true100.i_crit_edge: ; preds = %cond_false94.i
+ br label %cond_true100.i
+
+cond_false94.i.cond_next125.i_crit_edge: ; preds = %cond_false94.i
+ br label %cond_next125.i
+
+cond_true100.i: ; preds = %cond_false94.i.cond_true100.i_crit_edge, %cond_false94.i.cond_true100.i_crit_edge10
+ br i1 false, label %cond_true107.i, label %cond_true100.i.cond_next109.i_crit_edge
+
+cond_true100.i.cond_next109.i_crit_edge: ; preds = %cond_true100.i
+ br label %cond_next109.i
+
+cond_true107.i: ; preds = %cond_true100.i
+ br label %cond_next109.i
+
+cond_next109.i: ; preds = %cond_true107.i, %cond_true100.i.cond_next109.i_crit_edge
+ br i1 false, label %cond_next109.i.cond_next125.i_crit_edge, label %cond_true116.i
+
+cond_next109.i.cond_next125.i_crit_edge: ; preds = %cond_next109.i
+ br label %cond_next125.i
+
+cond_true116.i: ; preds = %cond_next109.i
+ br label %cond_next125.i
+
+cond_next125.i: ; preds = %cond_true116.i, %cond_next109.i.cond_next125.i_crit_edge, %cond_false94.i.cond_next125.i_crit_edge
+ br i1 false, label %cond_next125.i.cond_true130.i_crit_edge, label %cond_next125.i.cond_next135.i_crit_edge
+
+cond_next125.i.cond_next135.i_crit_edge: ; preds = %cond_next125.i
+ br label %cond_next135.i
+
+cond_next125.i.cond_true130.i_crit_edge: ; preds = %cond_next125.i
+ br label %cond_true130.i
+
+cond_true130.i: ; preds = %cond_next125.i.cond_true130.i_crit_edge, %cond_true87.i.cond_true130.i_crit_edge
+ br label %cond_next135.i
+
+cond_next135.i: ; preds = %cond_true130.i, %cond_next125.i.cond_next135.i_crit_edge, %cond_true87.i.cond_next135.i_crit_edge
+ br i1 false, label %cond_true142.i, label %cond_next135.i.cond_next149.i_crit_edge
+
+cond_next135.i.cond_next149.i_crit_edge: ; preds = %cond_next135.i
+ br label %cond_next149.i
+
+cond_true142.i: ; preds = %cond_next135.i
+ br label %cond_next149.i
+
+cond_next149.i: ; preds = %cond_true142.i, %cond_next135.i.cond_next149.i_crit_edge
+ br i1 false, label %cond_true156.i, label %cond_next149.i.cond_next163.i_crit_edge
+
+cond_next149.i.cond_next163.i_crit_edge: ; preds = %cond_next149.i
+ br label %cond_next163.i
+
+cond_true156.i: ; preds = %cond_next149.i
+ br label %cond_next163.i
+
+cond_next163.i: ; preds = %cond_true156.i, %cond_next149.i.cond_next163.i_crit_edge
+ br i1 false, label %cond_true182.i, label %cond_next163.i.cond_next380.i_crit_edge
+
+cond_next163.i.cond_next380.i_crit_edge: ; preds = %cond_next163.i
+ br label %cond_next380.i
+
+cond_true182.i: ; preds = %cond_next163.i
+ br i1 false, label %cond_true182.i.cond_next380.i_crit_edge, label %cond_true196.i
+
+cond_true182.i.cond_next380.i_crit_edge: ; preds = %cond_true182.i
+ br label %cond_next380.i
+
+cond_true196.i: ; preds = %cond_true182.i
+ br i1 false, label %cond_true210.i, label %cond_true196.i.cond_next380.i_crit_edge
+
+cond_true196.i.cond_next380.i_crit_edge: ; preds = %cond_true196.i
+ br label %cond_next380.i
+
+cond_true210.i: ; preds = %cond_true196.i
+ br i1 false, label %cond_true216.i, label %cond_true210.i.cond_next380.i_crit_edge
+
+cond_true210.i.cond_next380.i_crit_edge: ; preds = %cond_true210.i
+ br label %cond_next380.i
+
+cond_true216.i: ; preds = %cond_true210.i
+ br label %cond_next380.i
+
+cond_false223.i: ; preds = %cond_next.i
+ br i1 false, label %cond_true229.i, label %cond_false355.i
+
+cond_true229.i: ; preds = %cond_false223.i
+ br i1 false, label %cond_true229.i.HRead.exit.loopexit_crit_edge, label %cond_next243.i
+
+cond_true229.i.HRead.exit.loopexit_crit_edge: ; preds = %cond_true229.i
+ br label %HRead.exit.loopexit
+
+cond_next243.i: ; preds = %cond_true229.i
+ br i1 false, label %cond_true248.i, label %cond_false255.i
+
+cond_true248.i: ; preds = %cond_next243.i
+ br label %cond_next260.i
+
+cond_false255.i: ; preds = %cond_next243.i
+ br label %cond_next260.i
+
+cond_next260.i: ; preds = %cond_false255.i, %cond_true248.i
+ br i1 false, label %cond_true267.i, label %cond_next273.i
+
+cond_true267.i: ; preds = %cond_next260.i
+ br label %bb442.backedge
+
+bb442.backedge: ; preds = %bb.i, %cond_true267.i
+ br label %bb442
+
+cond_next273.i: ; preds = %cond_next260.i
+ br i1 false, label %cond_true281.i, label %cond_next273.i.cond_next288.i_crit_edge
+
+cond_next273.i.cond_next288.i_crit_edge: ; preds = %cond_next273.i
+ br label %cond_next288.i
+
+cond_true281.i: ; preds = %cond_next273.i
+ br label %cond_next288.i
+
+cond_next288.i: ; preds = %cond_true281.i, %cond_next273.i.cond_next288.i_crit_edge
+ br i1 false, label %cond_true295.i, label %cond_next288.i.cond_next302.i_crit_edge
+
+cond_next288.i.cond_next302.i_crit_edge: ; preds = %cond_next288.i
+ br label %cond_next302.i
+
+cond_true295.i: ; preds = %cond_next288.i
+ br label %cond_next302.i
+
+cond_next302.i: ; preds = %cond_true295.i, %cond_next288.i.cond_next302.i_crit_edge
+ br i1 false, label %cond_next302.i.cond_next380.i_crit_edge, label %cond_true328.i
+
+cond_next302.i.cond_next380.i_crit_edge: ; preds = %cond_next302.i
+ br label %cond_next380.i
+
+cond_true328.i: ; preds = %cond_next302.i
+ br i1 false, label %cond_true343.i, label %cond_true328.i.cond_next380.i_crit_edge
+
+cond_true328.i.cond_next380.i_crit_edge: ; preds = %cond_true328.i
+ br label %cond_next380.i
+
+cond_true343.i: ; preds = %cond_true328.i
+ br i1 false, label %cond_true349.i, label %cond_true343.i.cond_next380.i_crit_edge
+
+cond_true343.i.cond_next380.i_crit_edge: ; preds = %cond_true343.i
+ br label %cond_next380.i
+
+cond_true349.i: ; preds = %cond_true343.i
+ br label %cond_next380.i
+
+cond_false355.i: ; preds = %cond_false223.i
+ br i1 false, label %cond_false355.i.bb.i_crit_edge, label %cond_next363.i
+
+cond_false355.i.bb.i_crit_edge: ; preds = %cond_false355.i
+ br label %bb.i
+
+cond_next363.i: ; preds = %cond_false355.i
+ br i1 false, label %bb377.i, label %cond_next363.i.bb.i_crit_edge
+
+cond_next363.i.bb.i_crit_edge: ; preds = %cond_next363.i
+ br label %bb.i
+
+bb.i: ; preds = %cond_next363.i.bb.i_crit_edge, %cond_false355.i.bb.i_crit_edge
+ br label %bb442.backedge
+
+bb377.i: ; preds = %cond_next363.i
+ br label %cond_next380.i
+
+cond_next380.i: ; preds = %bb377.i, %cond_true349.i, %cond_true343.i.cond_next380.i_crit_edge, %cond_true328.i.cond_next380.i_crit_edge, %cond_next302.i.cond_next380.i_crit_edge, %cond_true216.i, %cond_true210.i.cond_next380.i_crit_edge, %cond_true196.i.cond_next380.i_crit_edge, %cond_true182.i.cond_next380.i_crit_edge, %cond_next163.i.cond_next380.i_crit_edge
+ br i1 false, label %cond_next380.i.HRead.exit_crit_edge, label %cond_true391.i
+
+cond_next380.i.HRead.exit_crit_edge: ; preds = %cond_next380.i
+ br label %HRead.exit
+
+cond_true391.i: ; preds = %cond_next380.i
+ br label %bb442.outer.backedge
+
+bb442.outer.backedge: ; preds = %bb439, %cond_true391.i, %cond_true77.i
+ br label %bb442.outer
+
+HRead.exit.loopexit: ; preds = %cond_true229.i.HRead.exit.loopexit_crit_edge, %cond_next433.HRead.exit.loopexit_crit_edge
+ br label %HRead.exit
+
+HRead.exit: ; preds = %HRead.exit.loopexit, %cond_next380.i.HRead.exit_crit_edge
+ br label %bb439
+
+bb439.loopexit: ; preds = %bb420
+ br label %bb439
+
+bb439: ; preds = %bb439.loopexit, %HRead.exit
+ br label %bb442.outer.backedge
+
+bb442.outer: ; preds = %bb442.outer.backedge, %bb442.preheader
+ br label %bb442
+
+bb442: ; preds = %bb442.outer, %bb442.backedge
+ br i1 false, label %bb420, label %bb.loopexit
+}
+
+void @Invalidate() {
+entry:
+ br i1 false, label %cond_false, label %cond_true
+
+cond_true: ; preds = %entry
+ br i1 false, label %cond_true40, label %cond_true.cond_next_crit_edge
+
+cond_true.cond_next_crit_edge: ; preds = %cond_true
+ br label %cond_next
+
+cond_true40: ; preds = %cond_true
+ br label %cond_next
+
+cond_next: ; preds = %cond_true40, %cond_true.cond_next_crit_edge
+ br i1 false, label %cond_true68, label %cond_next.cond_next73_crit_edge
+
+cond_next.cond_next73_crit_edge: ; preds = %cond_next
+ br label %cond_next73
+
+cond_true68: ; preds = %cond_next
+ br label %cond_next73
+
+cond_next73: ; preds = %cond_true68, %cond_next.cond_next73_crit_edge
+ br i1 false, label %cond_true91, label %cond_next73.cond_next96_crit_edge
+
+cond_next73.cond_next96_crit_edge: ; preds = %cond_next73
+ br label %cond_next96
+
+cond_true91: ; preds = %cond_next73
+ br label %cond_next96
+
+cond_next96: ; preds = %cond_true91, %cond_next73.cond_next96_crit_edge
+ br i1 false, label %cond_next96.cond_next112_crit_edge, label %cond_true105
+
+cond_next96.cond_next112_crit_edge: ; preds = %cond_next96
+ br label %cond_next112
+
+cond_true105: ; preds = %cond_next96
+ br label %cond_next112
+
+cond_next112: ; preds = %cond_true105, %cond_next96.cond_next112_crit_edge
+ br i1 false, label %cond_next112.cond_next127_crit_edge, label %cond_true119
+
+cond_next112.cond_next127_crit_edge: ; preds = %cond_next112
+ br label %cond_next127
+
+cond_true119: ; preds = %cond_next112
+ br label %cond_next127
+
+cond_next127: ; preds = %cond_true119, %cond_next112.cond_next127_crit_edge
+ br i1 false, label %cond_next141, label %cond_true134
+
+cond_true134: ; preds = %cond_next127
+ br i1 false, label %cond_true134.bb161_crit_edge, label %cond_true134.bb_crit_edge
+
+cond_true134.bb_crit_edge: ; preds = %cond_true134
+ br label %bb
+
+cond_true134.bb161_crit_edge: ; preds = %cond_true134
+ br label %bb161
+
+cond_next141: ; preds = %cond_next127
+ br label %bb154
+
+bb: ; preds = %bb154.bb_crit_edge, %cond_true134.bb_crit_edge
+ br label %bb154
+
+bb154: ; preds = %bb, %cond_next141
+ br i1 false, label %bb154.bb161_crit_edge, label %bb154.bb_crit_edge
+
+bb154.bb_crit_edge: ; preds = %bb154
+ br label %bb
+
+bb154.bb161_crit_edge: ; preds = %bb154
+ br label %bb161
+
+bb161: ; preds = %bb154.bb161_crit_edge, %cond_true134.bb161_crit_edge
+ br i1 false, label %bb161.cond_next201_crit_edge, label %cond_true198
+
+bb161.cond_next201_crit_edge: ; preds = %bb161
+ br label %cond_next201
+
+cond_true198: ; preds = %bb161
+ br label %cond_next201
+
+cond_next201: ; preds = %cond_true198, %bb161.cond_next201_crit_edge
+ br i1 false, label %cond_next212, label %cond_true206
+
+cond_true206: ; preds = %cond_next201
+ br label %UnifiedReturnBlock
+
+cond_false: ; preds = %entry
+ br label %UnifiedReturnBlock
+
+cond_next212: ; preds = %cond_next201
+ br label %UnifiedReturnBlock
+
+UnifiedReturnBlock: ; preds = %cond_next212, %cond_false, %cond_true206
+ ret void
+}
diff --git a/test/Analysis/Dominators/2007-04-20-PostDom-Reset.ll b/test/Analysis/Dominators/2007-04-20-PostDom-Reset.ll
new file mode 100644
index 0000000..06bc289
--- /dev/null
+++ b/test/Analysis/Dominators/2007-04-20-PostDom-Reset.ll
@@ -0,0 +1,28 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -postdomfrontier -disable-output
+
+void @args_out_of_range() {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ br label %bb
+}
+
+void @args_out_of_range_3() {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ br label %bb
+}
+
+void @Feq() {
+entry:
+ br i1 false, label %cond_true, label %cond_next
+
+cond_true: ; preds = %entry
+ unreachable
+
+cond_next: ; preds = %entry
+ unreachable
+}
diff --git a/test/Analysis/Dominators/dg.exp b/test/Analysis/Dominators/dg.exp
new file mode 100644
index 0000000..879685c
--- /dev/null
+++ b/test/Analysis/Dominators/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
diff --git a/test/Analysis/GlobalsModRef/aliastest.ll b/test/Analysis/GlobalsModRef/aliastest.ll
new file mode 100644
index 0000000..4363d3b
--- /dev/null
+++ b/test/Analysis/GlobalsModRef/aliastest.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
+%X = internal global int 4
+
+int %test(int *%P) {
+ store int 7, int* %P
+ store int 12, int* %X ;; cannot alias P, X's addr isn't taken
+ %V = load int* %P
+ ret int %V
+}
diff --git a/test/Analysis/GlobalsModRef/chaining-analysis.ll b/test/Analysis/GlobalsModRef/chaining-analysis.ll
new file mode 100644
index 0000000..4924456
--- /dev/null
+++ b/test/Analysis/GlobalsModRef/chaining-analysis.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
+
+; This test requires the use of previous analyses to determine that
+; doesnotmodX does not modify X (because 'sin' doesn't).
+
+%X = internal global int 4
+
+declare double %sin(double)
+
+int %test(int *%P) {
+ store int 12, int* %X
+ call double %doesnotmodX(double 1.0)
+ %V = load int* %X
+ ret int %V
+}
+
+double %doesnotmodX(double %V) {
+ %V2 = call double %sin(double %V)
+ ret double %V2
+}
diff --git a/test/Analysis/GlobalsModRef/dg.exp b/test/Analysis/GlobalsModRef/dg.exp
new file mode 100644
index 0000000..879685c
--- /dev/null
+++ b/test/Analysis/GlobalsModRef/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
diff --git a/test/Analysis/GlobalsModRef/indirect-global.ll b/test/Analysis/GlobalsModRef/indirect-global.ll
new file mode 100644
index 0000000..0ab82ae
--- /dev/null
+++ b/test/Analysis/GlobalsModRef/indirect-global.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-upgrade < %s | llvm-as | \
+; RUN: opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | \
+; RUN: grep {ret i32 0}
+; END.
+%G = internal global int* null
+
+implementation
+
+void %test() {
+ %A = malloc int
+ store int* %A, int** %G
+ ret void
+}
+
+int %test1(int *%P) {
+ %g1 = load int** %G
+ %h1 = load int* %g1
+
+ ; This store cannot alias either G or g1.
+ store int 123, int* %P
+
+ %g2 = load int** %G
+ %h2 = load int* %g1
+ %X = sub int %h1, %h2 ;; -> 0
+ ret int %X
+}
diff --git a/test/Analysis/GlobalsModRef/modreftest.ll b/test/Analysis/GlobalsModRef/modreftest.ll
new file mode 100644
index 0000000..fadc747
--- /dev/null
+++ b/test/Analysis/GlobalsModRef/modreftest.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
+%X = internal global int 4
+
+int %test(int *%P) {
+ store int 12, int* %X
+ call void %doesnotmodX()
+ %V = load int* %X
+ ret int %V
+}
+
+void %doesnotmodX() {
+ ret void
+}
diff --git a/test/Analysis/GlobalsModRef/purecse.ll b/test/Analysis/GlobalsModRef/purecse.ll
new file mode 100644
index 0000000..0c95182
--- /dev/null
+++ b/test/Analysis/GlobalsModRef/purecse.ll
@@ -0,0 +1,23 @@
+; Test that pure functions are cse'd away
+
+; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | not grep sub
+
+int %pure(int %X) {
+ %Y = add int %X, 1
+ ret int %Y
+}
+
+int %test1(int %X) {
+ %A = call int %pure(int %X)
+ %B = call int %pure(int %X)
+ %C = sub int %A, %B
+ ret int %C
+}
+
+int %test2(int %X, int* %P) {
+ %A = call int %pure(int %X)
+ store int %X, int* %P ;; Does not invalidate 'pure' call.
+ %B = call int %pure(int %X)
+ %C = sub int %A, %B
+ ret int %C
+}
diff --git a/test/Analysis/LoadVN/RLE-Eliminate.ll b/test/Analysis/LoadVN/RLE-Eliminate.ll
new file mode 100644
index 0000000..4c3a668
--- /dev/null
+++ b/test/Analysis/LoadVN/RLE-Eliminate.ll
@@ -0,0 +1,23 @@
+; This testcase ensures that redundant loads are eliminated when they should
+; be. All RL variables (redundant loads) should be eliminated.
+;
+; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse | llvm-dis | not grep %RL
+;
+int "test1"(int* %P) {
+ %A = load int* %P
+ %RL = load int* %P
+ %C = add int %A, %RL
+ ret int %C
+}
+
+int "test2"(int* %P) {
+ %A = load int* %P
+ br label %BB2
+BB2:
+ br label %BB3
+BB3:
+ %RL = load int* %P
+ %B = add int %A, %RL
+ ret int %B
+}
+
diff --git a/test/Analysis/LoadVN/RLE-Preserve-Volatile.ll b/test/Analysis/LoadVN/RLE-Preserve-Volatile.ll
new file mode 100644
index 0000000..9966016
--- /dev/null
+++ b/test/Analysis/LoadVN/RLE-Preserve-Volatile.ll
@@ -0,0 +1,9 @@
+
+; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -instcombine | llvm-dis | grep sub
+
+int %test(int* %P) {
+ %X = volatile load int* %P
+ %Y = volatile load int* %P
+ %Z = sub int %X, %Y
+ ret int %Z
+}
diff --git a/test/Analysis/LoadVN/RLE-Preserve.ll b/test/Analysis/LoadVN/RLE-Preserve.ll
new file mode 100644
index 0000000..e08c41c
--- /dev/null
+++ b/test/Analysis/LoadVN/RLE-Preserve.ll
@@ -0,0 +1,25 @@
+; This testcase ensures that redundant loads are preserved when they are not
+; allowed to be eliminated.
+; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse | llvm-dis | grep sub
+;
+int %test1(int* %P) {
+ %A = load int* %P
+ store int 1, int* %P
+ %B = load int* %P
+ %C = sub int %A, %B
+ ret int %C
+}
+
+int %test2(int* %P) {
+ %A = load int* %P
+ br label %BB2
+BB2:
+ store int 5, int* %P
+ br label %BB3
+BB3:
+ %B = load int* %P
+ %C = sub int %A, %B
+ ret int %C
+}
+
+
diff --git a/test/Analysis/LoadVN/call_cse.ll b/test/Analysis/LoadVN/call_cse.ll
new file mode 100644
index 0000000..78cdd43
--- /dev/null
+++ b/test/Analysis/LoadVN/call_cse.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub
+declare int %strlen(sbyte*)
+
+int %test(sbyte* %P) {
+ %X = call int %strlen(sbyte* %P)
+ %A = add int %X, 14
+ %Y = call int %strlen(sbyte* %P)
+ %Z = sub int %X, %Y
+ %B = add int %A, %Z
+ ret int %B
+}
diff --git a/test/Analysis/LoadVN/call_pure_function.ll b/test/Analysis/LoadVN/call_pure_function.ll
new file mode 100644
index 0000000..302ae60
--- /dev/null
+++ b/test/Analysis/LoadVN/call_pure_function.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub
+declare int %strlen(sbyte*)
+declare void %use(int %X)
+
+sbyte %test(sbyte* %P, sbyte* %Q) {
+ %A = load sbyte* %Q
+ %X = call int %strlen(sbyte* %P)
+ %B = load sbyte* %Q ;; CSE with A.
+ call void %use(int %X) ;; make strlen not dead
+
+ %C = sub sbyte %A, %B
+ ret sbyte %C
+}
diff --git a/test/Analysis/LoadVN/casts.ll b/test/Analysis/LoadVN/casts.ll
new file mode 100644
index 0000000..3da4d57
--- /dev/null
+++ b/test/Analysis/LoadVN/casts.ll
@@ -0,0 +1,13 @@
+; Check to make sure that Value Numbering doesn't merge casts of different
+; flavors.
+; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse | llvm-dis | \
+; RUN: grep {\[sz\]ext} | wc -l | grep 2
+
+declare void %external(int)
+
+int %test_casts(short %x) {
+ %a = sext short %x to int
+ %b = zext short %x to int
+ call void %external(int %a)
+ ret int %b
+}
diff --git a/test/Analysis/LoadVN/dependent_loads.ll b/test/Analysis/LoadVN/dependent_loads.ll
new file mode 100644
index 0000000..168b640
--- /dev/null
+++ b/test/Analysis/LoadVN/dependent_loads.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub
+
+%S = type { int, sbyte }
+
+sbyte %test(sbyte** %P) {
+ %A = load sbyte** %P
+ %B = load sbyte* %A
+
+ %X = load sbyte** %P
+ %Y = load sbyte* %X
+
+ %R = sub sbyte %B, %Y
+ ret sbyte %R
+}
+
+sbyte %test(%S ** %P) {
+ %A = load %S** %P
+ %B = getelementptr %S* %A, int 0, uint 1
+ %C = load sbyte* %B
+
+ %X = load %S** %P
+ %Y = getelementptr %S* %X, int 0, uint 1
+ %Z = load sbyte* %Y
+
+ %R = sub sbyte %C, %Z
+ ret sbyte %R
+}
diff --git a/test/Analysis/LoadVN/dg.exp b/test/Analysis/LoadVN/dg.exp
new file mode 100644
index 0000000..879685c
--- /dev/null
+++ b/test/Analysis/LoadVN/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
diff --git a/test/Analysis/LoadVN/undefined_load.ll b/test/Analysis/LoadVN/undefined_load.ll
new file mode 100644
index 0000000..8e4660c
--- /dev/null
+++ b/test/Analysis/LoadVN/undefined_load.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse | llvm-dis | not grep load
+; Test that loads of undefined memory are eliminated.
+
+int %test1() {
+ %X = malloc int
+ %Y = load int* %X
+ ret int %Y
+}
+int %test2() {
+ %X = alloca int
+ %Y = load int* %X
+ ret int %Y
+}
+
diff --git a/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll b/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll
new file mode 100644
index 0000000..e2023c5
--- /dev/null
+++ b/test/Analysis/LoopInfo/2003-05-15-NestingProblem.ll
@@ -0,0 +1,30 @@
+; This testcase was incorrectly computing that the loopentry.7 loop was
+; not a child of the loopentry.6 loop.
+;
+; RUN: llvm-upgrade < %s | llvm-as | opt -analyze -loops | \
+; RUN: grep {^ Loop Containing: %loopentry.7}
+
+void %getAndMoveToFrontDecode() { ; No predecessors!
+ br label %endif.2
+
+endif.2: ; preds = %0, %loopexit.5
+ br bool false, label %loopentry.5, label %UnifiedExitNode
+
+loopentry.5: ; preds = %endif.2, %loopexit.6
+ br bool false, label %loopentry.6, label %UnifiedExitNode
+
+loopentry.6: ; preds = %loopentry.5, %loopentry.7
+ br bool false, label %loopentry.7, label %loopexit.6
+
+loopentry.7: ; preds = %loopentry.6, %loopentry.7
+ br bool false, label %loopentry.7, label %loopentry.6
+
+loopexit.6: ; preds = %loopentry.6
+ br bool false, label %loopentry.5, label %loopexit.5
+
+loopexit.5: ; preds = %loopexit.6
+ br bool false, label %endif.2, label %UnifiedExitNode
+
+UnifiedExitNode: ; preds = %endif.2, %loopexit.5, %loopentry.5
+ ret void
+}
diff --git a/test/Analysis/LoopInfo/dg.exp b/test/Analysis/LoopInfo/dg.exp
new file mode 100644
index 0000000..879685c
--- /dev/null
+++ b/test/Analysis/LoopInfo/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
diff --git a/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll b/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll
new file mode 100644
index 0000000..ef5cd2f
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | opt -analyze -scalar-evolution 2>&1 | grep "Loop bb: 100 iterations"
+; PR1533
+
+@array = weak global [101 x i32] zeroinitializer, align 32 ; <[100 x i32]*> [#uses=1]
+
+define void @loop(i32 %x) {
+entry:
+ br label %bb
+
+bb: ; preds = %bb, %entry
+ %i.01.0 = phi i32 [ 100, %entry ], [ %tmp4, %bb ] ; <i32> [#uses=2]
+ %tmp1 = getelementptr [101 x i32]* @array, i32 0, i32 %i.01.0 ; <i32*> [#uses=1]
+ store i32 %x, i32* %tmp1
+ %tmp4 = add i32 %i.01.0, -1 ; <i32> [#uses=2]
+ %tmp7 = icmp sgt i32 %tmp4, -1 ; <i1> [#uses=1]
+ br i1 %tmp7, label %bb, label %return
+
+return: ; preds = %bb
+ ret void
+}
diff --git a/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll b/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll
new file mode 100644
index 0000000..aeaf356
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/SolveQuadraticEquation.ll
@@ -0,0 +1,32 @@
+; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& \
+; RUN: grep {100 iterations}
+; PR1101
+
+@A = weak global [1000 x i32] zeroinitializer, align 32
+
+
+define void @test(i32 %N) {
+entry:
+ "alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ br label %bb3
+
+bb: ; preds = %bb3
+ %tmp = getelementptr [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1]
+ store i32 123, i32* %tmp
+ %tmp2 = add i32 %i.0, 1 ; <i32> [#uses=1]
+ br label %bb3
+
+bb3: ; preds = %bb, %entry
+ %i.0 = phi i32 [ 2, %entry ], [ %tmp2, %bb ] ; <i32> [#uses=3]
+ %SQ = mul i32 %i.0, %i.0
+ %tmp4 = mul i32 %i.0, 2
+ %tmp5 = sub i32 %SQ, %tmp4
+ %tmp3 = icmp sle i32 %tmp5, 9999 ; <i1> [#uses=1]
+ br i1 %tmp3, label %bb, label %bb5
+
+bb5: ; preds = %bb3
+ br label %return
+
+return: ; preds = %bb5
+ ret void
+}
diff --git a/test/Analysis/ScalarEvolution/dg.exp b/test/Analysis/ScalarEvolution/dg.exp
new file mode 100644
index 0000000..b65a250
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.ll]]
diff --git a/test/Analysis/ScalarEvolution/trip-count.ll b/test/Analysis/ScalarEvolution/trip-count.ll
new file mode 100644
index 0000000..a689e71
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/trip-count.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& \
+; RUN: grep {10000 iterations}
+; PR1101
+
+@A = weak global [1000 x i32] zeroinitializer, align 32
+
+
+define void @test(i32 %N) {
+entry:
+ "alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ br label %bb3
+
+bb: ; preds = %bb3
+ %tmp = getelementptr [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1]
+ store i32 123, i32* %tmp
+ %tmp2 = add i32 %i.0, 1 ; <i32> [#uses=1]
+ br label %bb3
+
+bb3: ; preds = %bb, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %tmp2, %bb ] ; <i32> [#uses=3]
+ %tmp3 = icmp sle i32 %i.0, 9999 ; <i1> [#uses=1]
+ br i1 %tmp3, label %bb, label %bb5
+
+bb5: ; preds = %bb3
+ br label %return
+
+return: ; preds = %bb5
+ ret void
+}
diff --git a/test/Analysis/ScalarEvolution/trip-count2.ll b/test/Analysis/ScalarEvolution/trip-count2.ll
new file mode 100644
index 0000000..e003c19
--- /dev/null
+++ b/test/Analysis/ScalarEvolution/trip-count2.ll
@@ -0,0 +1,35 @@
+; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& \
+; RUN: grep {4 iterations}
+; PR1101
+
+@A = weak global [1000 x i32] zeroinitializer, align 32
+
+
+define void @test(i32 %N) {
+entry:
+ "alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ br label %bb3
+
+bb: ; preds = %bb3
+ %tmp = getelementptr [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1]
+ store i32 123, i32* %tmp
+ %tmp4 = mul i32 %i.0, 4 ; <i32> [#uses=1]
+ %tmp5 = or i32 %tmp4, 1
+ %tmp61 = xor i32 %tmp5, -2147483648
+ %tmp6 = trunc i32 %tmp61 to i16
+ %tmp71 = shl i16 %tmp6, 2
+ %tmp7 = zext i16 %tmp71 to i32
+ %tmp2 = add i32 %tmp7, %i.0
+ br label %bb3
+
+bb3: ; preds = %bb, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %tmp2, %bb ] ; <i32> [#uses=3]
+ %tmp3 = icmp sle i32 %i.0, 9999 ; <i1> [#uses=1]
+ br i1 %tmp3, label %bb, label %bb5
+
+bb5: ; preds = %bb3
+ br label %return
+
+return: ; preds = %bb5
+ ret void
+}