diff options
author | Chris Lattner <sabre@nondot.org> | 2007-01-18 22:16:33 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-01-18 22:16:33 +0000 |
commit | 696ee0ab15bf300444423bc3a6b29313a94232c3 (patch) | |
tree | 74a51e24313f54172be47a0bf931ef34dd84874f | |
parent | e68266dc7600aafbf3c246371a785134cc933a02 (diff) |
Fix InstCombine/2007-01-18-VectorInfLoop.ll, a case where instcombine
infinitely loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33343 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 48eaef59e7..324ec8aac0 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/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(); |