diff options
author | Ten Tzen <tentzen@microsoft.com> | 2020-07-12 01:37:56 -0700 |
---|---|---|
committer | Ten Tzen <tentzen@microsoft.com> | 2020-07-12 01:37:56 -0700 |
commit | 66f1dcd872dba189ee054fb016f4bff535fb5afc (patch) | |
tree | fbdef482c2cbd8f08808296ae1a5db16d9f224ec /clang/lib/CodeGen/CodeGenFunction.h | |
parent | 6634aef71f3b5e9820d2955bd6b39d2744de06eb (diff) | |
download | llvm-66f1dcd872dba189ee054fb016f4bff535fb5afc.zip llvm-66f1dcd872dba189ee054fb016f4bff535fb5afc.tar.gz llvm-66f1dcd872dba189ee054fb016f4bff535fb5afc.tar.bz2 |
[Windows SEH] Fix the frame-ptr of a nested-filter within a _finally
This change fixed a SEH bug (exposed by test58 & test61 in MSVC test xcpt4u.c);
when an Except-filter is located inside a finally, the frame-pointer generated today
via intrinsic @llvm.eh.recoverfp is the frame-pointer of the immediate
parent _finally, not the frame-ptr of outermost host function.
The fix is to retrieve the Establisher's frame-pointer that was previously saved in
parent's frame.
The prolog of a filter inside a _finally should be like code below:
%0 = call i8* @llvm.eh.recoverfp(i8* bitcast (@"?fin$0@0@main@@"), i8*%frame_pointer)
%1 = call i8* @llvm.localrecover(i8* bitcast (@"?fin$0@0@main@@"), i8*%0, i32 0)
%2 = bitcast i8* %1 to i8**
%3 = load i8*, i8** %2, align 8
Differential Revision: https://reviews.llvm.org/D77982
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index b1841d6..1fc2ed7 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -264,6 +264,9 @@ public: CodeGenModule &CGM; // Per-module state. const TargetInfo &Target; + // For EH/SEH outlined funclets, this field points to parent's CGF + CodeGenFunction *ParentCGF = nullptr; + typedef std::pair<llvm::Value *, llvm::Value *> ComplexPairTy; LoopInfoStack LoopStack; CGBuilderTy Builder; |