[llvm] [SampleProfile][Test] Fix DISubroutineType debuginfo for two tests (PR #159640)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 18 12:49:38 PDT 2025


https://github.com/yonghong-song created https://github.com/llvm/llvm-project/pull/159640

During development of [1], I found two test failures

 -  llvm/test/Transforms/SampleProfile/ctxsplit.ll
 -  llvm/test/Transforms/SampleProfile/flattened.ll

due to incorrect DISubroutineType(s). This patch fixed the issue with proper types.

  [1] https://github.com/llvm/llvm-project/pull/157349

>From 61d07d982f9c3a1fc5e7db71de7a704cf3ec9e57 Mon Sep 17 00:00:00 2001
From: Yonghong Song <yonghong.song at linux.dev>
Date: Thu, 18 Sep 2025 12:37:15 -0700
Subject: [PATCH] [SampleProfile][Test] Fix DISubroutineType debuginfo for two
 tests

During development of [1], I found two test failures
  llvm/test/Transforms/SampleProfile/ctxsplit.ll
  llvm/test/Transforms/SampleProfile/flattened.ll
due to incorrect DISubroutineType(s). This patch fixed
the issue with proper types.

  [1] https://github.com/llvm/llvm-project/pull/157349
---
 llvm/test/Transforms/SampleProfile/ctxsplit.ll  | 8 +++++---
 llvm/test/Transforms/SampleProfile/flattened.ll | 5 ++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/llvm/test/Transforms/SampleProfile/ctxsplit.ll b/llvm/test/Transforms/SampleProfile/ctxsplit.ll
index 46e088a63e941..4acd8b5861c14 100644
--- a/llvm/test/Transforms/SampleProfile/ctxsplit.ll
+++ b/llvm/test/Transforms/SampleProfile/ctxsplit.ll
@@ -51,9 +51,11 @@ attributes #0 = { "use-sample-profile" }
 !4 = !{i32 2, !"Debug Info Version", i32 3}
 !5 = !{i32 1, !"wchar_size", i32 4}
 !6 = !{!"clang version 8.0.0 (trunk 345241)"}
-!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !2)
+!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !12, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !2)
 !8 = !DISubroutineType(types: !2)
 !9 = !DILocation(line: 2, column: 3, scope: !7)
-!10 = distinct !DISubprogram(name: "goo", scope: !1, file: !1, line: 8, type: !8, isLocal: false, isDefinition: true, scopeLine: 8, isOptimized: true, unit: !0, retainedNodes: !2)
+!10 = distinct !DISubprogram(name: "goo", scope: !1, file: !1, line: 8, type: !12, isLocal: false, isDefinition: true, scopeLine: 8, isOptimized: true, unit: !0, retainedNodes: !2)
 !11 = !DILocation(line: 10, column: 3, scope: !10)
-
+!12 = !DISubroutineType(types: !13)
+!13 = !{!14}
+!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
diff --git a/llvm/test/Transforms/SampleProfile/flattened.ll b/llvm/test/Transforms/SampleProfile/flattened.ll
index acc6459c99a33..e92264f693bb8 100644
--- a/llvm/test/Transforms/SampleProfile/flattened.ll
+++ b/llvm/test/Transforms/SampleProfile/flattened.ll
@@ -31,6 +31,9 @@ entry:
 !4 = !{i32 2, !"Debug Info Version", i32 3}
 !5 = !{i32 1, !"wchar_size", i32 4}
 !6 = !{!"clang version 8.0.0 (trunk 345241)"}
-!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !2)
+!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !10, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !2)
 !8 = !DISubroutineType(types: !2)
 !9 = !DILocation(line: 2, column: 3, scope: !7)
+!10 = !DISubroutineType(types: !11)
+!11 = !{!12}
+!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)



More information about the llvm-commits mailing list