[llvm] TargetLowering: Replace android triple check with libcall check (PR #148800)
Daniel Paoliello via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 15 09:53:57 PDT 2025
================
@@ -1965,27 +1965,18 @@ TargetLoweringBase::getDefaultSafeStackPointerLocation(IRBuilderBase &IRB,
Value *
TargetLoweringBase::getSafeStackPointerLocation(IRBuilderBase &IRB) const {
- // FIXME: Can this triple check be replaced with SAFESTACK_POINTER_ADDRESS
- // being available?
- if (!TM.getTargetTriple().isAndroid())
- return getDefaultSafeStackPointerLocation(IRB, true);
-
- Module *M = IRB.GetInsertBlock()->getParent()->getParent();
- auto *PtrTy = PointerType::getUnqual(M->getContext());
-
- const char *SafestackPointerAddressName =
- getLibcallName(RTLIB::SAFESTACK_POINTER_ADDRESS);
- if (!SafestackPointerAddressName) {
- M->getContext().emitError(
- "no libcall available for safestack pointer address");
- return PoisonValue::get(PtrTy);
- }
-
- // Android provides a libc function to retrieve the address of the current
- // thread's unsafe stack pointer.
- FunctionCallee Fn =
- M->getOrInsertFunction(SafestackPointerAddressName, PtrTy);
- return IRB.CreateCall(Fn);
+ if (const char *SafestackPointerAddressName =
+ getLibcallName(RTLIB::SAFESTACK_POINTER_ADDRESS)) {
+ // Android provides a libc function to retrieve the address of the current
----------------
dpaoliello wrote:
Would prefer if the "Android" part of this comment was moved next to the `isAndroid` check, and this comment was left as a vague "Some systems provide...."
https://github.com/llvm/llvm-project/pull/148800
More information about the llvm-commits
mailing list