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

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 18 12:50:15 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: None (yonghong-song)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/159640.diff


2 Files Affected:

- (modified) llvm/test/Transforms/SampleProfile/ctxsplit.ll (+5-3) 
- (modified) llvm/test/Transforms/SampleProfile/flattened.ll (+4-1) 


``````````diff
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)

``````````

</details>


https://github.com/llvm/llvm-project/pull/159640


More information about the llvm-commits mailing list