[llvm] [InstCombine] Call InstSimplify for cast instructions (PR #162849)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 15 07:02:01 PDT 2025


================
@@ -11,10 +11,8 @@ define i16 @test5(i16 %A) !dbg !34 {
   call void @llvm.dbg.value(metadata i32 %C, metadata !37, metadata !DIExpression()), !dbg !41
 
   ; Preserve the dbg.value for the DCE'd 32-bit 'and'.
-  ;
-  ; The high 16 bits of the original 'and' require sign-extending the new 16-bit and:
   ; CHECK-NEXT: #dbg_value(i16 [[and]], [[C:![0-9]+]],
-  ; CHECK-SAME:    !DIExpression(DW_OP_LLVM_convert, 16, DW_ATE_signed, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_stack_value)
+  ; CHECK-SAME:    !DIExpression(DW_OP_LLVM_convert, 16, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_stack_value)
----------------
OCHyams wrote:

Hmm this is interesting. Salvaging (`salvageDebugInfo`) a trunk or s|zext adds a `convert` which is signed if the instruction `isa<SExtInst>`, whereas `replaceAllDbgUsesWith` applies the signedness of the variable itself (ignores the instruction).

It's not immediately clear to me which is best.

Either way, I think we should consider that separately and I don't think it should block this change.

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


More information about the llvm-commits mailing list