On Mon, Dec 14, 2009 at 4:59 PM, Mike Stump <[email protected]> wrote: > Author: mrs > Date: Mon Dec 14 18:59:40 2009 > New Revision: 91382 > > URL: http://llvm.org/viewvc/llvm-project?rev=91382&view=rev > Log: > Ensure we preserve line information for each trap for > -fcatch-undefined-behavior if we aren't optimizing. WIP.
Is this really necessary? Can the optimizer not eliminate collapse the calls? I'm not familiar with the code in question, but we have so far largely stayed away from changing the IR generated based on the optimization level, and that has nice implications for testing and reproducibility. - Daniel > > Modified: > cfe/trunk/lib/CodeGen/CGExpr.cpp > > Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=91382&r1=91381&r2=91382&view=diff > > ============================================================================== > --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original) > +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Dec 14 18:59:40 2009 > @@ -18,6 +18,7 @@ > #include "clang/AST/ASTContext.h" > #include "clang/AST/DeclObjC.h" > #include "llvm/Intrinsics.h" > +#include "clang/CodeGen/CodeGenOptions.h" > #include "llvm/Target/TargetData.h" > using namespace clang; > using namespace CodeGen; > @@ -1014,7 +1015,14 @@ > } > > llvm::BasicBlock*CodeGenFunction::getTrapBB() { > - if (TrapBB) > + const CodeGenOptions &GCO = CGM.getCodeGenOpts(); > + > + // If we are not optimzing, don't collapse all calls to trap in the > function > + // to the same call, that way, in the debugger they can see which operation > + // did in fact fail. If we are optimizing, we collpase all call to trap > down > + // to just one per function to save on codesize. > + if (GCO.OptimizationLevel > + && TrapBB) > return TrapBB; > > llvm::BasicBlock *Cont = 0; > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
