diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2024-11-04 17:51:30 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-04 17:51:30 -0800 |
commit | ea859005b5ddb14548b9dc5b94d54d78754f5918 (patch) | |
tree | 6f8567aa694aebe2414513cbc8befd8f24bf1208 /llvm/lib/CodeGen/TargetLoweringBase.cpp | |
parent | ffcf3c8688f57acaf6a404a1238673c9d197ba9a (diff) | |
download | llvm-ea859005b5ddb14548b9dc5b94d54d78754f5918.zip llvm-ea859005b5ddb14548b9dc5b94d54d78754f5918.tar.gz llvm-ea859005b5ddb14548b9dc5b94d54d78754f5918.tar.bz2 |
SafeStack: Respect alloca addrspace (#112536)
Just insert addrspacecast in cases where the alloca uses a
different address space, since I don't know what else you
could possibly do.
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringBase.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringBase.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index 5bcde0e..231de6b 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -1849,7 +1849,8 @@ TargetLoweringBase::getDefaultSafeStackPointerLocation(IRBuilderBase &IRB, auto UnsafeStackPtr = dyn_cast_or_null<GlobalVariable>(M->getNamedValue(UnsafeStackPtrVar)); - Type *StackPtrTy = PointerType::getUnqual(M->getContext()); + const DataLayout &DL = M->getDataLayout(); + PointerType *StackPtrTy = DL.getAllocaPtrType(M->getContext()); if (!UnsafeStackPtr) { auto TLSModel = UseTLS ? @@ -1863,6 +1864,8 @@ TargetLoweringBase::getDefaultSafeStackPointerLocation(IRBuilderBase &IRB, UnsafeStackPtrVar, nullptr, TLSModel); } else { // The variable exists, check its type and attributes. + // + // FIXME: Move to IR verifier. if (UnsafeStackPtr->getValueType() != StackPtrTy) report_fatal_error(Twine(UnsafeStackPtrVar) + " must have void* type"); if (UseTLS != UnsafeStackPtr->isThreadLocal()) |