-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[SelectionDAG] Salvage debuginfo when combining load and sext instrs. #169779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rastogishubham
wants to merge
5
commits into
llvm:main
Choose a base branch
from
rastogishubham:DAGCombineLoadSext
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+113
−1
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6073623
[SelectionDAG]Salvage debuginfo when combining load and sext instrs.
rastogishubham 44e346c
Addressed review feedback:
rastogishubham e5dbea2
Addressed review feedback
rastogishubham a5e79b9
Change MIR test to llvm IR test and removed -O2
rastogishubham 363ab5e
Addressed review feedback:
rastogishubham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| ; This test checks that after SelectionDAG runs, it preserves the debug info that is lost due to the DAGCombiner combining a load and a sext instruction, where the #dbg_value is pointing to the result of the load. | ||
|
|
||
rastogishubham marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ; RUN: llc %s -mtriple=x86_64-unkown-linux -start-before=x86-isel -stop-after=x86-isel -o - | FileCheck %s --check-prefix=MIR | ||
| ; RUN: llc -O2 %s -start-before=x86-isel -mtriple=x86_64-unkown-linux --filetype=obj -o %t.o | ||
| ; RUN: llvm-dwarfdump %t.o --name Idx | FileCheck %s --check-prefix=DUMP | ||
|
|
||
rastogishubham marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ; MIR: ![[IDX:[0-9]+]] = !DILocalVariable(name: "Idx" | ||
| ; MIR-LABEL: bb.0 | ||
| ; MIR: %{{[0-9a-f]+}}{{.*}} = MOVSX64rm32 ${{.*}}, 1, $noreg, @GlobArr, $noreg, debug-instr-number [[INSTR_NUM:[0-9]+]] | ||
| ; MIR-NEXT: DBG_INSTR_REF ![[IDX]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed), dbg-instr-ref([[INSTR_NUM]], 0) | ||
|
|
||
| ; DUMP: DW_AT_location (indexed ({{[0-9a-f]+}}x{{[0-9a-f]+}}) loclist = 0x{{[0-9]+}}: | ||
| ; DUMP-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_breg0 RAX+0, DW_OP_convert (0x{{[0-9a-f]+}}) "DW_ATE_signed_32", DW_OP_convert (0x{{[0-9a-f]+}}) "DW_ATE_signed_64") | ||
|
|
||
| @GlobArr = dso_local local_unnamed_addr global [5 x i32] [i32 1, i32 1, i32 2, i32 3, i32 5], align 16, !dbg !0 | ||
| @__const.main.Data = private unnamed_addr constant [7 x i32] [i32 10, i32 20, i32 30, i32 40, i32 50, i32 60, i32 70], align 16 | ||
| define dso_local void @_Z8useValuei(i32 noundef %0) local_unnamed_addr #0 !dbg !22 { | ||
| ret void, !dbg !28 | ||
| } | ||
| define dso_local noundef i32 @main() local_unnamed_addr #1 !dbg !29 { | ||
| %1 = load i32, ptr @GlobArr | ||
| #dbg_value(i32 %1, !43, !DIExpression(), !52) | ||
| %2 = sext i32 %1 to i64 | ||
| %3 = getelementptr inbounds i32, ptr @__const.main.Data, i64 %2 | ||
| %4 = load i32, ptr %3 | ||
| tail call void @_Z8useValuei(i32 noundef %4), !dbg !56 | ||
| ret i32 0 | ||
| } | ||
| !llvm.dbg.cu = !{!2} | ||
| !llvm.module.flags = !{!10, !11, !16} | ||
| !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) | ||
| !1 = distinct !DIGlobalVariable(type: !6, isDefinition: true) | ||
| !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, emissionKind: FullDebug, nameTableKind: None) | ||
| !3 = !DIFile(filename: "/tmp/test.cpp", directory: "/Users/srastogi/Development/llvm-project/build_ninja", checksumkind: CSK_MD5, checksum: "0fe735937e606b4db3e3b2e9253eff90") | ||
| !6 = !DICompositeType(tag: DW_TAG_array_type, elements: !8) | ||
| !7 = !DIBasicType() | ||
| !8 = !{} | ||
| !10 = !{i32 7, !"Dwarf Version", i32 5} | ||
| !11 = !{i32 2, !"Debug Info Version", i32 3} | ||
| !16 = !{i32 7, !"debug-info-assignment-tracking", i1 true} | ||
| !22 = distinct !DISubprogram(type: !23, unit: !2, keyInstructions: true) | ||
| !23 = !DISubroutineType(types: !24) | ||
| !24 = !{} | ||
| !28 = !DILocation(scope: !22, atomRank: 1) | ||
| !29 = distinct !DISubprogram(type: !30, unit: !2, keyInstructions: true) | ||
| !30 = !DISubroutineType(types: !31) | ||
| !31 = !{} | ||
| !38 = distinct !DILexicalBlock(scope: !29, line: 5, column: 3) | ||
| !43 = !DILocalVariable(name: "Idx", scope: !44, type: !7) | ||
| !44 = distinct !DILexicalBlock(scope: !38, line: 5, column: 3) | ||
| !46 = distinct !DILexicalBlock(scope: !44, line: 5, column: 27) | ||
| !52 = !DILocation(scope: !44) | ||
| !56 = !DILocation(scope: !46) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.