Skip to content

[SystemZ] Significant compile time regression in LLVM 20 due to isFullyInternal() #130541

Closed
@alexrp

Description

@alexrp

With LLVM 20, we're seeing significantly increased compile times for the Zig standard library test executable for s390x-linux: 0m33s with LLVM 19 vs 3m28s with LLVM 20. It appears to be caused by #100757 (FYI @JonPsson1 @uweigand), specifically this function:

// Only consider a function fully internal as long as it has local linkage
// and is not used in any other way than acting as the called function at
// call sites.
bool SystemZTargetLowering::isFullyInternal(const Function *Fn) const {
if (!Fn->hasLocalLinkage())
return false;
for (const User *U : Fn->users()) {
if (auto *CB = dyn_cast<CallBase>(U)) {
if (CB->getCalledFunction() != Fn)
return false;
} else
return false;
}
return true;
}

And its (indirect) usage here:

// Integer args <=32 bits should have an extension attribute.
verifyNarrowIntegerArgs_Call(Outs, &MF.getFunction(), Callee);

In Zig we have a helper function std.builtin.returnError() that the compiler emits calls to when an error value is returned from a function. Since we use a compilation model that can roughly be described as a unity build, the standard library test module has around ~68,000 calls to this function. LLVM is now walking the full use list of this function at every call site, which is less than ideal.

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions