summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 48eaef59e72..324ec8aac04 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -3062,10 +3062,16 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
// See if we can simplify any instructions used by the instruction whose sole
// purpose is to compute bits we don't care about.
uint64_t KnownZero, KnownOne;
- if (!isa<PackedType>(I.getType()) &&
- SimplifyDemandedBits(&I, I.getType()->getIntegerTypeMask(),
- KnownZero, KnownOne))
+ if (!isa<PackedType>(I.getType())) {
+ if (SimplifyDemandedBits(&I, I.getType()->getIntegerTypeMask(),
+ KnownZero, KnownOne))
return &I;
+ } else {
+ if (ConstantPacked *CP = dyn_cast<ConstantPacked>(Op1)) {
+ if (CP->isAllOnesValue())
+ return ReplaceInstUsesWith(I, I.getOperand(0));
+ }
+ }
if (ConstantInt *AndRHS = dyn_cast<ConstantInt>(Op1)) {
uint64_t AndRHSMask = AndRHS->getZExtValue();
OpenPOWER on IntegriCloud