Fix InstCombine/2007-01-18-VectorInfLoop.ll, a case where instcombine
authorChris Lattner <sabre@nondot.org>
Thu, 18 Jan 2007 22:16:33 +0000 (22:16 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 18 Jan 2007 22:16:33 +0000 (22:16 +0000)
infinitely loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33343 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index 48eaef59e72c985fa79d64eb8597bc3a10f67f1a..324ec8aac04af3c880509088747e3afc91a3de63 100644 (file)
@@ -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();