-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[llvm][DebugInfo] Emit 0/1 for constant boolean values #151225
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
ayermolo
merged 4 commits into
llvm:main
from
laxmansole:user/lsole/boolean_constants_as_literals
Nov 3, 2025
+40
−3
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
63aa87f
[DWARF] Emit 0/1 for constant boolean values
laxmansole 8600698
Move DW_OP_lit0/1 related change to separate PR
laxmansole 8092f6a
Zero-extend 1-bit constantInt operands of the DbgValue
laxmansole 0968b1f
Fixed an expected test failure caused by these changes
laxmansole 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
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,29 @@ | ||
| ; REQUIRES: object-emission | ||
| ; RUN: %llc_dwarf %s -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s | ||
|
|
||
| ; CHECK: {{.*}}DW_TAG_variable | ||
| ; CHECK-NEXT: {{.*}} DW_AT_const_value (1) | ||
| ; CHECK-NEXT: {{.*}} DW_AT_name ("arg") | ||
|
|
||
| define void @test() !dbg !5 | ||
| { | ||
| entry: | ||
| call void @"llvm.dbg.value"(metadata i1 true, metadata !7, metadata !8), !dbg !6 | ||
| ret void, !dbg !6 | ||
| } | ||
|
|
||
| declare void @"llvm.dbg.value"(metadata %".1", metadata %".2", metadata %".3") | ||
|
|
||
| !llvm.dbg.cu = !{ !2 } | ||
| !llvm.module.flags = !{ !9, !10 } | ||
|
|
||
| !1 = !DIFile(directory: "", filename: "test") | ||
| !2 = distinct !DICompileUnit(emissionKind: FullDebug, file: !1, isOptimized: false, language: DW_LANG_C_plus_plus, runtimeVersion: 0) | ||
| !3 = !DIBasicType(encoding: DW_ATE_boolean, name: "bool", size: 8) | ||
| !4 = !DISubroutineType(types: !{null}) | ||
| !5 = distinct !DISubprogram(file: !1, isDefinition: true, isLocal: false, isOptimized: false, line: 5, linkageName: "test", name: "test", scope: !1, scopeLine: 5, type: !4, unit: !2) | ||
| !6 = !DILocation(column: 1, line: 5, scope: !5) | ||
| !7 = !DILocalVariable(arg: 0, file: !1, line: 5, name: "arg", scope: !5, type: !3) | ||
| !8 = !DIExpression() | ||
| !9 = !{ i32 2, !"Dwarf Version", i32 4 } | ||
| !10 = !{ i32 2, !"Debug Info Version", i32 3 } |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we modifying
GlobalISel? I think it was working correctly there already right?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Immediate values need to be sign-extended for correctness. Consider a case where the immediate operand is a negative value.
An exception to this would be 1-bit values, as they don't have a notion of sign, and sign-extending them changes their value like 1 becomes -1.