Skip to content

[AMDGPU][SplitModule] Keep looking for more dependencies after finding an indirect call #93480

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 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ static void addAllDependencies(SplitModuleLogger &SML, const CallGraph &CG,
// TODO: Print an ORE as well ?
addAllIndirectCallDependencies(M, Fns);
HadIndirectCall = true;
return;
continue;
}

if (Callee->isDeclaration())
Expand Down
10 changes: 8 additions & 2 deletions llvm/test/tools/llvm-split/AMDGPU/kernels-dependency-indirect.ll
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
; We default to putting A/B in P0, alongside a copy
; of all helpers who have their address taken.
; The other kernels can still go into separate partitions.
;
; Note that dependency discovery shouldn't stop upon finding an
; indirect call. HelperC/D should also end up in P0 as they
; are dependencies of HelperB.

; CHECK0-NOT: define
; CHECK0: define hidden void @HelperA
; CHECK0: define hidden void @HelperB
; CHECK0: define hidden void @CallCandidate
; CHECK0-NOT: define {{.*}} @HelperC
; CHECK0-NOT: define {{.*}} @HelperD
; CHECK0: define internal void @HelperC
; CHECK0: define internal void @HelperD
; CHECK0: define amdgpu_kernel void @A
; CHECK0: define amdgpu_kernel void @B
; CHECK0-NOT: define
Expand All @@ -39,7 +43,9 @@ define internal void @HelperA(ptr %call) {
}

define internal void @HelperB(ptr %call) {
call void @HelperC()
call void %call()
call void @HelperD()
ret void
}

Expand Down
Loading