[llvm] [Instcombine] Avoid widening trunc+sext to trunc+shl+ashr when not profitable (PR #160483)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 25 03:12:23 PDT 2025


================
@@ -1528,7 +1528,15 @@ Instruction *InstCombinerImpl::visitSExt(SExtInst &Sext) {
   }
 
   // Try to extend the entire expression tree to the wide destination type.
-  if (shouldChangeType(SrcTy, DestTy) && canEvaluateSExtd(Src, DestTy)) {
+  bool shouldExtendExpression = true;
----------------
dtcxzyw wrote:

```suggestion
  bool ShouldExtendExpression = true;
```

https://github.com/llvm/llvm-project/pull/160483


More information about the llvm-commits mailing list