[cfe-commits] r135437 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGen/debug-info-iv.c

Chris Lattner clattner at apple.com
Mon Jul 18 17:29:59 PDT 2011


On Jul 18, 2011, at 3:18 PM, Devang Patel wrote:

> Author: dpatel
> Date: Mon Jul 18 17:18:04 2011
> New Revision: 135437
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=135437&view=rev
> Log:
> Check column number also.
> 
> Modified:
>    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>    cfe/trunk/test/CodeGen/debug-info-iv.c
> 
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=135437&r1=135436&r2=135437&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Jul 18 17:18:04 2011
> @@ -1740,9 +1740,11 @@
>   // Don't bother if things are the same as last time.
>   SourceManager &SM = CGM.getContext().getSourceManager();
>   if (CurLoc == PrevLoc
> -       || (SM.getInstantiationLineNumber(CurLoc) ==
> -           SM.getInstantiationLineNumber(PrevLoc)
> -           && SM.isFromSameFile(CurLoc, PrevLoc)))
> +      || ((SM.getInstantiationLineNumber(CurLoc)
> +           == SM.getInstantiationLineNumber(PrevLoc))
> +          && (SM.getInstantiationColumnNumber(CurLoc) 
> +              == SM.getInstantiationColumnNumber(PrevLoc))
> +          && SM.isFromSameFile(CurLoc, PrevLoc)))
>     // New Builder may not be in sync with CGDebugInfo.
>     if (!Builder.getCurrentDebugLocation().isUnknown())
>       return;

Hi Devang,

This is a really inefficient way to do this.  Please call SM.getInstantiationLoc(CurLoc) and SM.getInstantiationLoc(PrevLoc) once and then use equality comparison.

-Chris

> 
> Modified: cfe/trunk/test/CodeGen/debug-info-iv.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-iv.c?rev=135437&r1=135436&r2=135437&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGen/debug-info-iv.c (original)
> +++ cfe/trunk/test/CodeGen/debug-info-iv.c Mon Jul 18 17:18:04 2011
> @@ -26,7 +26,7 @@
>       Array[i][j] = 0;
>   test_indvars(Array[0], Array);
> 
> -//CHECK:	.loc	2 30 3
> +//CHECK:	.loc	2 30 8
>   for (i=0; i < 100; i+=2)
>     for (j=0; j < 200; j++)
>       sum += Array[i][j];
> 
> 
> _______________________________________________
> 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