[PATCH] D148654: Modify BoundsSan to improve debuggability
Nuno Lopes via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 12 14:17:07 PDT 2023
nlopes added inline comments.
================
Comment at: llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp:189
auto GetTrapBB = [&TrapBB](BuilderTy &IRB) {
- if (TrapBB && SingleTrapBB)
- return TrapBB;
-
- Function *Fn = IRB.GetInsertBlock()->getParent();
- // FIXME: This debug location doesn't make a lot of sense in the
- // `SingleTrapBB` case.
- auto DebugLoc = IRB.getCurrentDebugLocation();
- IRBuilder<>::InsertPointGuard Guard(IRB);
- TrapBB = BasicBlock::Create(Fn->getContext(), "trap", Fn);
- IRB.SetInsertPoint(TrapBB);
-
- auto *F = Intrinsic::getDeclaration(Fn->getParent(), Intrinsic::trap);
- CallInst *TrapCall = IRB.CreateCall(F, {});
- TrapCall->setDoesNotReturn();
- TrapCall->setDoesNotThrow();
- TrapCall->setDebugLoc(DebugLoc);
- IRB.CreateUnreachable();
-
+ if (DebugTrapBB) {
+ Function *Fn = IRB.GetInsertBlock()->getParent();
----------------
this seems like code duplication. This pass already has the single-trap flag to exactly control if you get a single trap BB or one per check for better debug info.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148654/new/
https://reviews.llvm.org/D148654
More information about the cfe-commits
mailing list