vsk added inline comments.

================
Comment at: clang/lib/CodeGen/CGExpr.cpp:3458
+    llvm::CallInst *TrapCall =
+        Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::ubsantrap),
+                           llvm::ConstantInt::get(CGM.Int32Ty, 
CheckHandlerID));
----------------
vsk wrote:
> This seems to apply the current DebugLoc from Builder to the shared trap call 
> when optimizing. That's potentially misleading (say you have two trapping 
> additions -- if the second one traps, the crashlog will make it look like the 
> first one trapped).
> 
> I think the fix is just: `if (optimizing) TrapCall->dropLocation();`. This 
> can be fixed before/after/in this patch, whatever you prefer.
Or better: instead of dropping the debug loc of the trap call immediately, 
apply a merged debug loc before emitting the condbr (see 
Instruction::applyMergedLocation). That way, if there aren't multiple trapping 
operations, the original debug loc is preserved.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89959/new/

https://reviews.llvm.org/D89959

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to