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,
39053905
39063906 llvm::BasicBlock *&TrapBB = TrapBBs[CheckHandlerID];
39073907
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) {
39113913 auto Call = TrapBB->begin ();
39123914 assert (isa<llvm::CallInst>(Call) && " Expected call in trap BB" );
39133915
@@ -3928,10 +3930,8 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
39283930 CGM.getCodeGenOpts ().TrapFuncName );
39293931 TrapCall->addFnAttr (A);
39303932 }
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);
39353935 TrapCall->setDoesNotReturn ();
39363936 TrapCall->setDoesNotThrow ();
39373937 Builder.CreateUnreachable ();
You can’t perform that action at this time.
0 commit comments