[llvm] [InstCombine] Retain exact instruction name for some cases in Simplif… (PR #68371)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 5 18:21:49 PDT 2023
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/68371
…yDemandedUseBits.
Retain name for SExt->ZExt and AShr->LShr. Previously SExt->ZExt copied the name with a numeric suffix. AShr->LShr dropped it.
>From 3c4dcfa4b0efda4c2419db596d3f3ce58e6be2fe Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Thu, 5 Oct 2023 18:17:01 -0700
Subject: [PATCH] [InstCombine] Retain exact instruction name for some cases in
SimplifyDemandedUseBits.
Retain name for SExt->ZExt and AShr->LShr. Previously SExt->ZExt copied the name
with a numeric suffix. AShr->LShr dropped it.
---
.../Transforms/InstCombine/InstCombineSimplifyDemanded.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index abdaf167d3d9dfb..5b5d2da041f1447 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -461,7 +461,8 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
if (InputKnown.isNonNegative() ||
DemandedMask.getActiveBits() <= SrcBitWidth) {
// Convert to ZExt cast.
- CastInst *NewCast = new ZExtInst(I->getOperand(0), VTy, I->getName());
+ CastInst *NewCast = new ZExtInst(I->getOperand(0), VTy);
+ NewCast->takeName(I);
return InsertNewInstWith(NewCast, I->getIterator());
}
@@ -770,6 +771,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
BinaryOperator *LShr = BinaryOperator::CreateLShr(I->getOperand(0),
I->getOperand(1));
LShr->setIsExact(cast<BinaryOperator>(I)->isExact());
+ LShr->takeName(I);
return InsertNewInstWith(LShr, I->getIterator());
} else if (Known.One[BitWidth-ShiftAmt-1]) { // New bits are known one.
Known.One |= HighBits;
More information about the llvm-commits
mailing list