[llvm] [CodeGen][WinEH] Update saved esp for inlined inallocas (PR #116585)
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 18 15:17:54 PST 2024
================
@@ -774,3 +778,27 @@ void WinEHStatePass::insertStateNumberStore(Instruction *IP, int State) {
RegNode, StateFieldIndex);
Builder.CreateStore(Builder.getInt32(State), StateField);
}
+
+void WinEHStatePass::updateEspForInAllocas(Function &F) {
+ for (BasicBlock &BB : F) {
+ for (Instruction &I : BB) {
+ if (auto *Alloca = dyn_cast<AllocaInst>(&I)) {
+ if (!Alloca->isUsedWithInAlloca())
----------------
rnk wrote:
I think what you really want to do here is update the saved ESP after every stack pointer update, which means every dynamic alloca, and every stackrestore operation.
It's only correct to exclude inalloca allocas because it's generally impossible to recover from exceptions inside of a call expression, although it occurs to me that statement expressions make this possible (Ew).
For that reason, and given the general disrepair and non-performance criticality of 32-bit Windows code quality, I would recommend using `Alloca->isStaticAlloca()` as the criteria here.
https://github.com/llvm/llvm-project/pull/116585
More information about the llvm-commits
mailing list