diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:04 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:11 +0000 |
commit | e3b557809604d036af6e00c60f012c2025b59a5e (patch) | |
tree | 8a11ba2269a3b669601e2fd41145b174008f4da8 /llvm/lib/CodeGen/ShadowStackGCLowering.cpp | |
parent | 08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff) |
Diffstat (limited to 'llvm/lib/CodeGen/ShadowStackGCLowering.cpp')
-rw-r--r-- | llvm/lib/CodeGen/ShadowStackGCLowering.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/ShadowStackGCLowering.cpp b/llvm/lib/CodeGen/ShadowStackGCLowering.cpp index 5f9ade18f15c..153fe77b8b4a 100644 --- a/llvm/lib/CodeGen/ShadowStackGCLowering.cpp +++ b/llvm/lib/CodeGen/ShadowStackGCLowering.cpp @@ -39,6 +39,7 @@ #include "llvm/Support/Casting.h" #include "llvm/Transforms/Utils/EscapeEnumerator.h" #include <cassert> +#include <optional> #include <string> #include <utility> #include <vector> @@ -305,7 +306,7 @@ bool ShadowStackGCLowering::runOnFunction(Function &F) { if (Roots.empty()) return false; - Optional<DomTreeUpdater> DTU; + std::optional<DomTreeUpdater> DTU; if (auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>()) DTU.emplace(DTWP->getDomTree(), DomTreeUpdater::UpdateStrategy::Lazy); @@ -320,9 +321,8 @@ bool ShadowStackGCLowering::runOnFunction(Function &F) { Instruction *StackEntry = AtEntry.CreateAlloca(ConcreteStackEntryTy, nullptr, "gc_frame"); - while (isa<AllocaInst>(IP)) - ++IP; - AtEntry.SetInsertPoint(IP->getParent(), IP); + AtEntry.SetInsertPointPastAllocas(&F); + IP = AtEntry.GetInsertPoint(); // Initialize the map pointer and load the current head of the shadow stack. Instruction *CurrentHead = @@ -361,7 +361,7 @@ bool ShadowStackGCLowering::runOnFunction(Function &F) { // For each instruction that escapes... EscapeEnumerator EE(F, "gc_cleanup", /*HandleExceptions=*/true, - DTU ? DTU.getPointer() : nullptr); + DTU ? &*DTU : nullptr); while (IRBuilder<> *AtExit = EE.Next()) { // Pop the entry from the shadow stack. Don't reuse CurrentHead from // AtEntry, since that would make the value live for the entire function. |