oskarwirga added inline comments.

================
Comment at: clang/lib/CodeGen/CGExpr.cpp:3576-3597
+    if (TrapBBs.size() <= CheckHandlerID)
+      TrapBBs.resize(CheckHandlerID + 1);
+    llvm::BasicBlock *&TrapBB = TrapBBs[CheckHandlerID];
+
+    if (!CGM.getCodeGenOpts().OptimizationLevel || !TrapBB ||
+        (CurCodeDecl && CurCodeDecl->hasAttr<OptimizeNoneAttr>())) {
+      TrapBB = createBasicBlock("trap");
----------------
vitalybuka wrote:
> looks like a lot of code duplication
Let me refactor this 


================
Comment at: clang/lib/CodeGen/CGExpr.cpp:3594
+        TrapCall->addFnAttr(A);
+      }
+      TrapCall->setDoesNotReturn();
----------------
vitalybuka wrote:
> wouldn't be you issues solved with
> TrapCall->setCannotMerge() here?
ubsantrap gets lowered to an instruction in MIR which then gets merged later. 
This was the only way I was able to create unique instruction per check. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148654

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

Reply via email to