File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -3905,9 +3905,11 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
3905
3905
3906
3906
llvm::BasicBlock *&TrapBB = TrapBBs[CheckHandlerID];
3907
3907
3908
- if (!ClSanitizeDebugDeoptimization &&
3909
- CGM.getCodeGenOpts ().OptimizationLevel && TrapBB &&
3910
- (!CurCodeDecl || !CurCodeDecl->hasAttr <OptimizeNoneAttr>())) {
3908
+ bool NoMerge = ClSanitizeDebugDeoptimization ||
3909
+ !CGM.getCodeGenOpts ().OptimizationLevel ||
3910
+ (CurCodeDecl && CurCodeDecl->hasAttr <OptimizeNoneAttr>());
3911
+
3912
+ if (TrapBB && !NoMerge) {
3911
3913
auto Call = TrapBB->begin ();
3912
3914
assert (isa<llvm::CallInst>(Call) && " Expected call in trap BB" );
3913
3915
@@ -3928,10 +3930,8 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
3928
3930
CGM.getCodeGenOpts ().TrapFuncName );
3929
3931
TrapCall->addFnAttr (A);
3930
3932
}
3931
- // We unconditionally add NoMerge, even if this is the first time we've
3932
- // seen this type of trap in this function. This is necessary because
3933
- // inlining may occur in later stages.
3934
- TrapCall->addFnAttr (llvm::Attribute::NoMerge);
3933
+ if (NoMerge)
3934
+ TrapCall->addFnAttr (llvm::Attribute::NoMerge);
3935
3935
TrapCall->setDoesNotReturn ();
3936
3936
TrapCall->setDoesNotThrow ();
3937
3937
Builder.CreateUnreachable ();
You can’t perform that action at this time.
0 commit comments