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/SafeStack.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/SafeStack.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SafeStack.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SafeStack.cpp b/llvm/lib/CodeGen/SafeStack.cpp index f0667f7..477ff7a 100644 --- a/llvm/lib/CodeGen/SafeStack.cpp +++ b/llvm/lib/CodeGen/SafeStack.cpp @@ -192,7 +192,7 @@ public: SafeStack(Function &F, const TargetLoweringBase &TL, const DataLayout &DL, DomTreeUpdater *DTU, ScalarEvolution &SE) : F(F), TL(TL), DL(DL), DTU(DTU), SE(SE), - StackPtrTy(PointerType::getUnqual(F.getContext())), + StackPtrTy(DL.getAllocaPtrType(F.getContext())), IntPtrTy(DL.getIntPtrType(F.getContext())), Int32Ty(Type::getInt32Ty(F.getContext())) {} @@ -616,7 +616,8 @@ Value *SafeStack::moveStaticAllocasToUnsafeStack( IRBuilder<> IRBUser(InsertBefore); Value *Off = IRBUser.CreatePtrAdd(BasePointer, ConstantInt::get(Int32Ty, -Offset)); - Value *Replacement = IRBUser.CreateBitCast(Off, AI->getType(), Name); + Value *Replacement = + IRBUser.CreateAddrSpaceCast(Off, AI->getType(), Name); if (auto *PHI = dyn_cast<PHINode>(User)) // PHI nodes may have multiple incoming edges from the same BB (why??), |