summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-18 22:16:33 +0000
committerChris Lattner <sabre@nondot.org>2007-01-18 22:16:33 +0000
commit120ab038eb0c86e2e796e65ceaaecd90d9c3e431 (patch)
tree73fed2a2f2877d817979042b47b1753ae007aa6c /llvm/lib/Transforms/Scalar
parentbb4e2a547fe771d3d14a6c4c5f777b4e05f88da2 (diff)
downloadbcm5719-llvm-120ab038eb0c86e2e796e65ceaaecd90d9c3e431.tar.gz
bcm5719-llvm-120ab038eb0c86e2e796e65ceaaecd90d9c3e431.zip
Fix InstCombine/2007-01-18-VectorInfLoop.ll, a case where instcombine
infinitely loops. llvm-svn: 33343
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-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