Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
fbe540b
[𝘀𝗽𝗿] changes to main this commit is based on
necipfazil Apr 3, 2024
d163d80
[𝘀𝗽𝗿] initial version
necipfazil Apr 3, 2024
4c15a50
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Apr 22, 2024
dd26405
Updated fixme on PR 87570
necipfazil Apr 22, 2024
e7111f0
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Apr 24, 2024
b5b03fd
Rebased on top of main
necipfazil Apr 24, 2024
2b3551e
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Apr 29, 2024
b90a4d5
dyn_cast to isa
necipfazil Apr 29, 2024
a692109
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil May 1, 2024
332f2aa
Rebased on upstream main.
necipfazil May 1, 2024
826c83e
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Nov 14, 2024
1209081
Rebase patchset
necipfazil Nov 14, 2024
60f93a8
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Nov 14, 2024
1981340
Update inline comment as suggested.
necipfazil Nov 14, 2024
a2daca9
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Nov 19, 2024
423d5f2
Addressed review comments.
necipfazil Nov 19, 2024
17ee91d
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Nov 20, 2024
e51ce07
Rebase on top of upstream main.
necipfazil Nov 20, 2024
21ec0f7
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Nov 20, 2024
e4684b8
Break clang and llvm parts into separate commits.
necipfazil Nov 20, 2024
5caf81d
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Dec 10, 2024
7f15e6b
Reorder commits.
necipfazil Dec 10, 2024
2d88d20
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Feb 2, 2025
3fad066
Rebase on top of main.
necipfazil Feb 2, 2025
1f6e111
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Feb 5, 2025
1fd9775
Rename OB_type to OB_callee_type.
necipfazil Feb 5, 2025
4615cce
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Feb 11, 2025
2f763c0
Rebase on top of main
necipfazil Feb 11, 2025
5857d51
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Feb 11, 2025
5e6675b
Update IR verifier.
necipfazil Feb 11, 2025
d9322de
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Mar 13, 2025
39e5b93
Add requested tests part 1.
necipfazil Mar 13, 2025
6df6234
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Mar 13, 2025
f18f492
Update comments in tests.
necipfazil Mar 13, 2025
6b67376
Updated the test as reviewers suggested.
necipfazil Mar 13, 2025
d2bb381
Scoped enum. Simplify test.
necipfazil Mar 13, 2025
e3c95b5
Remove unnecessary cast.
necipfazil Mar 13, 2025
607b992
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Mar 13, 2025
835c2e2
Remove unnecessary asserts. Remove autos for better readability.
necipfazil Mar 13, 2025
678008e
Reorder IR metadata and rename temporary var names in test.
necipfazil Mar 13, 2025
23f00d0
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Mar 14, 2025
5831ed4
Add RISC-V support. Clean up test files.
necipfazil Mar 14, 2025
a0eb067
[𝘀𝗽𝗿] changes introduced through rebase
necipfazil Mar 15, 2025
77ce9ab
Clean up test files.
necipfazil Mar 15, 2025
a4a1171
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Mar 19, 2025
7d8418c
Address code refactoring comments.
necipfazil Mar 19, 2025
42c830f
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Apr 19, 2025
19043db
Use CalleeTypeIds list to emit callgraph section.
necipfazil Apr 19, 2025
4789571
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Apr 19, 2025
0754d49
Address review comments.
necipfazil Apr 19, 2025
86e5b9a
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Apr 23, 2025
cf2e510
Extract callsite label emission as a private method.
necipfazil Apr 23, 2025
4b04333
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Apr 23, 2025
80df0c0
Address review comments.
necipfazil Apr 23, 2025
caf45da
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Apr 23, 2025
20679e7
Address review comments.
necipfazil Apr 23, 2025
63e56f2
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Apr 24, 2025
48e878c
Address review comments.
necipfazil Apr 24, 2025
d072c83
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Apr 24, 2025
aeaa155
Separate the assembly test for callgraph section and related labels i…
necipfazil Apr 24, 2025
a1834c9
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Apr 24, 2025
f248de4
Rebase on parent.
necipfazil Apr 24, 2025
02d721d
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Apr 28, 2025
516dee0
Add llvm-mc test. Address comments.
necipfazil Apr 28, 2025
b45026e
Update test inline comments.
necipfazil Apr 29, 2025
370d4f0
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk May 1, 2025
106364f
Rebase on parent.
necipfazil May 1, 2025
f1051d5
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk May 5, 2025
9a561db
Rebase on parent.
necipfazil May 5, 2025
4462f6b
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk May 10, 2025
5778238
Rebase on parent change.
necipfazil May 10, 2025
5626438
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk May 13, 2025
caae8ac
Remove dso_local and noundef from tests.
necipfazil May 13, 2025
850fe68
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk May 13, 2025
dcf4495
Rebase on parent.
necipfazil May 13, 2025
d651899
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk May 14, 2025
9d25b19
Rebase on parent
necipfazil May 14, 2025
6a0f9b5
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk May 14, 2025
837e254
Rebase on main.
necipfazil May 14, 2025
f8f741c
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk May 27, 2025
65a4435
Drop local_unnamed_addr.
necipfazil May 27, 2025
58417bc
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk May 27, 2025
e1e3fd1
Rebase change.
necipfazil May 27, 2025
dc9cca4
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jun 11, 2025
7102170
Rebase.
necipfazil Jun 11, 2025
dd8808b
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jun 11, 2025
aeac1c3
Rebase on parent
necipfazil Jun 11, 2025
d332966
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 10, 2025
b95355d
Rebase on top of main.
necipfazil Jul 10, 2025
1975538
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 18, 2025
2397f11
Update hasGeneralizedMDstring API call.
necipfazil Jul 18, 2025
5723d40
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 18, 2025
ceef7e4
Rebase on parent
necipfazil Jul 18, 2025
f07f515
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 18, 2025
4422763
Rebase on top of parent change.
necipfazil Jul 18, 2025
52a4b6c
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 18, 2025
317bf8e
Rebase on parent.
necipfazil Jul 18, 2025
73508dd
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 18, 2025
0096eaf
Rebase on parent.
necipfazil Jul 18, 2025
f1a4e6c
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 18, 2025
df57b4f
Address review comments.
necipfazil Jul 18, 2025
f81b59e
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 21, 2025
d0abedc
Use llvm-reduce to simplify codegen test.
necipfazil Jul 21, 2025
1bd19e6
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 22, 2025
388b958
Rebase.
Prabhuk Jul 22, 2025
b94b3e0
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 23, 2025
13efd72
Reduce tests. Update comments in tests.
Prabhuk Jul 23, 2025
2c63a33
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 23, 2025
b327bab
Rebase on main.
Prabhuk Jul 23, 2025
9e6843a
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 23, 2025
f4c8b22
Rebase.
Prabhuk Jul 23, 2025
b498381
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 28, 2025
c6cac61
Rebase on parent.
Prabhuk Jul 28, 2025
28bcfbe
Check for .L.* instead of .Ltmp[0-9]+ in test.
Prabhuk Jul 28, 2025
a9401f0
[𝘀𝗽𝗿] changes introduced through rebase
Prabhuk Jul 30, 2025
d0590e9
Rebase on main.
Prabhuk Jul 30, 2025
7a2f29a
Fix inline comments.
Prabhuk Jul 31, 2025
608ba94
Fix alignment in test file.
Prabhuk Jul 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 21 additions & 34 deletions llvm/test/CodeGen/AArch64/calleetypeid-directcall-mismatched.ll
Original file line number Diff line number Diff line change
@@ -1,45 +1,32 @@
;; Tests that callee_type metadata attached to direct call sites are safely ignored.

; RUN: llc --call-graph-section -mtriple aarch64-linux-gnu < %s -stop-after=finalize-isel -o - | FileCheck %s
; RUN: llc --call-graph-section -mtriple aarch64-linux-gnu < %s -stop-after=finalize-isel -o - | FileCheck --match-full-lines %s

; Function Attrs: mustprogress noinline optnone uwtable
define i32 @_Z3fooiii(i32 %x, i32 %y, i32 %z) !type !3 {
;; Test that `calleeTypeIds` field is not present in `callSites`
; CHECK-LABEL: callSites:
; CHECK-NEXT: - { bb: {{[0-9]+}}, offset: {{[0-9]+}}, fwdArgRegs: [] }
; CHECK-NEXT: - { bb: {{[0-9]+}}, offset: {{[0-9]+}}, fwdArgRegs: [] }
; CHECK-NEXT: - { bb: {{[0-9]+}}, offset: {{[0-9]+}}, fwdArgRegs: [] }
define i32 @foo(i32 %x, i32 %y) !type !0 {
entry:
;; Test that `calleeTypeIds` field is not present in `callSites`
; CHECK-LABEL: callSites:
; CHECK-NEXT: - { bb: {{[0-9]+}}, offset: {{[0-9]+}}, fwdArgRegs: [] }
; CHECK-NEXT: - { bb: {{[0-9]+}}, offset: {{[0-9]+}}, fwdArgRegs: [] }
; CHECK-NEXT: - { bb: {{[0-9]+}}, offset: {{[0-9]+}}, fwdArgRegs: [] }
%x.addr = alloca i32, align 4
%y.addr = alloca i32, align 4
%z.addr = alloca i32, align 4
store i32 %x, ptr %x.addr, align 4
store i32 %y, ptr %y.addr, align 4
store i32 %z, ptr %z.addr, align 4
%zval = load i32, ptr %z.addr, align 4
%yval = load i32, ptr %y.addr, align 4
;; This direct call has a callee_type metadata node which matches the
;; callee type accurately.
%call = call i32 @_Z4fizzii(i32 %zval, i32 %yval), !callee_type !0
%xval = load i32, ptr %x.addr, align 4
%yval2 = load i32, ptr %y.addr, align 4
;; This direct call has a callee_type metadata node which points to a
;; mismatched callee type id.
%call1 = call i32 @_Z4fizzii(i32 %xval, i32 %yval2), !callee_type !1
;; Call instruction with accurate callee_type.
;; callee_type should be dropped seemlessly.
%call = call i32 @fizz(i32 %x, i32 %y), !callee_type !1
;; Call instruction with mismatched callee_type.
;; callee_type should be dropped seemlessly without errors.
%call1 = call i32 @fizz(i32 %x, i32 %y), !callee_type !3
%add = add nsw i32 %call, %call1
%xval2 = load i32, ptr %x.addr, align 4
%zval2 = load i32, ptr %z.addr, align 4
;; This direct call has a callee_type metadata node which points to a
;; mismatched callee type id.
%call2 = call i32 @_Z4fizzii(i32 %xval2, i32 %zval2), !callee_type !1
;; Call instruction with mismatched callee_type.
;; callee_type should be dropped seemlessly without errors.
%call2 = call i32 @fizz(i32 %add, i32 %y), !callee_type !3
%sub = sub nsw i32 %add, %call2
ret i32 %sub
}

declare !type !4 i32 @_Z4fizzii(i32, i32)
declare !type !2 i32 @fizz(i32, i32)

!0 = !{!4}
!0 = !{i64 0, !"_ZTSFiiiiE.generalized"}
!1 = !{!2}
!2 = !{i64 0, !"_ZTSFicE.generalized"}
!3 = !{i64 0, !"_ZTSFiiiiE.generalized"}
!4 = !{i64 0, !"_ZTSFiiiE.generalized"}
!2 = !{i64 0, !"_ZTSFiiiE.generalized"}
!3 = !{!4}
!4 = !{i64 0, !"_ZTSFicE.generalized"}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

;; Verify the exact calleeTypeId value to ensure it is not garbage but the value
;; computed as the type id from the callee_type metadata.
; RUN: llc --call-graph-section -mtriple aarch64-linux-gnu < %s -stop-after=finalize-isel -o - | FileCheck %s
; RUN: llc --call-graph-section -mtriple aarch64-linux-gnu < %s -stop-after=finalize-isel -o - | FileCheck --match-full-lines %s

define i32 @_Z13call_indirectPFicEc(ptr %func, i8 %x) !type !0 {
define i32 @check_tailcall(ptr %func, i8 %x) !type !0 {
entry:
; CHECK: callSites:
; CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: [], calleeTypeIds:
Expand Down
27 changes: 10 additions & 17 deletions llvm/test/CodeGen/AArch64/callsite-emit-calleetypeid.ll
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
;; Tests that call site callee type ids can be extracted and set from
;; callee_type metadata.

;; Verify the exact calleeTypeId value to ensure it is not garbage but the value
;; Verify the exact calleeTypeIds value to ensure it is not garbage but the value
;; computed as the type id from the callee_type metadata.
; RUN: llc --call-graph-section -mtriple aarch64-linux-gnu < %s -stop-after=finalize-isel -o - | FileCheck %s

declare !type !0 void @foo(i8 signext %a)
; RUN: llc --call-graph-section -mtriple aarch64-linux-gnu < %s -stop-after=finalize-isel -o - | FileCheck --match-full-lines %s

; CHECK: name: main
define i32 @main() !type !1 {
; CHECK: callSites:
; CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: [], calleeTypeIds:
; CHECK-NEXT: [ 7854600665770582568 ] }
define i32 @main() {
entry:
%retval = alloca i32, align 4
%fp = alloca ptr, align 8
store i32 0, ptr %retval, align 4
store ptr @foo, ptr %fp, align 8
%fp_val = load ptr, ptr %fp, align 8
; CHECK: callSites:
; CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: [], calleeTypeIds:
; CHECK-NEXT: [ 7854600665770582568 ] }
call void %fp_val(i8 signext 97), !callee_type !2
%0 = load ptr, ptr null, align 8
call void %0(i8 0), !callee_type !0
ret i32 0
}

!0 = !{i64 0, !"_ZTSFvcE.generalized"}
!1 = !{i64 0, !"_ZTSFiE.generalized"}
!2 = !{!0}
!0 = !{!1}
!1 = !{i64 0, !"_ZTSFvcE.generalized"}
55 changes: 21 additions & 34 deletions llvm/test/CodeGen/ARM/calleetypeid-directcall-mismatched.ll
Original file line number Diff line number Diff line change
@@ -1,45 +1,32 @@
;; Tests that callee_type metadata attached to direct call sites are safely ignored.

; RUN: llc --call-graph-section -mtriple arm-linux-gnu < %s -stop-after=finalize-isel -o - | FileCheck %s
; RUN: llc --call-graph-section -mtriple arm-linux-gnu < %s -stop-after=finalize-isel -o - | FileCheck --match-full-lines %s

; Function Attrs: mustprogress noinline optnone uwtable
define i32 @_Z3fooiii(i32 %x, i32 %y, i32 %z) !type !3 {
;; Test that `calleeTypeIds` field is not present in `callSites`
; CHECK-LABEL: callSites:
; CHECK-NEXT: - { bb: {{[0-9]+}}, offset: {{[0-9]+}}, fwdArgRegs: [] }
; CHECK-NEXT: - { bb: {{[0-9]+}}, offset: {{[0-9]+}}, fwdArgRegs: [] }
; CHECK-NEXT: - { bb: {{[0-9]+}}, offset: {{[0-9]+}}, fwdArgRegs: [] }
define i32 @foo(i32 %x, i32 %y) !type !0 {
entry:
;; Test that `calleeTypeIds` field is not present in `callSites`
; CHECK-LABEL: callSites:
; CHECK-NEXT: - { bb: {{[0-9]+}}, offset: {{[0-9]+}}, fwdArgRegs: [] }
; CHECK-NEXT: - { bb: {{[0-9]+}}, offset: {{[0-9]+}}, fwdArgRegs: [] }
; CHECK-NEXT: - { bb: {{[0-9]+}}, offset: {{[0-9]+}}, fwdArgRegs: [] }
%x.addr = alloca i32, align 4
%y.addr = alloca i32, align 4
%z.addr = alloca i32, align 4
store i32 %x, ptr %x.addr, align 4
store i32 %y, ptr %y.addr, align 4
store i32 %z, ptr %z.addr, align 4
%zval = load i32, ptr %z.addr, align 4
%yval = load i32, ptr %y.addr, align 4
;; This direct call has a callee_type metadata node which matches the
;; callee type accurately.
%call = call i32 @_Z4fizzii(i32 %zval, i32 %yval), !callee_type !0
%xval = load i32, ptr %x.addr, align 4
%yval2 = load i32, ptr %y.addr, align 4
;; This direct call has a callee_type metadata node which points to a
;; mismatched callee type id.
%call1 = call i32 @_Z4fizzii(i32 %xval, i32 %yval2), !callee_type !1
;; Call instruction with accurate callee_type.
;; callee_type should be dropped seemlessly.
%call = call i32 @fizz(i32 %x, i32 %y), !callee_type !1
;; Call instruction with mismatched callee_type.
;; callee_type should be dropped seemlessly without errors.
%call1 = call i32 @fizz(i32 %x, i32 %y), !callee_type !3
%add = add nsw i32 %call, %call1
%xval2 = load i32, ptr %x.addr, align 4
%zval2 = load i32, ptr %z.addr, align 4
;; This direct call has a callee_type metadata node which points to a
;; mismatched callee type id.
%call2 = call i32 @_Z4fizzii(i32 %xval2, i32 %zval2), !callee_type !1
;; Call instruction with mismatched callee_type.
;; callee_type should be dropped seemlessly without errors.
%call2 = call i32 @fizz(i32 %add, i32 %y), !callee_type !3
%sub = sub nsw i32 %add, %call2
ret i32 %sub
}

declare !type !4 i32 @_Z4fizzii(i32, i32)
declare !type !2 i32 @fizz(i32, i32)

!0 = !{!4}
!0 = !{i64 0, !"_ZTSFiiiiE.generalized"}
!1 = !{!2}
!2 = !{i64 0, !"_ZTSFicE.generalized"}
!3 = !{i64 0, !"_ZTSFiiiiE.generalized"}
!4 = !{i64 0, !"_ZTSFiiiE.generalized"}
!2 = !{i64 0, !"_ZTSFiiiE.generalized"}
!3 = !{!4}
!4 = !{i64 0, !"_ZTSFicE.generalized"}
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/ARM/callsite-emit-calleetypeid-tailcall.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

;; Verify the exact calleeTypeId value to ensure it is not garbage but the value
;; computed as the type id from the callee_type metadata.
; RUN: llc --call-graph-section -mtriple arm-linux-gnu < %s -stop-after=finalize-isel -o - | FileCheck %s
; RUN: llc --call-graph-section -mtriple arm-linux-gnu < %s -stop-after=finalize-isel -o - | FileCheck --match-full-lines %s

define i32 @_Z13call_indirectPFicEc(ptr %func, i8 %x) !type !0 {
define i32 @check_tailcall(ptr %func, i8 %x) !type !0 {
entry:
; CHECK: callSites:
; CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: [], calleeTypeIds:
Expand Down
27 changes: 10 additions & 17 deletions llvm/test/CodeGen/ARM/callsite-emit-calleetypeid.ll
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
;; Tests that call site callee type ids can be extracted and set from
;; callee_type metadata.

;; Verify the exact calleeTypeId value to ensure it is not garbage but the value
;; Verify the exact calleeTypeIds value to ensure it is not garbage but the value
;; computed as the type id from the callee_type metadata.
; RUN: llc --call-graph-section -mtriple arm-linux-gnu < %s -stop-after=finalize-isel -o - | FileCheck %s

declare !type !0 void @foo(i8 signext %a)
; RUN: llc --call-graph-section -mtriple arm-linux-gnu < %s -stop-after=finalize-isel -o - | FileCheck --match-full-lines %s

; CHECK: name: main
define i32 @main() !type !1 {
; CHECK: callSites:
; CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: [], calleeTypeIds:
; CHECK-NEXT: [ 7854600665770582568 ] }
define i32 @main() {
entry:
%retval = alloca i32, align 4
%fp = alloca ptr, align 8
store i32 0, ptr %retval, align 4
store ptr @foo, ptr %fp, align 8
%fp_val = load ptr, ptr %fp, align 8
; CHECK: callSites:
; CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: [], calleeTypeIds:
; CHECK-NEXT: [ 7854600665770582568 ] }
call void %fp_val(i8 signext 97), !callee_type !2
%0 = load ptr, ptr null, align 8
call void %0(i8 0), !callee_type !0
ret i32 0
}

!0 = !{i64 0, !"_ZTSFvcE.generalized"}
!1 = !{i64 0, !"_ZTSFiE.generalized"}
!2 = !{!0}
!0 = !{!1}
!1 = !{i64 0, !"_ZTSFvcE.generalized"}
Original file line number Diff line number Diff line change
@@ -1,59 +1,31 @@
# Test MIR printer and parser for type id field in callSites. It is used
# for propagating call site type identifiers to emit in the call graph section.
# Test MIR printer and parser to check if a call instruction with multiple
# callee types are handled correctly.

# RUN: llc --call-graph-section %s -run-pass=none -o - | FileCheck --match-full-lines %s
# CHECK: name: main
# CHECK: name: ambiguous_caller
# CHECK: callSites:
# CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: [] }
# CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: [], calleeTypeIds:
# CHECK-NEXT: [ 1234567890 ] }
# CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: {{.*}}, calleeTypeIds:
# CHECK-NEXT: [ 1234, 5678 ] }

--- |

declare !type !0 i32 @_Z3addii(i32, i32)

declare !type !0 i32 @_Z8multiplyii(i32, i32)

declare !type !1 ptr @_Z13get_operationb(i1 zeroext %is_addition)

define i32 @main(i32 %argc) !type !2 {
--- |
define ptr @ambiguous_caller() {
entry:
%retval = alloca i32, align 4
%argc.addr = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%op = alloca ptr, align 8
store i32 0, ptr %retval, align 4
store i32 %argc, ptr %argc.addr, align 4
store i32 5, ptr %x, align 4
store i32 10, ptr %y, align 4
%argc_val = load i32, ptr %argc.addr, align 4
%rem = srem i32 %argc_val, 2
%cmp = icmp eq i32 %rem, 0
%call = call ptr @_Z13get_operationb(i1 zeroext %cmp)
store ptr %call, ptr %op, align 8
%op_val = load ptr, ptr %op, align 8
%x_val = load i32, ptr %x, align 4
%y_val = load i32, ptr %y, align 4
%call1 = call i32 %op_val(i32 %x_val, i32 %y_val), !callee_type !3
ret i32 %call1
%fn = alloca ptr, align 8
%call1 = call ptr %fn(i64 4), !callee_type !0
ret ptr %call1
}

!0 = !{i64 0, !"_ZTSFiiiE.generalized"}
!1 = !{i64 0, !"_ZTSFPvbE.generalized"}
!2 = !{i64 0, !"_ZTSFiiE.generalized"}
!3 = !{!0}

!0 = !{!1, !2}
!1 = !{i64 0, !"callee_type0.generalized"}
!2 = !{i64 0, !"callee_type2.generalized"}
...
---
name: main
name: ambiguous_caller
callSites:
- { bb: 0, offset: 0, fwdArgRegs: [] }
- { bb: 0, offset: 2, fwdArgRegs: [], calleeTypeIds: [ 1234567890 ] }
- { bb: 0, offset: 1, fwdArgRegs: [], calleeTypeIds: [ 1234, 5678 ] }
body: |
bb.0.entry:
CALL64pcrel32 @_Z13get_operationb, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $rsp, implicit-def $ssp, implicit-def $rax
%7:gr64 = COPY $rax
CALL64r %7, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax

%0:gr64 = MOV32ri64 4
CALL64r killed %0, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, implicit-def $rax
RET 0, $rax
...
54 changes: 19 additions & 35 deletions llvm/test/CodeGen/MIR/X86/call-site-info-direct-calls-typeid.mir
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,51 @@

# RUN: llc --call-graph-section %s -run-pass=none -o - | FileCheck --match-full-lines %s
# CHECK-NOT: calleeTypeIds
# CHECK: name: _Z3barii
# CHECK: name: bar
# CHECK: callSites:
# CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: [] }
# CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: [] }
# CHECK: name: _Z3fooii
# CHECK: name: foo
# CHECK: callSites:
# CHECK-NEXT: - { bb: {{.*}}, offset: {{.*}}, fwdArgRegs: [] }

--- |
declare !type !0 i32 @_Z4fizzii(i32 %x, i32 %y)

declare !type !0 i32 @_Z4buzzii(i32 %x, i32 %y)

define i32 @_Z3barii(i32 %x, i32 %y) !type !0 {
--- |
declare i32 @fizz(i32, i32)
declare i32 @buzz(i32, i32)
define i32 @bar(i32 %x, i32 %y) !type !0 {
entry:
%x.addr = alloca i32, align 4
%y.addr = alloca i32, align 4
store i32 %x, ptr %x.addr, align 4
store i32 %y, ptr %y.addr, align 4
%x_val = load i32, ptr %x.addr, align 4
%y_val = load i32, ptr %y.addr, align 4
%call = call i32 @_Z4buzzii(i32 %x_val, i32 %y_val)
%x_val_2 = load i32, ptr %x.addr, align 4
%y_val_2 = load i32, ptr %y.addr, align 4
%call1 = call i32 @_Z4fizzii(i32 %x_val_2, i32 %y_val_2)
%sub = sub nsw i32 %call, %call1
ret i32 %sub
%call = call i32 @buzz(i32 %x, i32 %x)
%call1 = call i32 @fizz(i32 %x, i32 %x)
ret i32 0
}

define i32 @_Z3fooii(i32 %x, i32 %y) !type !0 {
define i32 @foo(i32 %x, i32 %y) !type !0 {
entry:
%x.addr = alloca i32, align 4
%y.addr = alloca i32, align 4
store i32 %x, ptr %x.addr, align 4
store i32 %y, ptr %y.addr, align 4
%x_val = load i32, ptr %x.addr, align 4
%y_val = load i32, ptr %y.addr, align 4
%call = call i32 @_Z3barii(i32 %x_val, i32 %y_val)
ret i32 %call
%call1 = call i32 @bar(i32 %x, i32 %x)
ret i32 0
}

!0 = !{i64 0, !"_ZTSFiiiE.generalized"}

...
---
name: _Z3barii
name: bar
callSites:
- { bb: 0, offset: 0, fwdArgRegs: [] }
- { bb: 0, offset: 1, fwdArgRegs: [] }
body: |
bb.0.entry:
CALL64pcrel32 @_Z4buzzii, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax
CALL64pcrel32 @_Z4fizzii, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax
CALL64pcrel32 target-flags(x86-plt) @buzz, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax
CALL64pcrel32 target-flags(x86-plt) @fizz, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax

...
---
name: _Z3fooii
name: foo
callSites:
- { bb: 0, offset: 0, fwdArgRegs: [] }
body: |
bb.0.entry:
CALL64pcrel32 @_Z3barii, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax
CALL64pcrel32 target-flags(x86-plt) @bar, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax

...
Loading
Loading