diff options
| author | Kay Tiong Khoo <kkhoo@perfwizard.com> | 2013-12-02 22:20:40 +0000 |
|---|---|---|
| committer | Kay Tiong Khoo <kkhoo@perfwizard.com> | 2013-12-02 22:20:40 +0000 |
| commit | 64b732005feb0d987c7671f9d6f7e97e15479903 (patch) | |
| tree | 2a0b7e344c3a2e5aba9c572fc74e203a2e543d13 /llvm/lib/Transforms/InstCombine | |
| parent | a9e0540c78d569bd01207a3965aca55c0eed3b26 (diff) | |
| download | bcm5719-llvm-64b732005feb0d987c7671f9d6f7e97e15479903.tar.gz bcm5719-llvm-64b732005feb0d987c7671f9d6f7e97e15479903.zip | |
Move variables to where they are used and give them better names. No functional change intended.
llvm-svn: 196163
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index d597885a64b..a40545115d4 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -1194,8 +1194,6 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, ConstantInt *ShAmt; ShAmt = Shift ? dyn_cast<ConstantInt>(Shift->getOperand(1)) : 0; - Type *Ty = Shift ? Shift->getType() : 0; // Type of the shift. - Type *AndTy = AndCst->getType(); // Type of the and. // We can fold this as long as we can't shift unknown bits // into the mask. This can happen with signed shift @@ -1210,11 +1208,15 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, if (ShiftOpcode == Instruction::AShr) { // To test for the bad case of the signed shr, see if any // of the bits shifted in could be tested after the mask. - uint32_t TyBits = Ty->getPrimitiveSizeInBits(); - int ShAmtVal = TyBits - ShAmt->getLimitedValue(TyBits); + Type *ShiftType = Shift->getType(); + Type *AndType = AndCst->getType(); + + unsigned ShiftBitWidth = ShiftType->getPrimitiveSizeInBits(); + unsigned AndBitWidth = AndType->getPrimitiveSizeInBits(); - uint32_t BitWidth = AndTy->getPrimitiveSizeInBits(); - if ((APInt::getHighBitsSet(BitWidth, BitWidth-ShAmtVal) & + int ShAmtVal = ShiftBitWidth - ShAmt->getLimitedValue(ShiftBitWidth); + + if ((APInt::getHighBitsSet(AndBitWidth, AndBitWidth - ShAmtVal) & AndCst->getValue()) == 0) CanFold = true; } else if (ShiftOpcode == Instruction::Shl || |

