[llvm] 3890ce7 - [NFC][AggressiveInstCombine] Simplify code for shift truncation
Anton Afanasyev via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 19 20:50:10 PDT 2021
Author: Anton Afanasyev
Date: 2021-08-20T06:37:02+03:00
New Revision: 3890ce708d4f94d0326172650ce22262f6b56661
URL: https://github.com/llvm/llvm-project/commit/3890ce708d4f94d0326172650ce22262f6b56661
DIFF: https://github.com/llvm/llvm-project/commit/3890ce708d4f94d0326172650ce22262f6b56661.diff
LOG: [NFC][AggressiveInstCombine] Simplify code for shift truncation
Added:
Modified:
llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
index ad4653ca5f1d8..c593e27aa4022 100644
--- a/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
+++ b/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
@@ -286,11 +286,10 @@ Type *TruncInstCombine::getBestTruncatedType() {
if (I->getOpcode() == Instruction::Shl ||
I->getOpcode() == Instruction::LShr) {
KnownBits KnownRHS = computeKnownBits(I->getOperand(1), DL);
- const unsigned SrcBitWidth = KnownRHS.getBitWidth();
unsigned MinBitWidth = KnownRHS.getMaxValue()
- .uadd_sat(APInt(SrcBitWidth, 1))
- .getLimitedValue(SrcBitWidth);
- if (MinBitWidth >= OrigBitWidth)
+ .uadd_sat(APInt(OrigBitWidth, 1))
+ .getLimitedValue(OrigBitWidth);
+ if (MinBitWidth == OrigBitWidth)
return nullptr;
if (I->getOpcode() == Instruction::LShr) {
KnownBits KnownLHS = computeKnownBits(I->getOperand(0), DL);
More information about the llvm-commits
mailing list