diff options
author | Dan Gohman <gohman@apple.com> | 2009-10-30 23:16:10 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-10-30 23:16:10 +0000 |
commit | cf35517c4ed90250526095a2b1d76ba1f77f5c35 (patch) | |
tree | 1a8372f153cb7d6caeb31f9d1b6acb155f1d1b94 /test/Transforms/SimplifyCFG | |
parent | 0e747beb3cfc48ebcb0a2f8b962f0d0de525d979 (diff) | |
download | external_llvm-cf35517c4ed90250526095a2b1d76ba1f77f5c35.zip external_llvm-cf35517c4ed90250526095a2b1d76ba1f77f5c35.tar.gz external_llvm-cf35517c4ed90250526095a2b1d76ba1f77f5c35.tar.bz2 |
Add a testcase for the recent duplicate PHI elimination changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/SimplifyCFG')
-rw-r--r-- | test/Transforms/SimplifyCFG/duplicate-phis.ll | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Transforms/SimplifyCFG/duplicate-phis.ll b/test/Transforms/SimplifyCFG/duplicate-phis.ll new file mode 100644 index 0000000..a1e5113 --- /dev/null +++ b/test/Transforms/SimplifyCFG/duplicate-phis.ll @@ -0,0 +1,21 @@ +; RUN: opt < %s -instcombine -simplifycfg -S | grep { = phi } | count 1 + +; instcombine should sort the PHI operands so that simplifycfg can see the +; duplicate and remove it. + +define i32 @foo(i1 %t) { +entry: + call void @bar() + br i1 %t, label %true, label %false, +true: + call void @bar() + br label %false +false: + %a = phi i32 [ 2, %true ], [ 5, %entry ] + %b = phi i32 [ 5, %entry ], [ 2, %true ] + call void @bar() + %c = add i32 %a, %b + ret i32 %c +} + +declare void @bar() |