[llvm] 4b36d9b - [CVP] Preserve exact name when converting sext->zext and ashr->lshr.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue May 10 09:14:07 PDT 2022
Author: Craig Topper
Date: 2022-05-10T09:13:59-07:00
New Revision: 4b36d9bde7ac48f1dc93e724a8812fddfda68483
URL: https://github.com/llvm/llvm-project/commit/4b36d9bde7ac48f1dc93e724a8812fddfda68483
DIFF: https://github.com/llvm/llvm-project/commit/4b36d9bde7ac48f1dc93e724a8812fddfda68483.diff
LOG: [CVP] Preserve exact name when converting sext->zext and ashr->lshr.
Previously we took the old name and always appended a numberic suffix.
Since we're doing a 1:1 replacement, it's clearer to keep the original
name exactly.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D125281
Added:
Modified:
llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index f9a117625642..eae7467948e0 100644
--- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -961,7 +961,8 @@ static bool processAShr(BinaryOperator *SDI, LazyValueInfo *LVI) {
++NumAShrsConverted;
auto *BO = BinaryOperator::CreateLShr(SDI->getOperand(0), SDI->getOperand(1),
- SDI->getName(), SDI);
+ "", SDI);
+ BO->takeName(SDI);
BO->setDebugLoc(SDI->getDebugLoc());
BO->setIsExact(SDI->isExact());
SDI->replaceAllUsesWith(BO);
@@ -980,8 +981,8 @@ static bool processSExt(SExtInst *SDI, LazyValueInfo *LVI) {
return false;
++NumSExt;
- auto *ZExt =
- CastInst::CreateZExtOrBitCast(Base, SDI->getType(), SDI->getName(), SDI);
+ auto *ZExt = CastInst::CreateZExtOrBitCast(Base, SDI->getType(), "", SDI);
+ ZExt->takeName(SDI);
ZExt->setDebugLoc(SDI->getDebugLoc());
SDI->replaceAllUsesWith(ZExt);
SDI->eraseFromParent();
More information about the llvm-commits
mailing list