[llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/2006-08-02-Switch.ll predsimplify.ll
Nick Lewycky
nicholas at mxc.ca
Sat Sep 2 12:40:52 PDT 2006
Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier:
2006-08-02-Switch.ll added (r1.1)
predsimplify.ll updated: 1.1 -> 1.2
---
Log message:
Improve handling of SelectInst.
Reorder operations to remove duplicated work.
Fix to leave floating-point types out of the optimization.
Add tests to predsimplify.ll for SwitchInst and SelectInst handling.
---
Diffs of the changes: (+185 -1)
2006-08-02-Switch.ll | 22 ++++++
predsimplify.ll | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 185 insertions(+), 1 deletion(-)
Index: llvm/test/Regression/Transforms/PredicateSimplifier/2006-08-02-Switch.ll
diff -c /dev/null llvm/test/Regression/Transforms/PredicateSimplifier/2006-08-02-Switch.ll:1.1
*** /dev/null Sat Sep 2 14:40:48 2006
--- llvm/test/Regression/Transforms/PredicateSimplifier/2006-08-02-Switch.ll Sat Sep 2 14:40:38 2006
***************
*** 0 ****
--- 1,22 ----
+ ; RUN: llvm-as < %s | opt -predsimplify -disable-output
+
+ fastcc void %_ov_splice(int %n1, int %n2, int %ch2) {
+ entry:
+ %tmp = setgt int %n1, %n2 ; <bool> [#uses=1]
+ %n.0 = select bool %tmp, int %n2, int %n1 ; <int> [#uses=1]
+ %tmp104 = setlt int 0, %ch2 ; <bool> [#uses=1]
+ br bool %tmp104, label %cond_true105, label %return
+
+ cond_true95: ; preds = %cond_true105
+ ret void
+
+ bb98: ; preds = %cond_true105
+ ret void
+
+ cond_true105: ; preds = %entry
+ %tmp94 = setgt int %n.0, 0 ; <bool> [#uses=1]
+ br bool %tmp94, label %cond_true95, label %bb98
+
+ return: ; preds = %entry
+ ret void
+ }
Index: llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll
diff -u llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll:1.1 llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll:1.2
--- llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll:1.1 Mon Aug 28 17:44:55 2006
+++ llvm/test/Regression/Transforms/PredicateSimplifier/predsimplify.ll Sat Sep 2 14:40:38 2006
@@ -1,4 +1,5 @@
-; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | not grep fail
+; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | not grep fail &&
+; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | grep pass | wc -l | grep 3
void %test1(int %x) {
entry:
@@ -124,6 +125,167 @@
ret void
}
+void %test9(int %y, int %z) {
+entry:
+ %x = add int %y, %z
+ %A = seteq int %y, 3
+ %B = seteq int %z, 5
+ %C = and bool %A, %B
+ br bool %C, label %cond_true, label %return
+
+cond_true:
+ %D = seteq int %x, 8
+ br bool %D, label %then, label %oops
+
+then:
+ call void (...)* %pass( )
+ ret void
+
+oops:
+ call void (...)* %fail( )
+ ret void
+
+return:
+ ret void
+}
+
+void %switch1(int %x) {
+entry:
+ %A = seteq int %x, 10
+ br bool %A, label %return, label %cond_false
+
+cond_false:
+ switch int %x, label %return [
+ int 9, label %then1
+ int 10, label %then2
+ ]
+
+then1:
+ call void (...)* %pass( )
+ ret void
+
+then2:
+ call void (...)* %fail( )
+ ret void
+
+return:
+ ret void
+}
+
+void %switch2(int %x) {
+entry:
+ %A = seteq int %x, 10
+ br bool %A, label %return, label %cond_false
+
+cond_false:
+ switch int %x, label %return [
+ int 8, label %then1
+ int 9, label %then1
+ int 10, label %then1
+ ]
+
+then1:
+ %B = setne int %x, 8
+ br bool %B, label %then2, label %return
+
+then2:
+ call void (...)* %pass( )
+ ret void
+
+return:
+ ret void
+}
+
+void %switch3(int %x) {
+entry:
+ %A = seteq int %x, 10
+ br bool %A, label %return, label %cond_false
+
+cond_false:
+ switch int %x, label %return [
+ int 9, label %then1
+ int 10, label %then1
+ ]
+
+then1:
+ %B = seteq int %x, 9
+ br bool %B, label %return, label %oops
+
+oops:
+ call void (...)* %fail( )
+ ret void
+
+return:
+ ret void
+}
+
+void %switch4(int %x) {
+entry:
+ %A = seteq int %x, 10
+ br bool %A, label %then1, label %cond_false
+
+cond_false:
+ switch int %x, label %default [
+ int 9, label %then1
+ int 10, label %then2
+ ]
+
+then1:
+ ret void
+
+then2:
+ ret void
+
+default:
+ %B = seteq int %x, 9
+ br bool %B, label %oops, label %then1
+
+oops:
+ call void (...)* %fail( )
+ ret void
+}
+
+void %select1(int %x) {
+entry:
+ %A = seteq int %x, 10
+ %B = select bool %A, int 1, int 2
+ %C = seteq int %B, 1
+ br bool %C, label %then, label %else
+
+then:
+ br bool %A, label %return, label %oops
+
+else:
+ br bool %A, label %oops, label %return
+
+oops:
+ call void (...)* %fail( )
+ ret void
+
+return:
+ ret void
+}
+
+void %select2(int %x) {
+entry:
+ %A = seteq int %x, 10
+ %B = select bool %A, int 1, int 2
+ %C = seteq int %B, 1
+ br bool %A, label %then, label %else
+
+then:
+ br bool %C, label %return, label %oops
+
+else:
+ br bool %C, label %oops, label %return
+
+oops:
+ call void (...)* %fail( )
+ ret void
+
+return:
+ ret void
+}
declare void %fail(...)
More information about the llvm-commits
mailing list