Skip to content

Commit 89ad31f

Browse files
authored
[RemoveDIs][DebugInfo] Perform some pre-turn-on test maintenence (#80885)
As we'll hopefully move away from using intrinsics for debug-info shortly, this commit stabilizes a few tests to avoid spurious changes in the process. Briefly, there are differences in output when we don't use intrinsics that we're going to suppress in case we have to revert, these are: * The attributor test gets different attributes for the dbg.value intrinsic because it's not present during optimisation. This has no functional effect and there's no need to test for it. * The Scalarizer test exposes a "debug-info affects codegen" problem, but fixing it is fiddly (updating 20 IRBuilder object calls). Pin this test to not change with RemoveDIs, we can relax it later and get the correct behaviour. * DIDefaultTemplateParam.ll tests for explicit metadata node numbers which is generally bad. Add explicit node-number capturing CHECK lines.
1 parent c2a91d4 commit 89ad31f

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

llvm/test/Assembler/DIDefaultTemplateParam.ll

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ attributes #1 = { nounwind readnone speculatable willreturn }
2929
!llvm.module.flags = !{!3, !4, !5}
3030
!llvm.ident = !{!6}
3131

32+
;; Test that the templateParams for the DICompositeTypes are retained:
33+
; CHECK: ![[COMPTAG:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo<int, 6>",
34+
; CHECK-SAME: templateParams: ![[PARAMLIST:[0-9]+]]
35+
; CHECK: ![[PARAMLIST]] = !{![[PARAM1:[0-9]+]], ![[PARAM2:[0-9]+]]}
36+
; CHECK: ![[PARAM1]] = !DITemplateTypeParameter(name: "T", type: !{{[0-9]*}})
37+
; CHECK: ![[PARAM2]] = !DITemplateValueParameter(name: "i", type: !{{[0-9]*}}, value: i32 6)
38+
39+
; CHECK: ![[COMPTAG2:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo<char, 3>",
40+
; CHECK-SAME: templateParams: ![[PARAMLIST2:[0-9]+]]
41+
; CHECK: ![[PARAMLIST2]] = !{![[PARAM3:[0-9]+]], ![[PARAM4:[0-9]+]]}
42+
; CHECK: ![[PARAM3]] = !DITemplateTypeParameter({{.*}}, defaulted: true
43+
; CHECK: ![[PARAM4]] = !DITemplateValueParameter({{.*}}, defaulted: true
44+
3245
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
3346
!1 = !DIFile(filename: "test.cpp", directory: "/dir/", checksumkind: CSK_MD5, checksum: "863d08522c2300490dea873efc4b2369")
3447
!2 = !{}
@@ -43,23 +56,14 @@ attributes #1 = { nounwind readnone speculatable willreturn }
4356
!11 = !DILocalVariable(name: "f1", scope: !7, file: !1, line: 30, type: !12)
4457
!12 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo<int, 6>", file: !1, line: 26, size: 8, flags: DIFlagTypePassByValue, elements: !2, templateParams: !13, identifier: "_ZTS3fooIiLi6EE")
4558
!13 = !{!14, !15}
46-
47-
; CHECK: 14 = !DITemplateTypeParameter(name: "T", type: !{{[0-9]*}})
4859
!14 = !DITemplateTypeParameter(name: "T", type: !10)
49-
50-
; CHECK: 15 = !DITemplateValueParameter(name: "i", type: !{{[0-9]*}}, value: i32 6)
5160
!15 = !DITemplateValueParameter(name: "i", type: !10, value: i32 6)
52-
5361
!16 = !DILocation(line: 30, column: 14, scope: !7)
5462
!17 = !DILocalVariable(name: "f2", scope: !7, file: !1, line: 31, type: !18)
5563
!18 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "foo<char, 3>", file: !1, line: 26, size: 8, flags: DIFlagTypePassByValue, elements: !2, templateParams: !19, identifier: "_ZTS3fooIcLi3EE")
5664
!19 = !{!20, !22}
57-
58-
; CHECK: 20 = !DITemplateTypeParameter({{.*}}, defaulted: true
5965
!20 = !DITemplateTypeParameter(name: "T", type: !21, defaulted: true)
6066
!21 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
61-
62-
; CHECK: 22 = !DITemplateValueParameter({{.*}}, defaulted: true
6367
!22 = !DITemplateValueParameter(name: "i", type: !10, defaulted: true, value: i32 3)
6468
!23 = !DILocation(line: 31, column: 9, scope: !7)
6569
!24 = !DILocation(line: 32, column: 3, scope: !7)

llvm/test/Transforms/Attributor/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
33
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
44

5+
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s --try-experimental-debuginfo-iterators | FileCheck %s --check-prefixes=CHECK,TUNIT
6+
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s --try-experimental-debuginfo-iterators | FileCheck %s --check-prefixes=CHECK,CGSCC
7+
58
; Fix for PR33641. ArgumentPromotion removed the argument to bar but left the call to
69
; dbg.value which still used the removed argument.
710

@@ -27,7 +30,8 @@ define internal void @bar(%p_t %p) {
2730
; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2831
; CGSCC-LABEL: define {{[^@]+}}@bar
2932
; CGSCC-SAME: (ptr nocapture nofree readnone [[P:%.*]]) #[[ATTR0]] {
30-
; CGSCC-NEXT: call void @llvm.dbg.value(metadata ptr [[P]], metadata [[META3:![0-9]+]], metadata !DIExpression()) #[[ATTR2:[0-9]+]], !dbg [[DBG5:![0-9]+]]
33+
; CGSCC-NEXT: call void @llvm.dbg.value(metadata ptr [[P]], metadata [[META3:![0-9]+]], metadata !DIExpression())
34+
; CGSCC-SAME: !dbg [[DBG5:![0-9]+]]
3135
; CGSCC-NEXT: ret void
3236
;
3337
call void @llvm.dbg.value(metadata %p_t %p, metadata !4, metadata !5), !dbg !6
@@ -52,7 +56,6 @@ declare void @llvm.dbg.value(metadata, metadata, metadata)
5256
;.
5357
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
5458
; CGSCC: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
55-
; CGSCC: attributes #[[ATTR2]] = { nofree nosync willreturn }
5659
;.
5760
; TUNIT: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)
5861
; TUNIT: [[META1:![0-9]+]] = !DIFile(filename: "test.c", directory: "")

llvm/test/Transforms/Scalarizer/dbginfo.ll

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
; RUN: opt %s -passes='function(scalarizer)' -scalarize-load-store -S | FileCheck %s
1+
; RUN: opt %s -passes='function(scalarizer)' -scalarize-load-store -S --experimental-debuginfo-iterators=false | FileCheck %s
22
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
3+
; FIXME: the test output here changes if we use the RemoveDIs non-intrinsic
4+
; debug-info format for the test. Specifically, the intrinsics no longer
5+
; interfere with the scalarizer, and we get the same code with/without
6+
; debug-info.
7+
; That's the behaviour we want; but fix this test to only use intrinsics as
8+
; we introduce the non-intrinsic format, to reduce the amount of spurious test
9+
; changes it comes with. We can turn that off once we're committed to using
10+
; the non-intrinsic format.
311

412
; Function Attrs: nounwind uwtable
513
define void @f1(ptr nocapture %a, ptr nocapture readonly %b, ptr nocapture readonly %c) #0 !dbg !4 {

0 commit comments

Comments
 (0)