-
Notifications
You must be signed in to change notification settings - Fork 14.6k
[HWASAN] Update dbg.assign intrinsics in HWAsan pass #79864
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
4 commits
Select commit
Hold shift + click to select a range
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
72 changes: 72 additions & 0 deletions
72
llvm/test/CodeGen/AArch64/dbg-assign-tag-offset-mix-loc.ll
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,72 @@ | ||
; RUN: llc -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s | ||
; RUN: llc --try-experimental-debuginfo-iterators -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s | ||
|
||
;; Similar to dbg-assign-tag-offset.ll except the variable 'x' has been removed | ||
;; and 'y' has an implicit location range as well as stack location range | ||
;; (according to the hand-modified debug info -- see the dbg.value). | ||
|
||
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" | ||
target triple = "aarch64-unknown-linux-android24" | ||
|
||
; CHECK: DW_TAG_variable | ||
; CHECK-NOT: DW_TAG | ||
; CHECK: DW_AT_LLVM_tag_offset (0x80) | ||
; CHECK-NEXT: DW_AT_name ("y") | ||
|
||
define dso_local void @f() !dbg !14 { | ||
%1 = alloca i32, align 4, !DIAssignID !31 | ||
%2 = alloca i32, align 4, !DIAssignID !32 | ||
call void @llvm.dbg.assign(metadata i1 undef, metadata !20, metadata !DIExpression(), metadata !32, metadata ptr %2, metadata !DIExpression(DW_OP_LLVM_tag_offset, 128)), !dbg !22 | ||
call void @llvm.dbg.value(metadata i32 2, metadata !20, metadata !DIExpression()), !dbg !22 | ||
call void @use(ptr null), !dbg !28 | ||
store i32 1, ptr %2, align 4, !dbg !23, !tbaa !24, !DIAssignID !33 | ||
call void @llvm.dbg.assign(metadata i32 1, metadata !20, metadata !DIExpression(), metadata !33, metadata ptr %2, metadata !DIExpression(DW_OP_LLVM_tag_offset, 128)), !dbg !22 | ||
call void @use(ptr nonnull %1), !dbg !28 | ||
call void @use(ptr nonnull %2), !dbg !29 | ||
ret void, !dbg !30 | ||
} | ||
|
||
declare !dbg !5 void @use(ptr) | ||
|
||
declare void @llvm.dbg.value(metadata, metadata, metadata) | ||
declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) | ||
|
||
!llvm.dbg.cu = !{!0} | ||
!llvm.module.flags = !{!8, !9, !10, !11, !12, !34} | ||
!llvm.ident = !{!13} | ||
|
||
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None) | ||
!1 = !DIFile(filename: "dbg.cc", directory: "/tmp") | ||
!2 = !{} | ||
!3 = !{!4, !5} | ||
!4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) | ||
!5 = !DISubprogram(name: "use", scope: !1, file: !1, line: 2, type: !6, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) | ||
!6 = !DISubroutineType(types: !7) | ||
!7 = !{null, !4} | ||
!8 = !{i32 7, !"Dwarf Version", i32 4} | ||
!9 = !{i32 2, !"Debug Info Version", i32 3} | ||
!10 = !{i32 1, !"wchar_size", i32 4} | ||
!11 = !{i32 7, !"PIC Level", i32 2} | ||
!12 = !{i32 7, !"PIE Level", i32 2} | ||
!13 = !{!"clang version 10.0.0"} | ||
!14 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 4, type: !15, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !17) | ||
!15 = !DISubroutineType(types: !16) | ||
!16 = !{null} | ||
!17 = !{!18, !20} | ||
!18 = !DILocalVariable(name: "x", scope: !14, file: !1, line: 5, type: !19) | ||
!19 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) | ||
!20 = !DILocalVariable(name: "y", scope: !14, file: !1, line: 5, type: !19) | ||
!21 = !DILocation(line: 5, column: 3, scope: !14) | ||
!22 = !DILocation(line: 0, scope: !14) | ||
!23 = !DILocation(line: 5, column: 10, scope: !14) | ||
!24 = !{!25, !25, i64 0} | ||
!25 = !{!"int", !26, i64 0} | ||
!26 = !{!"omnipotent char", !27, i64 0} | ||
!27 = !{!"Simple C++ TBAA"} | ||
!28 = !DILocation(line: 6, column: 3, scope: !14) | ||
!29 = !DILocation(line: 7, column: 3, scope: !14) | ||
!30 = !DILocation(line: 8, column: 1, scope: !14) | ||
!31 = distinct !DIAssignID() | ||
!32 = distinct !DIAssignID() | ||
!33 = distinct !DIAssignID() | ||
!34 = !{i32 7, !"debug-info-assignment-tracking", i1 true} |
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,76 @@ | ||
; RUN: llc -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s | ||
; RUN: llc --try-experimental-debuginfo-iterators -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s | ||
|
||
;; Copied from dbg-value-tag-offset.ll. Check that variables with locations | ||
;; tracked with dbg.assigns with DW_OP_LLVM_TAG_offset operators in their | ||
;; expressions get a DW_AT_LLVM_tag_offset attribute on their DIE. | ||
|
||
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" | ||
target triple = "aarch64-unknown-linux-android24" | ||
|
||
; CHECK: DW_TAG_variable | ||
; CHECK-NOT: DW_TAG | ||
; CHECK: DW_AT_LLVM_tag_offset (0x00) | ||
; CHECK-NEXT: DW_AT_name ("x") | ||
|
||
; CHECK: DW_TAG_variable | ||
; CHECK-NOT: DW_TAG | ||
; CHECK: DW_AT_LLVM_tag_offset (0x80) | ||
; CHECK-NEXT: DW_AT_name ("y") | ||
|
||
define dso_local void @f() !dbg !14 { | ||
%1 = alloca i32, align 4, !DIAssignID !31 | ||
call void @llvm.dbg.assign(metadata i1 undef, metadata !18, metadata !DIExpression(), metadata !31, metadata ptr %1, metadata !DIExpression(DW_OP_LLVM_tag_offset, 0)), !dbg !22 | ||
%2 = alloca i32, align 4, !DIAssignID !32 | ||
call void @llvm.dbg.assign(metadata i1 undef, metadata !20, metadata !DIExpression(), metadata !32, metadata ptr %2, metadata !DIExpression(DW_OP_LLVM_tag_offset, 128)), !dbg !22 | ||
store i32 1, ptr %2, align 4, !dbg !23, !tbaa !24, !DIAssignID !33 | ||
call void @llvm.dbg.assign(metadata i32 1, metadata !20, metadata !DIExpression(), metadata !33, metadata ptr %2, metadata !DIExpression(DW_OP_LLVM_tag_offset, 128)), !dbg !22 | ||
call void @use(ptr nonnull %1), !dbg !28 | ||
call void @use(ptr nonnull %2), !dbg !29 | ||
ret void, !dbg !30 | ||
} | ||
|
||
declare !dbg !5 void @use(ptr) | ||
|
||
declare void @llvm.dbg.value(metadata, metadata, metadata) | ||
declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) | ||
|
||
!llvm.dbg.cu = !{!0} | ||
!llvm.module.flags = !{!8, !9, !10, !11, !12, !34} | ||
!llvm.ident = !{!13} | ||
|
||
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None) | ||
!1 = !DIFile(filename: "dbg.cc", directory: "/tmp") | ||
!2 = !{} | ||
!3 = !{!4, !5} | ||
!4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) | ||
!5 = !DISubprogram(name: "use", scope: !1, file: !1, line: 2, type: !6, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) | ||
!6 = !DISubroutineType(types: !7) | ||
!7 = !{null, !4} | ||
!8 = !{i32 7, !"Dwarf Version", i32 4} | ||
!9 = !{i32 2, !"Debug Info Version", i32 3} | ||
!10 = !{i32 1, !"wchar_size", i32 4} | ||
!11 = !{i32 7, !"PIC Level", i32 2} | ||
!12 = !{i32 7, !"PIE Level", i32 2} | ||
!13 = !{!"clang version 10.0.0"} | ||
!14 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 4, type: !15, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !17) | ||
!15 = !DISubroutineType(types: !16) | ||
!16 = !{null} | ||
!17 = !{!18, !20} | ||
!18 = !DILocalVariable(name: "x", scope: !14, file: !1, line: 5, type: !19) | ||
!19 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) | ||
!20 = !DILocalVariable(name: "y", scope: !14, file: !1, line: 5, type: !19) | ||
!21 = !DILocation(line: 5, column: 3, scope: !14) | ||
!22 = !DILocation(line: 0, scope: !14) | ||
!23 = !DILocation(line: 5, column: 10, scope: !14) | ||
!24 = !{!25, !25, i64 0} | ||
!25 = !{!"int", !26, i64 0} | ||
!26 = !{!"omnipotent char", !27, i64 0} | ||
!27 = !{!"Simple C++ TBAA"} | ||
!28 = !DILocation(line: 6, column: 3, scope: !14) | ||
!29 = !DILocation(line: 7, column: 3, scope: !14) | ||
!30 = !DILocation(line: 8, column: 1, scope: !14) | ||
!31 = distinct !DIAssignID() | ||
!32 = distinct !DIAssignID() | ||
!33 = distinct !DIAssignID() | ||
!34 = !{i32 7, !"debug-info-assignment-tracking", i1 true} |
3 changes: 2 additions & 1 deletion
3
llvm/test/DebugInfo/Generic/assignment-tracking/declare-to-assign/hwasan.ll
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
60 changes: 60 additions & 0 deletions
60
llvm/test/Instrumentation/HWAddressSanitizer/dbg-assign-tag-offset.ll
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 @@ | ||
; RUN: opt -passes=hwasan -S -o - %s | FileCheck %s | ||
; RUN: opt --try-experimental-debuginfo-iterators -passes=hwasan -S -o - %s | FileCheck %s | ||
|
||
source_filename = "test.ll" | ||
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" | ||
target triple = "aarch64--linux-android" | ||
|
||
declare void @g(ptr, ptr, ptr, ptr, ptr, ptr) | ||
|
||
; Function Attrs: sanitize_hwaddress | ||
define void @f() #0 !dbg !7 { | ||
entry: | ||
%nodebug0 = alloca ptr, align 8 | ||
%nodebug1 = alloca ptr, align 8 | ||
%nodebug2 = alloca ptr, align 8 | ||
%nodebug3 = alloca ptr, align 8 | ||
; CHECK: %a = alloca{{.*}} !DIAssignID ![[ID1:[0-9]+]] | ||
%a = alloca ptr, align 8, !DIAssignID !13 | ||
; CHECK: @llvm.dbg.assign{{.*}} metadata ![[ID1]]{{.*}} !DIExpression(DW_OP_LLVM_tag_offset, 32) | ||
call void @llvm.dbg.assign(metadata i1 undef, metadata !14, metadata !DIExpression(), metadata !13, metadata ptr %a, metadata !DIExpression()), !dbg !15 | ||
; CHECK: %b = alloca{{.*}} !DIAssignID ![[ID2:[0-9]+]] | ||
%b = alloca ptr, align 8, !DIAssignID !16 | ||
; CHECK: @llvm.dbg.assign{{.*}} metadata ![[ID2]]{{.*}} !DIExpression(DW_OP_LLVM_tag_offset, 96) | ||
call void @llvm.dbg.assign(metadata i1 undef, metadata !17, metadata !DIExpression(), metadata !16, metadata ptr %b, metadata !DIExpression()), !dbg !15 | ||
call void @g(ptr %nodebug0, ptr %nodebug1, ptr %nodebug2, ptr %nodebug3, ptr %a, ptr %b) | ||
ret void, !dbg !18 | ||
} | ||
|
||
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) | ||
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 | ||
|
||
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) | ||
declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #1 | ||
|
||
attributes #0 = { sanitize_hwaddress } | ||
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } | ||
|
||
!llvm.dbg.cu = !{!0} | ||
!llvm.module.flags = !{!3, !4, !5} | ||
!llvm.ident = !{!6} | ||
|
||
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) | ||
!1 = !DIFile(filename: "x.c", directory: "/") | ||
!2 = !{} | ||
!3 = !{i32 2, !"Dwarf Version", i32 4} | ||
!4 = !{i32 2, !"Debug Info Version", i32 3} | ||
!5 = !{i32 7, !"debug-info-assignment-tracking", i1 true} | ||
!6 = !{!"clang"} | ||
!7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) | ||
!8 = !DISubroutineType(types: !9) | ||
!9 = !{null, !10} | ||
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64) | ||
!11 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !12) | ||
!12 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) | ||
!13 = distinct !DIAssignID() | ||
!14 = !DILocalVariable(name: "a", scope: !7, file: !1, line: 1, type: !10) | ||
!15 = !DILocation(line: 0, scope: !7) | ||
!16 = distinct !DIAssignID() | ||
!17 = !DILocalVariable(name: "b", scope: !7, file: !1, line: 1, type: !10) | ||
!18 = !DILocation(line: 1, column: 37, scope: !7) |
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.
Please add a sentence what we are testing here.