[cfe-commits] r91382 - /cfe/trunk/lib/CodeGen/CGExpr.cpp

Daniel Dunbar daniel at zuster.org
Mon Dec 14 17:39:05 PST 2009


On Mon, Dec 14, 2009 at 4:59 PM, Mike Stump <mrs at apple.com> 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
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list