Make SimplifyDemandedUseBits generate vector constants where
authorEli Friedman <eli.friedman@gmail.com>
Mon, 3 Aug 2009 19:15:42 +0000 (19:15 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Mon, 3 Aug 2009 19:15:42 +0000 (19:15 +0000)
appropriate.  Patch per report on llvmdev.  No testcase because the
original report didn't come with a testcase, and I can't come up with a case
that actually fails.

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

lib/Transforms/Scalar/InstructionCombining.cpp

index 0a6153db812d7b5ab19865ac16dcbcb9eed2a905..4d2248e291788640f8146a8b7847d4bf1c7c02e7 100644 (file)
@@ -1014,7 +1014,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
     if ((DemandedMask & (RHSKnownZero|RHSKnownOne)) == DemandedMask) { 
       // all known
       if ((RHSKnownOne & LHSKnownOne) == RHSKnownOne) {
-        Constant *AndC = ConstantInt::get(*Context
+        Constant *AndC = ConstantInt::get(VTy
                                           ~RHSKnownOne & DemandedMask);
         Instruction *And = 
           BinaryOperator::CreateAnd(I->getOperand(0), AndC, "tmp");
@@ -1407,7 +1407,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
   // If the client is only demanding bits that we know, return the known
   // constant.
   if ((DemandedMask & (RHSKnownZero|RHSKnownOne)) == DemandedMask) {
-    Constant *C = ConstantInt::get(*Context, RHSKnownOne);
+    Constant *C = ConstantInt::get(VTy, RHSKnownOne);
     if (isa<PointerType>(V->getType()))
       C = ConstantExpr::getIntToPtr(C, V->getType());
     return C;