summaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine/InstructionCombining.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/InstCombine/InstructionCombining.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstructionCombining.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp
index 1eb98b18bfb5..1792cb585f87 100644
--- a/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2182,8 +2182,8 @@ Instruction *InstCombiner::visitReturnInst(ReturnInst &RI) {
// determine the value. If so, constant fold it.
KnownBits Known(VTy->getPrimitiveSizeInBits());
computeKnownBits(ResultOp, Known, 0, &RI);
- if ((Known.Zero|Known.One).isAllOnesValue())
- RI.setOperand(0, Constant::getIntegerValue(VTy, Known.One));
+ if (Known.isConstant())
+ RI.setOperand(0, Constant::getIntegerValue(VTy, Known.getConstant()));
return nullptr;
}
@@ -2863,8 +2863,8 @@ bool InstCombiner::run() {
unsigned BitWidth = Ty->getScalarSizeInBits();
KnownBits Known(BitWidth);
computeKnownBits(I, Known, /*Depth*/0, I);
- if ((Known.Zero | Known.One).isAllOnesValue()) {
- Constant *C = ConstantInt::get(Ty, Known.One);
+ if (Known.isConstant()) {
+ Constant *C = ConstantInt::get(Ty, Known.getConstant());
DEBUG(dbgs() << "IC: ConstFold (all bits known) to: " << *C <<
" from: " << *I << '\n');