[PATCH] D69809: Wrong debug info generated at -O2 (-O0 is correct)

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 11:43:11 PST 2019


vsk added a comment.

@kamleshbhalui thanks for working on this, and welcome to llvm :)

`eraseInstFromFunction` already calls `salvageDebufInfo`: why not have it call `replaceDbgUsesWithUndef` as well, or better, define a `salvageDebufInfoOrMarkUndef` helper? I'd expect that to be reasonable to tackle in this patch.



================
Comment at: llvm/test/Transforms/InstCombine/stacksave-debuginfo.ll:11
 ; CHECK-LABEL: @test1(
-; CHECK-NEXT:    [[TMP1:%.*]] = zext i32 [[P:%.*]] to i64, !dbg !12
-; CHECK-NEXT:    [[A:%.*]] = alloca i32, i64 [[TMP1]], align 4, !dbg !12
-; CHECK-NEXT:    call void @llvm.dbg.value(metadata i32* [[A]], metadata !11, metadata !DIExpression()), !dbg !12
-; CHECK-NEXT:    ret i32* [[A]], !dbg !13
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i8* undef, metadata !9, metadata !DIExpression()), !dbg !12
+; CHECK-NEXT:    [[TMP1:%.*]] = zext i32 [[P:%.*]] to i64, !dbg !13
----------------
Please do not hardcode metadata numbers in check lines. If the variable referenced by a metadata node is obvious from context, it's better not to match the number at all.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69809/new/

https://reviews.llvm.org/D69809





More information about the llvm-commits mailing list