diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2013-12-06 21:48:36 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2013-12-06 21:48:36 +0000 |
commit | ce5f93efd55285bf4ab1adcd9511973213e03982 (patch) | |
tree | 27ef2044480087ce965429ab65daa93cbf40ea97 /llvm/test/Transforms/InstCombine/phi-select-constexpr.ll | |
parent | 3dedae12b5453757055857e83a1f2624bf08d914 (diff) | |
download | bcm5719-llvm-ce5f93efd55285bf4ab1adcd9511973213e03982.tar.gz bcm5719-llvm-ce5f93efd55285bf4ab1adcd9511973213e03982.zip |
Don't use isNullValue to evaluate ConstantExpr
ConstantExpr can evaluate to false even when isNullValue gives false.
Fixes PR18143.
llvm-svn: 196611
Diffstat (limited to 'llvm/test/Transforms/InstCombine/phi-select-constexpr.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/phi-select-constexpr.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/phi-select-constexpr.ll b/llvm/test/Transforms/InstCombine/phi-select-constexpr.ll new file mode 100644 index 00000000000..054e0691d47 --- /dev/null +++ b/llvm/test/Transforms/InstCombine/phi-select-constexpr.ll @@ -0,0 +1,19 @@ +; RUN: opt < %s -S -instcombine | FileCheck %s +@A = extern_weak global i32, align 4 +@B = extern_weak global i32, align 4 + +define i32 @foo(i1 %which) { +entry: + br i1 %which, label %final, label %delay + +delay: + br label %final + +; CHECK-LABEL: final: +; CHECK: phi i32 [ 1, %entry ], [ select (i1 icmp eq (i32* @A, i32* @B), i32 2, i32 1), %delay ] +final: + %use2 = phi i1 [ false, %entry ], [ icmp eq (i32* @A, i32* @B), %delay ] + %value = select i1 %use2, i32 2, i32 1 + ret i32 %value +} + |