[llvm] [SelectionDAG] Reland debuginfo salvage for load/ext combines (PR #194700)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 00:39:43 PDT 2026


================
@@ -15044,11 +15119,22 @@ static SDValue tryToFoldExtOfLoad(SelectionDAG &DAG, DAGCombiner &Combiner,
                       DAG.getValueType(Load->getValueType(0).getScalarType()));
   }
   Combiner.ExtendSetCCUses(SetCCs, N0, Res, ExtOpc);
-  Combiner.CombineTo(N, Res);
+  // If the load value is used only by N, replace it via CombineTo N.
+  unsigned Opcode_N = N->getOpcode();
+  bool IsSigned = Opcode_N == ISD::SIGN_EXTEND;
+  SDValue OldLoadVal(Load, 0);
+  SDValue OldExtValue(N, 0);
----------------
OCHyams wrote:

nit: Can these variables be sunk into the lexical block they're used in (`if (NoReplaceTrunc) { ... }`)?

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


More information about the llvm-commits mailing list