diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2015-06-06 04:56:51 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2015-06-06 04:56:51 +0000 |
| commit | 1c297e66fb839f574cfe2796acbcb8a499168259 (patch) | |
| tree | 42816f8ae0041cdd6ad62481a5e41a68bd5850cb /llvm/test/Transforms/CorrelatedValuePropagation/select.ll | |
| parent | 743afa0736588cec9f189b3700cac57482af17cc (diff) | |
| download | bcm5719-llvm-1c297e66fb839f574cfe2796acbcb8a499168259.tar.gz bcm5719-llvm-1c297e66fb839f574cfe2796acbcb8a499168259.zip | |
[CVP] Don't assume Constants of type i1 can be known to be true or false
CVP wants to analyze the condition operand of a select along an edge.
It succeeds in getting back a Constant but not a ConstantInt. Instead,
it gets a ConstantExpr. It then assumes that the Constant must be equal
to false because it isn't equal to true.
Instead, perform an additional comparison.
This fixes PR23752.
llvm-svn: 239217
Diffstat (limited to 'llvm/test/Transforms/CorrelatedValuePropagation/select.ll')
| -rw-r--r-- | llvm/test/Transforms/CorrelatedValuePropagation/select.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/select.ll b/llvm/test/Transforms/CorrelatedValuePropagation/select.ll index 5501438f690..d88e3e462a2 100644 --- a/llvm/test/Transforms/CorrelatedValuePropagation/select.ll +++ b/llvm/test/Transforms/CorrelatedValuePropagation/select.ll @@ -51,3 +51,25 @@ else: ret i8 %b } +@c = global i32 0, align 4 +@b = global i32 0, align 4 + +; CHECK-LABEL: @PR23752( +define i32 @PR23752() { +entry: + br label %for.body + +for.body: + %phi = phi i32 [ 0, %entry ], [ %sel, %for.body ] + %sel = select i1 icmp sgt (i32* @b, i32* @c), i32 %phi, i32 1 + %cmp = icmp ne i32 %sel, 1 + br i1 %cmp, label %for.body, label %if.end + +; CHECK: %[[sel:.*]] = select i1 icmp sgt (i32* @b, i32* @c), i32 0, i32 1 +; CHECK-NEXT: %[[cmp:.*]] = icmp ne i32 %[[sel]], 1 +; CHECK-NEXT: br i1 %[[cmp]] + +if.end: + ret i32 %sel +; CHECK: ret i32 %[[sel]] +} |

