Skip to content

Commit c21e605

Browse files
authored
Update InlineFunction.cpp
#115
1 parent bed5e00 commit c21e605

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

llvm/lib/Transforms/Utils/InlineFunction.cpp

+13-6
Original file line numberDiff line numberDiff line change
@@ -2610,9 +2610,17 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI,
26102610
AllocaArraySize * AllocaTypeSize);
26112611
}
26122612
}
2613-
#ifndef _WIN32
2614-
builder.CreateLifetimeStart(AI, AllocaSize);
2615-
#endif
2613+
2614+
2615+
bool bShouldDisableLifetimeMarker = false;
2616+
2617+
if (AI->getParent() && AI->getParent()->getParent() && AI->getParent()->getParent()->hasSEHOrCXXSEH()) {
2618+
bShouldDisableLifetimeMarker = true;
2619+
}
2620+
2621+
if (!bShouldDisableLifetimeMarker)
2622+
builder.CreateLifetimeStart(AI, AllocaSize);
2623+
26162624
for (ReturnInst *RI : Returns) {
26172625
// Don't insert llvm.lifetime.end calls between a musttail or deoptimize
26182626
// call and a return. The return kills all local allocas.
@@ -2622,9 +2630,8 @@ llvm::InlineResult llvm::InlineFunction(CallBase &CB, InlineFunctionInfo &IFI,
26222630
if (InlinedDeoptimizeCalls &&
26232631
RI->getParent()->getTerminatingDeoptimizeCall())
26242632
continue;
2625-
#ifndef _WIN32
2626-
IRBuilder<>(RI).CreateLifetimeEnd(AI, AllocaSize);
2627-
#endif
2633+
if (!bShouldDisableLifetimeMarker)
2634+
IRBuilder<>(RI).CreateLifetimeEnd(AI, AllocaSize);
26282635
}
26292636
}
26302637
}

0 commit comments

Comments
 (0)