diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-01-05 22:01:41 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-01-05 22:01:41 +0000 | 
| commit | f88dd5ed64c83cab98ada56fc99a2c73180791aa (patch) | |
| tree | d4270911cfb09f2ce771be3306566fc1b93a33e0 /llvm/lib/Transforms | |
| parent | 26751ffc53a2ef70f72b7a2ed3652b845c50d141 (diff) | |
| download | bcm5719-llvm-f88dd5ed64c83cab98ada56fc99a2c73180791aa.tar.gz bcm5719-llvm-f88dd5ed64c83cab98ada56fc99a2c73180791aa.zip | |
remove two trunc xforms that are subsumed by EvaluateInDifferentType.
The only difference is that EvaluateInDifferentType checks to ensure
they are profitable before doing them :)
llvm-svn: 92788
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 36 | 
1 files changed, 0 insertions, 36 deletions
| diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 4d44cc97704..cea510967fe 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -628,7 +628,6 @@ Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) {    return 0;  } -  Instruction *InstCombiner::visitTrunc(TruncInst &CI) {    if (Instruction *Result = commonIntCastTransforms(CI))      return Result; @@ -646,41 +645,6 @@ Instruction *InstCombiner::visitTrunc(TruncInst &CI) {      return new ICmpInst(ICmpInst::ICMP_NE, Src, Zero);    } -  // Optimize trunc(lshr(x, c)) to pull the shift through the truncate. -  ConstantInt *ShAmtV = 0; -  Value *ShiftOp = 0; -  if (Src->hasOneUse() && -      match(Src, m_LShr(m_Value(ShiftOp), m_ConstantInt(ShAmtV)))) { -    uint32_t ShAmt = ShAmtV->getLimitedValue(SrcBitWidth); -     -    // Get a mask for the bits shifting in. -    APInt Mask(APInt::getLowBitsSet(SrcBitWidth, ShAmt).shl(DestBitWidth)); -    if (MaskedValueIsZero(ShiftOp, Mask)) { -      if (ShAmt >= DestBitWidth)        // All zeros. -        return ReplaceInstUsesWith(CI, Constant::getNullValue(DestTy)); -       -      // Okay, we can shrink this.  Truncate the input, then return a new -      // shift. -      Value *V1 = Builder->CreateTrunc(ShiftOp, DestTy, ShiftOp->getName()); -      Value *V2 = ConstantExpr::getTrunc(ShAmtV, DestTy); -      return BinaryOperator::CreateLShr(V1, V2); -    } -  } -   -  // Transform trunc(shl(X, C)) -> shl(trunc(X), C) -  if (Src->hasOneUse() && -      match(Src, m_Shl(m_Value(ShiftOp), m_ConstantInt(ShAmtV)))) { -    uint32_t ShAmt = ShAmtV->getLimitedValue(SrcBitWidth); -    if (ShAmt >= DestBitWidth)        // All zeros. -      return ReplaceInstUsesWith(CI, Constant::getNullValue(DestTy)); -       -    // Okay, we can shrink this.  Truncate the input, then return a new -    // shift. -    Value *V1 = Builder->CreateTrunc(ShiftOp, DestTy, ShiftOp->getName()); -    Value *V2 = ConstantExpr::getTrunc(ShAmtV, DestTy); -    return BinaryOperator::CreateShl(V1, V2); -  } -    return 0;  } | 

