-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[InstCombine][DebugInfo] Update debug value uses in freelyInvertAllUsersOf
#137013
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
414b0c7
[InstCombine] Add pre-commit tests. NFC.
dtcxzyw 417f7b2
[InstCombine] Update debug value uses in `freelyInvertAllUsersOf`
dtcxzyw cc85606
[InstCombine] Simplify code. NFC.
dtcxzyw b904311
[InstCombine] Simplify tests. NFC.
dtcxzyw 20070fb
[InstCombine] Address review comments. NFC.
dtcxzyw a572e79
[InstCombine] Handle `!DIArgList`
dtcxzyw 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: opt -passes=instcombine -S %s -o - | FileCheck %s | ||
|
||
; Make sure that the DIExpression is updated correctly after InstCombinerImpl::freelyInvertAllUsersOf. | ||
|
||
define i32 @test(i32 noundef %x, i32 noundef %y) !dbg !10 { | ||
; CHECK-LABEL: define i32 @test( | ||
; CHECK-SAME: i32 noundef [[X:%.*]], i32 noundef [[Y:%.*]]) !dbg [[DBG10:![0-9]+]] { | ||
; CHECK-NEXT: [[ENTRY:.*:]] | ||
; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i32 [[X]], 0 | ||
; CHECK-NEXT: #dbg_value(i1 [[CMP_NOT]], [[META15:![0-9]+]], !DIExpression(DW_OP_not, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_stack_value), [[META16:![0-9]+]]) | ||
; CHECK-NEXT: #dbg_value(!DIArgList(i1 false, i1 [[CMP_NOT]]), [[META17:![0-9]+]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_not, DW_OP_or, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 8, DW_ATE_unsigned, DW_OP_stack_value), [[META16]]) | ||
; CHECK-NEXT: [[TMP0:%.*]] = and i32 [[Y]], 1 | ||
; CHECK-NEXT: [[AND:%.*]] = select i1 [[CMP_NOT]], i32 0, i32 [[TMP0]] | ||
; CHECK-NEXT: ret i32 [[AND]] | ||
; | ||
entry: | ||
%cmp = icmp ne i32 %x, 0 | ||
%conv = zext i1 %cmp to i32 | ||
#dbg_value(i32 %conv, !15, !DIExpression(), !16) | ||
#dbg_value(!DIArgList(i1 false, i1 %cmp), !17, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_or, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 8, DW_ATE_unsigned, DW_OP_stack_value), !18) | ||
%and = and i32 %conv, %y | ||
ret i32 %and | ||
} | ||
|
||
!llvm.dbg.cu = !{!0} | ||
!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8} | ||
!llvm.ident = !{!9} | ||
|
||
!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 21.0.0git", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) | ||
!1 = !DIFile(filename: "test.c", directory: "/", checksumkind: CSK_MD5, checksum: "b2d9ffc7905684d8b7c3b52a3136e57c") | ||
!2 = !{i32 7, !"Dwarf Version", i32 5} | ||
!3 = !{i32 2, !"Debug Info Version", i32 3} | ||
!4 = !{i32 1, !"wchar_size", i32 4} | ||
!5 = !{i32 8, !"PIC Level", i32 2} | ||
!6 = !{i32 7, !"PIE Level", i32 2} | ||
!7 = !{i32 7, !"uwtable", i32 2} | ||
!8 = !{i32 7, !"debug-info-assignment-tracking", i1 true} | ||
!9 = !{!"clang version 21.0.0git"} | ||
!10 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 1, type: !11, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14) | ||
!11 = !DISubroutineType(types: !12) | ||
!12 = !{!13, !13, !13} | ||
!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) | ||
!14 = !{!15} | ||
!15 = !DILocalVariable(name: "z", scope: !10, file: !1, line: 2, type: !13) | ||
!16 = !DILocation(line: 0, scope: !10) | ||
!17 = !DILocalVariable(name: "w", scope: !10, file: !1, line: 3, type: !13) | ||
!18 = !DILocation(line: 0, scope: !10) | ||
;. | ||
; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], producer: "{{.*}}clang version {{.*}}", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) | ||
; CHECK: [[META1]] = !DIFile(filename: "{{.*}}test.c", directory: {{.*}}) | ||
; CHECK: [[DBG10]] = distinct !DISubprogram(name: "test", scope: [[META1]], file: [[META1]], line: 1, type: [[META11:![0-9]+]], scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META14:![0-9]+]]) | ||
; CHECK: [[META11]] = !DISubroutineType(types: [[META12:![0-9]+]]) | ||
; CHECK: [[META12]] = !{[[META13:![0-9]+]], [[META13]], [[META13]]} | ||
; CHECK: [[META13]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) | ||
; CHECK: [[META14]] = !{[[META15]]} | ||
; CHECK: [[META15]] = !DILocalVariable(name: "z", scope: [[DBG10]], file: [[META1]], line: 2, type: [[META13]]) | ||
; CHECK: [[META16]] = !DILocation(line: 0, scope: [[DBG10]]) | ||
; CHECK: [[META17]] = !DILocalVariable(name: "w", scope: [[DBG10]], file: [[META1]], line: 3, type: [[META13]]) | ||
;. |
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.