diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2006-08-28 22:44:55 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2006-08-28 22:44:55 +0000 |
commit | 05450ae12828337c52f27d68ec9d611dda93c939 (patch) | |
tree | b23d7b8c3146d73cd59192453e16c34dcf111a34 /test/Transforms/PredicateSimplifier/predsimplify.ll | |
parent | 67afeceaf04d9ba2773531e9d6f0e541636768d7 (diff) |
Add PredicateSimplifier pass. Collapses equal variables into one form
and simplifies expressions. This implements the optimization described
in PR807.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29947 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/PredicateSimplifier/predsimplify.ll')
-rw-r--r-- | test/Transforms/PredicateSimplifier/predsimplify.ll | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/test/Transforms/PredicateSimplifier/predsimplify.ll b/test/Transforms/PredicateSimplifier/predsimplify.ll new file mode 100644 index 0000000000..056d8c97dc --- /dev/null +++ b/test/Transforms/PredicateSimplifier/predsimplify.ll @@ -0,0 +1,130 @@ +; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | not grep fail + +void %test1(int %x) { +entry: + %A = seteq int %x, 0 + br bool %A, label %then.1, label %else.1 +then.1: + %B = seteq int %x, 1 + br bool %B, label %then.2, label %else.1 +then.2: + call void (...)* %fail( ) + ret void +else.1: + ret void +} + +void %test2(int %x) { +entry: + %A = seteq int %x, 0 + %B = seteq int %x, 1 + br bool %A, label %then.1, label %else.1 +then.1: + br bool %B, label %then.2, label %else.1 +then.2: + call void (...)* %fail( ) + ret void +else.1: + ret void +} + +void %test3(int %x) { +entry: + %A = seteq int %x, 0 + %B = seteq int %x, 1 + br bool %A, label %then.1, label %else.1 +then.1: + br bool %B, label %then.2, label %else.1 +then.2: + call void (...)* %fail( ) + ret void +else.1: + ret void +} + +void %test4(int %x, int %y) { +entry: + %A = seteq int %x, 0 + %B = seteq int %y, 0 + %C = and bool %A, %B + br bool %C, label %then.1, label %else.1 +then.1: + %D = seteq int %x, 0 + br bool %D, label %then.2, label %else.2 +then.2: + %E = seteq int %y, 0 + br bool %E, label %else.1, label %else.2 +else.1: + ret void +else.2: + call void (...)* %fail( ) + ret void +} + +void %test5(int %x) { +entry: + %A = seteq int %x, 0 + br bool %A, label %then.1, label %else.1 +then.1: + ret void +then.2: + call void (...)* %fail( ) + ret void +else.1: + %B = seteq int %x, 0 + br bool %B, label %then.2, label %then.1 +} + +void %test6(int %x, int %y) { +entry: + %A = seteq int %x, 0 + %B = seteq int %y, 0 + %C = or bool %A, %B + br bool %C, label %then.1, label %else.1 +then.1: + ret void +then.2: + call void (...)* %fail( ) + ret void +else.1: + %D = seteq int %x, 0 + br bool %D, label %then.2, label %else.2 +else.2: + %E = setne int %y, 0 + br bool %E, label %then.1, label %then.2 +} + +void %test7(int %x) { +entry: + %A = setne int %x, 0 + %B = xor bool %A, true + br bool %B, label %then.1, label %else.1 +then.1: + %C = seteq int %x, 1 + br bool %C, label %then.2, label %else.1 +then.2: + call void (...)* %fail( ) + ret void +else.1: + ret void +} + +void %test8(int %x) { +entry: + %A = add int %x, 1 + %B = seteq int %x, 0 + br bool %B, label %then.1, label %then.2 +then.1: + %C = seteq int %A, 1 + br bool %C, label %then.2, label %else.2 +then.2: + ret void +else.2: + call void (...)* %fail( ) + ret void +} + + +declare void %fail(...) + +declare void %pass(...) |