[llvm] 3a2fbf5 - [AggressiveInstCombine] Avoid use of ConstantExpr::getIntegerCast() (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 1 04:24:47 PDT 2023
Author: Nikita Popov
Date: 2023-11-01T12:22:56+01:00
New Revision: 3a2fbf547d09c51669d00c1557d5818fce0c8639
URL: https://github.com/llvm/llvm-project/commit/3a2fbf547d09c51669d00c1557d5818fce0c8639
DIFF: https://github.com/llvm/llvm-project/commit/3a2fbf547d09c51669d00c1557d5818fce0c8639.diff
LOG: [AggressiveInstCombine] Avoid use of ConstantExpr::getIntegerCast() (NFC)
This transform only deals in truncations, so use
ConstantExpr::getTrunc() instead of ConstantExpr::getIntegerCast()
to clarify what operation is being performed here.
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 6c62e84077acefd..4d9050be5c5531e 100644
--- a/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
+++ b/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
@@ -366,7 +366,7 @@ static Type *getReducedType(Value *V, Type *Ty) {
Value *TruncInstCombine::getReducedOperand(Value *V, Type *SclTy) {
Type *Ty = getReducedType(V, SclTy);
if (auto *C = dyn_cast<Constant>(V)) {
- C = ConstantExpr::getIntegerCast(C, Ty, false);
+ C = ConstantExpr::getTrunc(C, Ty);
// If we got a constantexpr back, try to simplify it with DL info.
return ConstantFoldConstant(C, DL, &TLI);
}
More information about the llvm-commits
mailing list