summaryrefslogtreecommitdiffstats
path: root/test/Transforms/LoopRotate
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/LoopRotate')
-rw-r--r--test/Transforms/LoopRotate/2009-01-25-SingleEntryPhi.ll21
-rw-r--r--test/Transforms/LoopRotate/LRCrash-1.ll18
-rw-r--r--test/Transforms/LoopRotate/LRCrash-2.ll24
-rw-r--r--test/Transforms/LoopRotate/LRCrash-3.ll29
-rw-r--r--test/Transforms/LoopRotate/LRCrash-4.ll18
-rw-r--r--test/Transforms/LoopRotate/LRCrash-5.ll26
-rw-r--r--test/Transforms/LoopRotate/PhiRename-1.ll95
-rw-r--r--test/Transforms/LoopRotate/PhiSelfRefernce-1.ll39
-rw-r--r--test/Transforms/LoopRotate/dg.exp3
-rw-r--r--test/Transforms/LoopRotate/indirectbr.ll43
-rw-r--r--test/Transforms/LoopRotate/phi-duplicate.ll35
-rw-r--r--test/Transforms/LoopRotate/pr2639.ll38
-rw-r--r--test/Transforms/LoopRotate/preserve-scev.ll47
13 files changed, 436 insertions, 0 deletions
diff --git a/test/Transforms/LoopRotate/2009-01-25-SingleEntryPhi.ll b/test/Transforms/LoopRotate/2009-01-25-SingleEntryPhi.ll
new file mode 100644
index 0000000..7036d2d
--- /dev/null
+++ b/test/Transforms/LoopRotate/2009-01-25-SingleEntryPhi.ll
@@ -0,0 +1,21 @@
+; RUN: opt < %s -loop-rotate -verify-dom-info -verify-loop-info -disable-output
+; PR3408
+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"
+target triple = "x86_64-unknown-linux-gnu"
+ %struct.Cls = type { i32, i8, [2 x %struct.Cls*], [2 x %struct.Lit*] }
+ %struct.Lit = type { i8 }
+
+define void @picosat_main_bb13.i.i71.outer_bb132.i.i.i.outer(%struct.Cls**, %struct.Cls**, i32 %collect.i.i.i.1.lcssa, i32 %lcollect.i.i.i.2.lcssa, %struct.Cls*** %rhead.tmp.0236.out, i32* %collect.i.i.i.2.out, i32* %lcollect.i.i.i.3.ph.ph.ph.out) nounwind {
+newFuncRoot:
+ br label %codeRepl
+
+bb133.i.i.i.exitStub: ; preds = %codeRepl
+ ret void
+
+bb130.i.i.i: ; preds = %codeRepl
+ %rhead.tmp.0236.lcssa82 = phi %struct.Cls** [ null, %codeRepl ] ; <%struct.Cls**> [#uses=0]
+ br label %codeRepl
+
+codeRepl: ; preds = %bb130.i.i.i, %newFuncRoot
+ br i1 false, label %bb130.i.i.i, label %bb133.i.i.i.exitStub
+}
diff --git a/test/Transforms/LoopRotate/LRCrash-1.ll b/test/Transforms/LoopRotate/LRCrash-1.ll
new file mode 100644
index 0000000..f16dd04
--- /dev/null
+++ b/test/Transforms/LoopRotate/LRCrash-1.ll
@@ -0,0 +1,18 @@
+; RUN: opt < %s -loop-rotate -verify-dom-info -verify-loop-info -disable-output
+
+ %struct.relation = type { [4 x i16], i32, [4 x i16], i32, i32 }
+
+define void @findAllPairs() {
+entry:
+ br i1 false, label %bb139, label %bb10.i44
+bb10.i44: ; preds = %entry
+ ret void
+bb127: ; preds = %bb139
+ br label %bb139
+bb139: ; preds = %bb127, %entry
+ br i1 false, label %bb127, label %bb142
+bb142: ; preds = %bb139
+ %r91.0.lcssa = phi %struct.relation* [ null, %bb139 ] ; <%struct.relation*> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/LoopRotate/LRCrash-2.ll b/test/Transforms/LoopRotate/LRCrash-2.ll
new file mode 100644
index 0000000..0a10989
--- /dev/null
+++ b/test/Transforms/LoopRotate/LRCrash-2.ll
@@ -0,0 +1,24 @@
+; RUN: opt < %s -loop-rotate -verify-dom-info -verify-loop-info -disable-output
+
+define void @findAllPairs() {
+entry:
+ br i1 false, label %bb139, label %cond_true
+cond_true: ; preds = %entry
+ ret void
+bb90: ; preds = %bb139
+ br i1 false, label %bb136, label %cond_next121
+cond_next121: ; preds = %bb90
+ br i1 false, label %bb136, label %bb127
+bb127: ; preds = %cond_next121
+ br label %bb136
+bb136: ; preds = %bb127, %cond_next121, %bb90
+ %changes.1 = phi i32 [ %changes.2, %bb90 ], [ %changes.2, %cond_next121 ], [ 1, %bb127 ] ; <i32> [#uses=1]
+ br label %bb139
+bb139: ; preds = %bb136, %entry
+ %changes.2 = phi i32 [ %changes.1, %bb136 ], [ 0, %entry ] ; <i32> [#uses=3]
+ br i1 false, label %bb90, label %bb142
+bb142: ; preds = %bb139
+ %changes.2.lcssa = phi i32 [ %changes.2, %bb139 ] ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/LoopRotate/LRCrash-3.ll b/test/Transforms/LoopRotate/LRCrash-3.ll
new file mode 100644
index 0000000..79f21fb
--- /dev/null
+++ b/test/Transforms/LoopRotate/LRCrash-3.ll
@@ -0,0 +1,29 @@
+; RUN: opt < %s -loop-rotate -verify-dom-info -verify-loop-info -disable-output
+
+define void @_ZN9Classfile4readEv() {
+entry:
+ br i1 false, label %cond_false485, label %bb405
+bb405: ; preds = %entry
+ ret void
+cond_false485: ; preds = %entry
+ br label %bb830
+bb511: ; preds = %bb830
+ br i1 false, label %bb816, label %bb830
+cond_next667: ; preds = %bb816
+ br i1 false, label %cond_next695, label %bb680
+bb676: ; preds = %bb680
+ br label %bb680
+bb680: ; preds = %bb676, %cond_next667
+ %iftmp.68.0 = zext i1 false to i8 ; <i8> [#uses=1]
+ br i1 false, label %bb676, label %cond_next695
+cond_next695: ; preds = %bb680, %cond_next667
+ %iftmp.68.2 = phi i8 [ %iftmp.68.0, %bb680 ], [ undef, %cond_next667 ] ; <i8> [#uses=0]
+ ret void
+bb816: ; preds = %bb816, %bb511
+ br i1 false, label %cond_next667, label %bb816
+bb830: ; preds = %bb511, %cond_false485
+ br i1 false, label %bb511, label %bb835
+bb835: ; preds = %bb830
+ ret void
+}
+
diff --git a/test/Transforms/LoopRotate/LRCrash-4.ll b/test/Transforms/LoopRotate/LRCrash-4.ll
new file mode 100644
index 0000000..7d35c16
--- /dev/null
+++ b/test/Transforms/LoopRotate/LRCrash-4.ll
@@ -0,0 +1,18 @@
+; RUN: opt < %s -loop-rotate -verify-dom-info -verify-loop-info -disable-output
+
+define void @InterpretSEIMessage(i8* %msg) {
+entry:
+ br label %bb15
+bb6: ; preds = %bb15
+ %gep.upgrd.1 = zext i32 %offset.1 to i64 ; <i64> [#uses=1]
+ %tmp11 = getelementptr i8* %msg, i64 %gep.upgrd.1 ; <i8*> [#uses=0]
+ br label %bb15
+bb15: ; preds = %bb6, %entry
+ %offset.1 = add i32 0, 1 ; <i32> [#uses=2]
+ br i1 false, label %bb6, label %bb17
+bb17: ; preds = %bb15
+ %offset.1.lcssa = phi i32 [ %offset.1, %bb15 ] ; <i32> [#uses=0]
+ %payload_type.1.lcssa = phi i32 [ 0, %bb15 ] ; <i32> [#uses=0]
+ ret void
+}
+
diff --git a/test/Transforms/LoopRotate/LRCrash-5.ll b/test/Transforms/LoopRotate/LRCrash-5.ll
new file mode 100644
index 0000000..6643cc1
--- /dev/null
+++ b/test/Transforms/LoopRotate/LRCrash-5.ll
@@ -0,0 +1,26 @@
+; RUN: opt < %s -loop-rotate -verify-dom-info -verify-loop-info -disable-output
+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"
+target triple = "x86_64-apple-darwin9"
+ %struct.NSArray = type { %struct.NSObject }
+ %struct.NSObject = type { %struct.objc_class* }
+ %struct.NSRange = type { i64, i64 }
+ %struct._message_ref_t = type { %struct.NSObject* (%struct.NSObject*, %struct._message_ref_t*, ...)*, %struct.objc_selector* }
+ %struct.objc_class = type opaque
+ %struct.objc_selector = type opaque
+@"\01L_OBJC_MESSAGE_REF_26" = external global %struct._message_ref_t ; <%struct._message_ref_t*> [#uses=1]
+
+define %struct.NSArray* @"-[NSString(DocSetPrivateAddition) _dsa_stringAsPathComponent]"(%struct.NSArray* %self, %struct._message_ref_t* %_cmd) {
+entry:
+ br label %bb116
+
+bb116: ; preds = %bb131, %entry
+ %tmp123 = call %struct.NSRange null( %struct.NSObject* null, %struct._message_ref_t* @"\01L_OBJC_MESSAGE_REF_26", %struct.NSArray* null ) ; <%struct.NSRange> [#uses=1]
+ br i1 false, label %bb141, label %bb131
+
+bb131: ; preds = %bb116
+ %mrv_gr125 = getresult %struct.NSRange %tmp123, 1 ; <i64> [#uses=0]
+ br label %bb116
+
+bb141: ; preds = %bb116
+ ret %struct.NSArray* null
+}
diff --git a/test/Transforms/LoopRotate/PhiRename-1.ll b/test/Transforms/LoopRotate/PhiRename-1.ll
new file mode 100644
index 0000000..74426a8
--- /dev/null
+++ b/test/Transforms/LoopRotate/PhiRename-1.ll
@@ -0,0 +1,95 @@
+; RUN: opt < %s -loop-rotate -verify-dom-info -verify-loop-info -S | not grep {\\\[ .tmp224}
+; END.
+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"
+
+ %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
+ %struct.Index_Map = type { i32, %struct.item_set** }
+ %struct.Item = type { [4 x i16], %struct.rule* }
+ %struct.__sFILEX = type opaque
+ %struct.__sbuf = type { i8*, i32 }
+ %struct.dimension = type { i16*, %struct.Index_Map, %struct.mapping*, i32, %struct.plankMap* }
+ %struct.item_set = type { i32, i32, %struct.operator*, [2 x %struct.item_set*], %struct.item_set*, i16*, %struct.Item*, %struct.Item* }
+ %struct.list = type { i8*, %struct.list* }
+ %struct.mapping = type { %struct.list**, i32, i32, i32, %struct.item_set** }
+ %struct.nonterminal = type { i8*, i32, i32, i32, %struct.plankMap*, %struct.rule* }
+ %struct.operator = type { i8*, i8, i32, i32, i32, i32, %struct.table* }
+ %struct.pattern = type { %struct.nonterminal*, %struct.operator*, [2 x %struct.nonterminal*] }
+ %struct.plank = type { i8*, %struct.list*, i32 }
+ %struct.plankMap = type { %struct.list*, i32, %struct.stateMap* }
+ %struct.rule = type { [4 x i16], i32, i32, i32, %struct.nonterminal*, %struct.pattern*, i8 }
+ %struct.stateMap = type { i8*, %struct.plank*, i32, i16* }
+ %struct.table = type { %struct.operator*, %struct.list*, i16*, [2 x %struct.dimension*], %struct.item_set** }
+@outfile = external global %struct.FILE* ; <%struct.FILE**> [#uses=1]
+@str1 = external constant [11 x i8] ; <[11 x i8]*> [#uses=1]
+@operators = weak global %struct.list* null ; <%struct.list**> [#uses=1]
+
+
+
+define i32 @opsOfArity(i32 %arity) {
+entry:
+ %arity_addr = alloca i32 ; <i32*> [#uses=2]
+ %retval = alloca i32, align 4 ; <i32*> [#uses=2]
+ %tmp = alloca i32, align 4 ; <i32*> [#uses=2]
+ %c = alloca i32, align 4 ; <i32*> [#uses=4]
+ %l = alloca %struct.list*, align 4 ; <%struct.list**> [#uses=5]
+ %op = alloca %struct.operator*, align 4 ; <%struct.operator**> [#uses=3]
+ "alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 %arity, i32* %arity_addr
+ store i32 0, i32* %c
+ %tmp1 = load %struct.list** @operators ; <%struct.list*> [#uses=1]
+ store %struct.list* %tmp1, %struct.list** %l
+ br label %bb21
+
+bb: ; preds = %bb21
+ %tmp3 = getelementptr %struct.list* %tmp22, i32 0, i32 0 ; <i8**> [#uses=1]
+ %tmp4 = load i8** %tmp3 ; <i8*> [#uses=1]
+ %tmp45 = bitcast i8* %tmp4 to %struct.operator* ; <%struct.operator*> [#uses=1]
+ store %struct.operator* %tmp45, %struct.operator** %op
+ %tmp6 = load %struct.operator** %op ; <%struct.operator*> [#uses=1]
+ %tmp7 = getelementptr %struct.operator* %tmp6, i32 0, i32 5 ; <i32*> [#uses=1]
+ %tmp8 = load i32* %tmp7 ; <i32> [#uses=1]
+ %tmp9 = load i32* %arity_addr ; <i32> [#uses=1]
+ icmp eq i32 %tmp8, %tmp9 ; <i1>:0 [#uses=1]
+ zext i1 %0 to i8 ; <i8>:1 [#uses=1]
+ icmp ne i8 %1, 0 ; <i1>:2 [#uses=1]
+ br i1 %2, label %cond_true, label %cond_next
+
+cond_true: ; preds = %bb
+ %tmp10 = load %struct.operator** %op ; <%struct.operator*> [#uses=1]
+ %tmp11 = getelementptr %struct.operator* %tmp10, i32 0, i32 2 ; <i32*> [#uses=1]
+ %tmp12 = load i32* %tmp11 ; <i32> [#uses=1]
+ %tmp13 = load %struct.FILE** @outfile ; <%struct.FILE*> [#uses=1]
+ %tmp14 = getelementptr [11 x i8]* @str1, i32 0, i32 0 ; <i8*> [#uses=1]
+ %tmp15 = call i32 (%struct.FILE*, i8*, ...)* @fprintf( %struct.FILE* %tmp13, i8* %tmp14, i32 %tmp12 ) ; <i32> [#uses=0]
+ %tmp16 = load i32* %c ; <i32> [#uses=1]
+ %tmp17 = add i32 %tmp16, 1 ; <i32> [#uses=1]
+ store i32 %tmp17, i32* %c
+ br label %cond_next
+
+cond_next: ; preds = %cond_true, %bb
+ %tmp19 = getelementptr %struct.list* %tmp22, i32 0, i32 1 ; <%struct.list**> [#uses=1]
+ %tmp20 = load %struct.list** %tmp19 ; <%struct.list*> [#uses=1]
+ store %struct.list* %tmp20, %struct.list** %l
+ br label %bb21
+
+bb21: ; preds = %cond_next, %entry
+ %l.in = phi %struct.list** [ @operators, %entry ], [ %tmp19, %cond_next ]
+ %tmp22 = load %struct.list** %l.in ; <%struct.list*> [#uses=1]
+ icmp ne %struct.list* %tmp22, null ; <i1>:3 [#uses=1]
+ zext i1 %3 to i8 ; <i8>:4 [#uses=1]
+ icmp ne i8 %4, 0 ; <i1>:5 [#uses=1]
+ br i1 %5, label %bb, label %bb23
+
+bb23: ; preds = %bb21
+ %tmp24 = load i32* %c ; <i32> [#uses=1]
+ store i32 %tmp24, i32* %tmp
+ %tmp25 = load i32* %tmp ; <i32> [#uses=1]
+ store i32 %tmp25, i32* %retval
+ br label %return
+
+return: ; preds = %bb23
+ %retval26 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval26
+}
+
+declare i32 @fprintf(%struct.FILE*, i8*, ...)
diff --git a/test/Transforms/LoopRotate/PhiSelfRefernce-1.ll b/test/Transforms/LoopRotate/PhiSelfRefernce-1.ll
new file mode 100644
index 0000000..a1aa21b
--- /dev/null
+++ b/test/Transforms/LoopRotate/PhiSelfRefernce-1.ll
@@ -0,0 +1,39 @@
+; RUN: opt < %s -loop-rotate -verify-dom-info -verify-loop-info -disable-output
+; ModuleID = 'PhiSelfRefernce-1.bc'
+
+define void @snrm2(i32 %incx) {
+entry:
+ br i1 false, label %START, label %return
+
+START: ; preds = %entry
+ br i1 false, label %bb85, label %cond_false93
+
+bb52: ; preds = %bb85
+ br i1 false, label %bb307, label %cond_next71
+
+cond_next71: ; preds = %bb52
+ ret void
+
+bb85: ; preds = %START
+ br i1 false, label %bb52, label %bb88
+
+bb88: ; preds = %bb85
+ ret void
+
+cond_false93: ; preds = %START
+ ret void
+
+bb243: ; preds = %bb307
+ br label %bb307
+
+bb307: ; preds = %bb243, %bb52
+ %sx_addr.2.pn = phi float* [ %sx_addr.5, %bb243 ], [ null, %bb52 ] ; <float*> [#uses=1]
+ %sx_addr.5 = getelementptr float* %sx_addr.2.pn, i32 %incx ; <float*> [#uses=1]
+ br i1 false, label %bb243, label %bb310
+
+bb310: ; preds = %bb307
+ ret void
+
+return: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/LoopRotate/dg.exp b/test/Transforms/LoopRotate/dg.exp
new file mode 100644
index 0000000..f200589
--- /dev/null
+++ b/test/Transforms/LoopRotate/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
diff --git a/test/Transforms/LoopRotate/indirectbr.ll b/test/Transforms/LoopRotate/indirectbr.ll
new file mode 100644
index 0000000..9c82aa8
--- /dev/null
+++ b/test/Transforms/LoopRotate/indirectbr.ll
@@ -0,0 +1,43 @@
+; RUN: opt < %s -S -loop-rotate -disable-output -verify-loop-info -verify-dom-info
+; PR5502
+
+define void @z80_do_opcodes() nounwind {
+entry:
+ br label %while.cond
+
+while.cond: ; preds = %end_opcode, %entry
+ br label %while.body
+
+while.body: ; preds = %while.cond
+ br label %indirectgoto
+
+run_opcode: ; preds = %indirectgoto
+ %tmp276 = load i8* undef ; <i8> [#uses=1]
+ br label %indirectgoto
+
+if.else295: ; preds = %divide_late
+ br label %end_opcode
+
+end_opcode: ; preds = %indirectgoto, %sw.default42406, %sw.default, %if.else295
+ %opcode.2 = phi i8 [ %opcode.0, %indirectgoto ], [ 0, %sw.default42406 ], [ undef, %sw.default ], [ %opcode.0, %if.else295 ] ; <i8> [#uses=0]
+ switch i32 undef, label %while.cond [
+ i32 221, label %sw.bb11691
+ i32 253, label %sw.bb30351
+ ]
+
+sw.bb11691: ; preds = %end_opcode
+ br label %sw.default
+
+sw.default: ; preds = %sw.bb11691
+ br label %end_opcode
+
+sw.bb30351: ; preds = %end_opcode
+ br label %sw.default42406
+
+sw.default42406: ; preds = %sw.bb30351
+ br label %end_opcode
+
+indirectgoto: ; preds = %run_opcode, %while.body
+ %opcode.0 = phi i8 [ undef, %while.body ], [ %tmp276, %run_opcode ] ; <i8> [#uses=2]
+ indirectbr i8* undef, [label %run_opcode, label %if.else295, label %end_opcode]
+}
diff --git a/test/Transforms/LoopRotate/phi-duplicate.ll b/test/Transforms/LoopRotate/phi-duplicate.ll
new file mode 100644
index 0000000..cac00f8
--- /dev/null
+++ b/test/Transforms/LoopRotate/phi-duplicate.ll
@@ -0,0 +1,35 @@
+; RUN: opt -S %s -loop-rotate | 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"
+target triple = "x86_64-apple-darwin10.0"
+
+; PR5837
+define void @test(i32 %N, double* %G) nounwind ssp {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %j.0 = phi i64 [ 1, %entry ], [ %inc, %for.body ] ; <i64> [#uses=5]
+ %cmp = icmp slt i64 %j.0, 1000 ; <i1> [#uses=1]
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %arrayidx = getelementptr inbounds double* %G, i64 %j.0 ; <double*> [#uses=1]
+ %tmp3 = load double* %arrayidx ; <double> [#uses=1]
+ %sub = sub i64 %j.0, 1 ; <i64> [#uses=1]
+ %arrayidx6 = getelementptr inbounds double* %G, i64 %sub ; <double*> [#uses=1]
+ %tmp7 = load double* %arrayidx6 ; <double> [#uses=1]
+ %add = fadd double %tmp3, %tmp7 ; <double> [#uses=1]
+ %arrayidx10 = getelementptr inbounds double* %G, i64 %j.0 ; <double*> [#uses=1]
+ store double %add, double* %arrayidx10
+ %inc = add nsw i64 %j.0, 1 ; <i64> [#uses=1]
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+; Should only end up with one phi.
+; CHECK: for.body:
+; CHECK-NEXT: %j.02 = phi i64
+; CHECK-NOT phi
+; CHECK: ret void
+
diff --git a/test/Transforms/LoopRotate/pr2639.ll b/test/Transforms/LoopRotate/pr2639.ll
new file mode 100644
index 0000000..da9a3a2
--- /dev/null
+++ b/test/Transforms/LoopRotate/pr2639.ll
@@ -0,0 +1,38 @@
+; RUN: opt < %s -loop-deletion -loop-rotate -verify-dom-info -verify-loop-info -disable-output
+; PR 2639
+
+ %struct.HexxagonMove = type { i8, i8, i32 }
+
+define void @_ZN16HexxagonMoveList7addMoveER12HexxagonMove() {
+entry:
+ br i1 false, label %bb9.preheader, label %bb11
+
+bb9.preheader: ; preds = %entry
+ br label %bb9
+
+bb1: ; preds = %bb9
+ br i1 false, label %bb3, label %bb8
+
+bb3: ; preds = %bb1
+ br label %bb5
+
+bb4: ; preds = %bb5
+ br label %bb5
+
+bb5: ; preds = %bb4, %bb3
+ %exitcond = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %exitcond, label %bb7, label %bb4
+
+bb7: ; preds = %bb5
+ store %struct.HexxagonMove* null, %struct.HexxagonMove** null, align 4
+ br label %bb8
+
+bb8: ; preds = %bb7, %bb1
+ br label %bb9
+
+bb9: ; preds = %bb8, %bb9.preheader
+ br i1 false, label %bb11, label %bb1
+
+bb11: ; preds = %bb9, %entry
+ ret void
+}
diff --git a/test/Transforms/LoopRotate/preserve-scev.ll b/test/Transforms/LoopRotate/preserve-scev.ll
new file mode 100644
index 0000000..7bd2232
--- /dev/null
+++ b/test/Transforms/LoopRotate/preserve-scev.ll
@@ -0,0 +1,47 @@
+; RUN: opt < %s -loop-rotate -loop-reduce -verify-dom-info -verify-loop-info -disable-output
+
+define fastcc void @foo() nounwind {
+BB:
+ br label %BB1
+
+BB1: ; preds = %BB19, %BB
+ br label %BB4
+
+BB2: ; preds = %BB4
+ %tmp = bitcast i32 undef to i32 ; <i32> [#uses=1]
+ br label %BB4
+
+BB4: ; preds = %BB3, %BB1
+ %tmp5 = phi i32 [ undef, %BB1 ], [ %tmp, %BB2 ] ; <i32> [#uses=1]
+ br i1 false, label %BB8, label %BB2
+
+BB8: ; preds = %BB6
+ %tmp7 = bitcast i32 %tmp5 to i32 ; <i32> [#uses=2]
+ br i1 false, label %BB9, label %BB13
+
+BB9: ; preds = %BB12, %BB8
+ %tmp10 = phi i32 [ %tmp11, %BB12 ], [ %tmp7, %BB8 ] ; <i32> [#uses=2]
+ %tmp11 = add i32 %tmp10, 1 ; <i32> [#uses=1]
+ br label %BB12
+
+BB12: ; preds = %BB9
+ br i1 false, label %BB9, label %BB17
+
+BB13: ; preds = %BB15, %BB8
+ %tmp14 = phi i32 [ %tmp16, %BB15 ], [ %tmp7, %BB8 ] ; <i32> [#uses=1]
+ br label %BB15
+
+BB15: ; preds = %BB13
+ %tmp16 = add i32 %tmp14, -1 ; <i32> [#uses=1]
+ br i1 false, label %BB13, label %BB18
+
+BB17: ; preds = %BB12
+ br label %BB19
+
+BB18: ; preds = %BB15
+ br label %BB19
+
+BB19: ; preds = %BB18, %BB17
+ %tmp20 = phi i32 [ %tmp10, %BB17 ], [ undef, %BB18 ] ; <i32> [#uses=0]
+ br label %BB1
+}