diff options
| author | Shuxin Yang <shuxin.llvm@gmail.com> | 2012-12-12 00:29:03 +0000 | 
|---|---|---|
| committer | Shuxin Yang <shuxin.llvm@gmail.com> | 2012-12-12 00:29:03 +0000 | 
| commit | 81b36785640e8d96f2eeb8365e4db3166f823a70 (patch) | |
| tree | b69e874d75d9b7f86f3931c27896b7045ce3902d /llvm/lib/Transforms | |
| parent | d5787be5baa6e08cb17f8da6860e3a674c8e02d0 (diff) | |
| download | bcm5719-llvm-81b36785640e8d96f2eeb8365e4db3166f823a70.tar.gz bcm5719-llvm-81b36785640e8d96f2eeb8365e4db3166f823a70.zip | |
- Fix a problematic way in creating all-the-1 APInt.
- Propagate "exact" bit of [l|a]shr instruction.
llvm-svn: 169942
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp | 6 | 
1 files changed, 4 insertions, 2 deletions
| diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp index 08aedb3200a..13653183a79 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp @@ -858,8 +858,8 @@ Value *InstCombiner::SimplifyShrShlDemandedBits(Instruction *Shr,    Value *VarX = Shr->getOperand(0);    Type *Ty = VarX->getType(); -  APInt BitMask1(Ty->getIntegerBitWidth(), (uint64_t)-1); -  APInt BitMask2(Ty->getIntegerBitWidth(), (uint64_t)-1); +  APInt BitMask1(APInt::getAllOnesValue(Ty->getIntegerBitWidth())); +  APInt BitMask2(APInt::getAllOnesValue(Ty->getIntegerBitWidth()));    bool isLshr = (Shr->getOpcode() == Instruction::LShr);    BitMask1 = isLshr ? (BitMask1.lshr(ShrAmt) << ShlAmt) : @@ -891,6 +891,8 @@ Value *InstCombiner::SimplifyShrShlDemandedBits(Instruction *Shr,        Constant *Amt = ConstantInt::get(VarX->getType(), ShrAmt - ShlAmt);        New = isLshr ? BinaryOperator::CreateLShr(VarX, Amt) :                       BinaryOperator::CreateAShr(VarX, Amt); +      if (cast<BinaryOperator>(Shr)->isExact()) +        New->setIsExact(true);      }      return InsertNewInstWith(New, *Shl); | 

