Skip to content

[StackSafetyAnalysis] Bail out when calling ifunc #113841

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
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/Analysis/StackSafetyAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ void StackSafetyLocalAnalysis::analyzeAllUses(Value *Ptr,
// dso_preemptable aliases or aliases with interposable linkage.
const GlobalValue *Callee =
dyn_cast<GlobalValue>(CB.getCalledOperand()->stripPointerCasts());
if (!Callee) {
if (!Callee || isa<GlobalIFunc>(Callee)) {
US.addRange(I, UnknownRange, /*IsSafe=*/false);
break;
}
Expand Down
16 changes: 16 additions & 0 deletions llvm/test/Analysis/StackSafetyAnalysis/local.ll
Original file line number Diff line number Diff line change
Expand Up @@ -1120,5 +1120,21 @@ define void @NonPointer(ptr %p) {
ret void
}

@ifunc = dso_local ifunc i64 (ptr), ptr @ifunc_resolver

define dso_local void @CallIfunc(ptr noundef %uaddr) local_unnamed_addr {
; CHECK-LABEL: @CallIfunc
; CHECK-NEXT: args uses:
; CHECK-NEXT: uaddr[]: full-set
entry:
tail call i64 @ifunc(ptr noundef %uaddr)
ret void
}

define dso_local ptr @ifunc_resolver() {
entry:
ret ptr null
}

declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
declare void @llvm.lifetime.end.p0(i64, ptr nocapture)
Loading