[llvm] r331948 - [InstCombine] Reorder an if condition to put a cheap check in front of a computeKnownBits call. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed May 9 17:53:25 PDT 2018
Author: ctopper
Date: Wed May 9 17:53:25 2018
New Revision: 331948
URL: http://llvm.org/viewvc/llvm-project?rev=331948&view=rev
Log:
[InstCombine] Reorder an if condition to put a cheap check in front of a computeKnownBits call. NFC
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=331948&r1=331947&r2=331948&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Wed May 9 17:53:25 2018
@@ -393,9 +393,9 @@ static bool canEvaluateTruncated(Value *
if (match(I->getOperand(1), m_APInt(Amt))) {
uint32_t OrigBitWidth = OrigTy->getScalarSizeInBits();
uint32_t BitWidth = Ty->getScalarSizeInBits();
- if (IC.MaskedValueIsZero(I->getOperand(0),
- APInt::getBitsSetFrom(OrigBitWidth, BitWidth), 0, CxtI) &&
- Amt->getLimitedValue(BitWidth) < BitWidth) {
+ if (Amt->getLimitedValue(BitWidth) < BitWidth &&
+ IC.MaskedValueIsZero(I->getOperand(0),
+ APInt::getBitsSetFrom(OrigBitWidth, BitWidth), 0, CxtI)) {
return canEvaluateTruncated(I->getOperand(0), Ty, IC, CxtI);
}
}
More information about the llvm-commits
mailing list