aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-10-07 21:03:41 +0000
committerReid Kleckner <rnk@google.com>2015-10-07 21:03:41 +0000
commit1f88e93973024e8e59611553ad63fc913f6699e4 (patch)
treef7142c0d9a6a146fa08ddb2e88836a20ece8d738 /clang/lib/CodeGen/CGDecl.cpp
parent4462c6190e7164009bce6d6f0d2f37f14a41eabd (diff)
downloadllvm-1f88e93973024e8e59611553ad63fc913f6699e4.zip
llvm-1f88e93973024e8e59611553ad63fc913f6699e4.tar.gz
llvm-1f88e93973024e8e59611553ad63fc913f6699e4.tar.bz2
[WinEH] Don't use lifetime markers for MS catch parameters
We don't have a good place to put them. Our previous spot was causing us to optimize loads from the exception object to undef, because it was after the catchpad instruction that models the write to the catch object. llvm-svn: 249616
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 07684f9..3cff635 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -974,9 +974,15 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) {
address = CreateTempAlloca(allocaTy, allocaAlignment);
address.getPointer()->setName(D.getName());
+ // Don't emit lifetime markers for MSVC catch parameters. The lifetime of
+ // the catch parameter starts in the catchpad instruction, and we can't
+ // insert code in those basic blocks.
+ bool IsMSCatchParam =
+ D.isExceptionVariable() && getTarget().getCXXABI().isMicrosoft();
+
// Emit a lifetime intrinsic if meaningful. There's no point
// in doing this if we don't have a valid insertion point (?).
- if (HaveInsertPoint()) {
+ if (HaveInsertPoint() && !IsMSCatchParam) {
uint64_t size = CGM.getDataLayout().getTypeAllocSize(allocaTy);
emission.SizeForLifetimeMarkers =
EmitLifetimeStart(size, address.getPointer());