summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-08-19 16:53:18 +0000
committerReid Kleckner <rnk@google.com>2016-08-19 16:53:18 +0000
commita871d3872ac55cfab62492e2a1fb7b056d204668 (patch)
tree88342a495dfac403c4a7d04165a189af3f695ca0 /llvm/lib/Transforms
parent9d7ac684a9b1ca0bac19f429417736c4d3635129 (diff)
downloadbcm5719-llvm-a871d3872ac55cfab62492e2a1fb7b056d204668.tar.gz
bcm5719-llvm-a871d3872ac55cfab62492e2a1fb7b056d204668.zip
Fix regression in InstCombine introduced by r278944
The intended transform is: // Simplify icmp eq (or (ptrtoint P), (ptrtoint Q)), 0 // -> and (icmp eq P, null), (icmp eq Q, null). P and Q are both pointer types, but may have different types. We need two calls to getNullValue() to make the icmps. llvm-svn: 279271
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 262c86cb59f..12f716d5023 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -1893,9 +1893,10 @@ Instruction *InstCombiner::foldICmpOrConstant(ICmpInst &Cmp, Instruction *Or,
if (match(Or, m_Or(m_PtrToInt(m_Value(P)), m_PtrToInt(m_Value(Q))))) {
// Simplify icmp eq (or (ptrtoint P), (ptrtoint Q)), 0
// -> and (icmp eq P, null), (icmp eq Q, null).
- Constant *NullVal = ConstantInt::getNullValue(P->getType());
- Value *CmpP = Builder->CreateICmp(Pred, P, NullVal);
- Value *CmpQ = Builder->CreateICmp(Pred, Q, NullVal);
+ Value *CmpP =
+ Builder->CreateICmp(Pred, P, ConstantInt::getNullValue(P->getType()));
+ Value *CmpQ =
+ Builder->CreateICmp(Pred, Q, ConstantInt::getNullValue(Q->getType()));
auto LogicOpc = Pred == ICmpInst::Predicate::ICMP_EQ ? Instruction::And
: Instruction::Or;
return BinaryOperator::Create(LogicOpc, CmpP, CmpQ);
OpenPOWER on IntegriCloud