[CVP] Don't assume Constants of type i1 can be known to be true or false
authorDavid Majnemer <david.majnemer@gmail.com>
Sat, 6 Jun 2015 04:56:51 +0000 (04:56 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sat, 6 Jun 2015 04:56:51 +0000 (04:56 +0000)
commite46e8af4d7f36f7d14acd515c11c61a9bc9deea5
tree7c26196bc6f74192a0c56a3cd2bcce35747bfc8d
parentb21b529990e868311911c40c9261820c8502edbf
[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239217 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
test/Transforms/CorrelatedValuePropagation/select.ll