samsonov added a comment.

Sorry for delay.


================
Comment at: lib/CodeGen/CGExpr.cpp:2543
@@ +2542,3 @@
+  // RE: Bug: 25682
+  if(!CGM.getCodeGenOpts().MergeTraps || 
!CGM.getCodeGenOpts().OptimizationLevel || !TrapBB) {
+    // If we aren't merging traps, set the function to not be optimized as some
----------------
This condition is somewhat hard to parse. Consider inverting it:
  // Collapse all trap calls to one per function if we're optimizing, and ....
  if (TrapBB && CGM.getCodeGenOpts().OptimizationLevel && 
CGM.getCodeGenOpts().MergeTraps) {
    Builder.CreateCondBr(Checked, Cont, TrapBB);
  } else {
     //...
  }

================
Comment at: lib/CodeGen/CGExpr.cpp:2557
@@ +2556,3 @@
+      // This closely mirrors what is done to avoid function merging
+      // in the address sanitizer. The trap function is not set
+      // to not return as there is an unreachable instruction
----------------
Nit: AddressSanitizer, or ASan.

================
Comment at: lib/CodeGen/CGExpr.cpp:2558
@@ +2557,3 @@
+      // in the address sanitizer. The trap function is not set
+      // to not return as there is an unreachable instruction
+      // generated at the end of the block.
----------------
What's wrong with marking trap function as noreturn anyway? unreachable 
instruction is, well, supposed to be unreachable.

================
Comment at: lib/CodeGen/CGExpr.cpp:2560
@@ +2559,3 @@
+      // generated at the end of the block.
+      EmitTrapCall(llvm::Intrinsic::trap);
+      llvm::InlineAsm *EmptyAsm = 
llvm::InlineAsm::get(llvm::FunctionType::get(Builder.getVoidTy(), false),
----------------
This can also be hoisted from branches.


Repository:
  rL LLVM

http://reviews.llvm.org/D15208



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

Reply via email to