Add Loop Rotate test cases.
authorDevang Patel <dpatel@apple.com>
Mon, 9 Apr 2007 22:22:42 +0000 (22:22 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 9 Apr 2007 22:22:42 +0000 (22:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35838 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/LoopRotate/LRCrash-1.ll [new file with mode: 0644]
test/Transforms/LoopRotate/LRCrash-2.ll [new file with mode: 0644]
test/Transforms/LoopRotate/LRCrash-3.ll [new file with mode: 0644]
test/Transforms/LoopRotate/LRCrash-4.ll [new file with mode: 0644]
test/Transforms/LoopRotate/PhiRename-1.ll [new file with mode: 0644]
test/Transforms/LoopRotate/PhiSelfRefernce-1.ll [new file with mode: 0644]
test/Transforms/LoopRotate/dg.exp [new file with mode: 0644]

diff --git a/test/Transforms/LoopRotate/LRCrash-1.ll b/test/Transforms/LoopRotate/LRCrash-1.ll
new file mode 100644 (file)
index 0000000..0149482
--- /dev/null
@@ -0,0 +1,27 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -loop-rotate -disable-output
+
+
+       %struct.relation = type { [4 x i16], i32, [4 x i16], i32, i32 }
+
+
+
+
+
+
+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 (file)
index 0000000..bceeb91
--- /dev/null
@@ -0,0 +1,30 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -loop-rotate -disable-output
+
+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 (file)
index 0000000..e927035
--- /dev/null
@@ -0,0 +1,41 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -loop-rotate -disable-output
+
+
+
+
+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 (file)
index 0000000..721132d
--- /dev/null
@@ -0,0 +1,20 @@
+; RUN: llvm-upgrade < %s | llvm-as | opt -loop-rotate -disable-output
+
+
+void @InterpretSEIMessage(i8* %msg) {
+entry:
+       br label %bb15
+
+bb6:           ; preds = %bb15
+       %tmp11 = getelementptr i8* %msg, i32 %offset.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/PhiRename-1.ll b/test/Transforms/LoopRotate/PhiRename-1.ll
new file mode 100644 (file)
index 0000000..4dd6ed2
--- /dev/null
@@ -0,0 +1,94 @@
+; RUN: llvm-as < %s | opt -loop-rotate | llvm-dis | not grep "\[ .tmp224" 
+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 (file)
index 0000000..d7e84f6
--- /dev/null
@@ -0,0 +1,41 @@
+; RUN: llvm-as < %s | opt -loop-rotate -disable-output
+; ModuleID = 'PhiSelfRefernce-1.bc'
+
+implementation   ; Functions:
+
+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 (file)
index 0000000..142de8a
--- /dev/null
@@ -0,0 +1,3 @@
+load_lib llvm-dg.exp
+
+llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext $llvmgcc_version