[PATCH] D125281: [CVP] Preserve exact name when converting sext->zext and ashr->lshr.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 17:02:04 PDT 2022


craig.topper created this revision.
craig.topper added reviewers: spatel, reames, efriedma, fhahn.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125281

Files:
  llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp


Index: llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -961,7 +961,8 @@
 
   ++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);
@@ -981,7 +982,8 @@
 
   ++NumSExt;
   auto *ZExt =
-      CastInst::CreateZExtOrBitCast(Base, SDI->getType(), SDI->getName(), SDI);
+      CastInst::CreateZExtOrBitCast(Base, SDI->getType(), "", SDI);
+  ZExt->takeName(SDI);
   ZExt->setDebugLoc(SDI->getDebugLoc());
   SDI->replaceAllUsesWith(ZExt);
   SDI->eraseFromParent();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125281.428241.patch
Type: text/x-patch
Size: 956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220510/ccbac886/attachment.bin>


More information about the llvm-commits mailing list