diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2023-07-29 09:15:31 -0400 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2023-08-09 18:33:11 -0400 |
commit | 25bc999d1fb2efccc3ece398550af738aea7d310 (patch) | |
tree | 186cd825780b0dbe5e8f0a58cec58b24eee132d7 /llvm/lib/Transforms/Utils/InlineFunction.cpp | |
parent | e8934075b90a38f9dd3361472e696f11e50a8aa4 (diff) | |
download | llvm-25bc999d1fb2efccc3ece398550af738aea7d310.zip llvm-25bc999d1fb2efccc3ece398550af738aea7d310.tar.gz llvm-25bc999d1fb2efccc3ece398550af738aea7d310.tar.bz2 |
Intrinsics: Add type overload to stacksave and stackstore
This allows use with non-0 address space stacks. llvm_ptr_ty should
never be used. This could use some more percolation up through mlir,
but this is enough to fix existing tests.
https://reviews.llvm.org/D156666
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index f7b93fc8..29e7ca0 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -2454,14 +2454,9 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI, // If the inlined code contained dynamic alloca instructions, wrap the inlined // code with llvm.stacksave/llvm.stackrestore intrinsics. if (InlinedFunctionInfo.ContainsDynamicAllocas) { - Module *M = Caller->getParent(); - // Get the two intrinsics we care about. - Function *StackSave = Intrinsic::getDeclaration(M, Intrinsic::stacksave); - Function *StackRestore=Intrinsic::getDeclaration(M,Intrinsic::stackrestore); - // Insert the llvm.stacksave. CallInst *SavedPtr = IRBuilder<>(&*FirstNewBlock, FirstNewBlock->begin()) - .CreateCall(StackSave, {}, "savedstack"); + .CreateStackSave("savedstack"); // Insert a call to llvm.stackrestore before any return instructions in the // inlined function. @@ -2472,7 +2467,7 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI, continue; if (InlinedDeoptimizeCalls && RI->getParent()->getTerminatingDeoptimizeCall()) continue; - IRBuilder<>(RI).CreateCall(StackRestore, SavedPtr); + IRBuilder<>(RI).CreateStackRestore(SavedPtr); } } |