diff options
author | Evan Cheng <evan.cheng@apple.com> | 2009-04-14 23:40:03 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2009-04-14 23:40:03 +0000 |
commit | 62366a7522a71725498bd7e58f531cc34de27433 (patch) | |
tree | 39dcd92a82a6b0c733e1183aed2df3c7e7a204a0 /test | |
parent | 85159cb2d1757ba452b33055b9e72216349d46b2 (diff) | |
download | external_llvm-62366a7522a71725498bd7e58f531cc34de27433.zip external_llvm-62366a7522a71725498bd7e58f531cc34de27433.tar.gz external_llvm-62366a7522a71725498bd7e58f531cc34de27433.tar.bz2 |
Optimize conditional branch on i1 phis with non-constant inputs.
This turns:
eq:
%3 = icmp eq i32 %1, %2
br label %join
ne:
%4 = icmp ne i32 %1, %2
br label %join
join:
%5 = phi i1 [%3, %eq], [%4, %ne]
br i1 %5, label %yes, label %no
=>
eq:
%3 = icmp eq i32 %1, %2
br i1 %3, label %yes, label %no
ne:
%4 = icmp ne i32 %1, %2
br i1 %4, label %yes, label %no
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69102 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/CondProp/phisimplify3.ll | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/Transforms/CondProp/phisimplify3.ll b/test/Transforms/CondProp/phisimplify3.ll new file mode 100644 index 0000000..1678597 --- /dev/null +++ b/test/Transforms/CondProp/phisimplify3.ll @@ -0,0 +1,26 @@ +; RUN: llvm-as < %s | opt -condprop | llvm-dis | not grep phi + +define i32 @foo(i1, i32, i32) { +prologue: + br i1 %0, label %eq, label %ne + +eq: ; preds = %prologue + store i32 0, i32* inttoptr (i32 10000 to i32*) + %3 = icmp eq i32 %1, %2 ; <i1> [#uses=1] + br label %join + +ne: ; preds = %prologue + %4 = icmp ne i32 %1, %2 ; <i1> [#uses=1] + br label %join + +join: ; preds = %ne, %eq + %5 = phi i1 [ %3, %eq ], [ %4, %ne ] ; <i1> [#uses=1] + br i1 %5, label %yes, label %no + +yes: ; preds = %join + store i32 0, i32* inttoptr (i32 20000 to i32*) + ret i32 5 + +no: ; preds = %join + ret i32 20 +} |