Skip to content

Commit 1d0a139

Browse files
committed
update per copilot suggestion
1 parent e9d5680 commit 1d0a139

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,13 +1529,13 @@ Instruction *InstCombinerImpl::visitSExt(SExtInst &Sext) {
15291529

15301530
// Try to extend the entire expression tree to the wide destination type.
15311531
bool shouldExtendExpression = true;
1532-
Value *X = nullptr;
1532+
Value *Trunc = nullptr;
15331533
// Do not extend expression in the trunc + sext pattern when destination type
15341534
// is narrower than original (pre-trunc) type: modern architectures typically
15351535
// provide efficient sign-extend instruction, so preserving the sext is
15361536
// preferable here.
1537-
if (match(Src, m_Trunc(m_Value(X))))
1538-
if (X->getType()->getScalarSizeInBits() > DestBitSize)
1537+
if (match(Src, m_Trunc(m_Value(Trunc))))
1538+
if (Trunc->getType()->getScalarSizeInBits() > DestBitSize)
15391539
shouldExtendExpression = false;
15401540
if (shouldExtendExpression && shouldChangeType(SrcTy, DestTy) &&
15411541
canEvaluateSExtd(Src, DestTy)) {
@@ -1558,6 +1558,7 @@ Instruction *InstCombinerImpl::visitSExt(SExtInst &Sext) {
15581558
ShAmt);
15591559
}
15601560

1561+
Value *X = Trunc;
15611562
if (X) {
15621563
// If the input has more sign bits than bits truncated, then convert
15631564
// directly to final type.

0 commit comments

Comments
 (0)