Track locations of individual loads in -Rpass remarks (Re: [polly] Add diagnostic remark for ReportVariantBasePtr)

Tobias Grosser tobias at grosser.es
Mon Jul 21 06:36:45 PDT 2014


Move to cfe-dev@

Some context:

When reporting aliasing or too complicated data access functions we 
would like to emit remarks that point to the relevant load instructions. 
At the moment, the column info clang emits is not precise enough such 
that we only point to the beginning of a line.

On 11/07/2014 17:53, Diego Novillo wrote:
> On Fri, Jul 11, 2014 at 2:57 AM, Tobias Grosser <tobias at grosser.es> wrote:
>> On 26/06/2014 23:06, Andreas Simbuerger wrote:
>>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> - --- examples/polli ยป pclang -S -g -gcolumn-info -emit-llvm -O3 -mllvm
>>> - -polly-detect-track-failures -mllvm -polly-detect-keep-going -mllvm
>>> - -polly -Xclang -Rpass-missed="polly-detect" -c tobi-scop.c
>>> tobi-scop.c:6:8: remark: The following errors keep this region from
>>> being a Scop.
>>>         [-Rpass-missed=polly-detect]
>>>     for (int i = 0; i < 32; i++)
>>>          ^
>>> tobi-scop.c:7:5: remark: The base address of this array is not
>>> invariant inside the loop
>>>         [-Rpass-missed=polly-detect]
>>>       A->b[i] = A->b[i + 1];
>>>       ^
>>> tobi-scop.c:7:5: remark: The base address of this array is not
>>> invariant inside the loop
>>>         [-Rpass-missed=polly-detect]
>>>
>>> In this case here I have -Rpass-missed -g -gcolumn-info specified.
>>>
>>> I would expect the first remark pinned at line 7 column 5
>>> and the second remark pinned at the read in line 7 column 17.
>>>
>>> However, the IR only contains dbg nodes for line 7 column 5 inside the
>>> loop body. Tobi's patch further up in the thread fixes it.
>>
>>
>> To add relevant information to this thread, Diego committed -gcolumn-info in
>> r212781, so our caret diagnostic is now at the right place.
>>
>> clang still does not emit separate debug locations for individual
>> loads/stores. We could now add this on top of -gcolumn-info.
>
> Right. One of the current limitations is that the backend receives
> degraded location information.  Clang's tracking of locations is
> mapped to dwarf locs, which are not as precise.
>
> One possible future direction would be to transfer Clang's source
> location tables to the backend, but that seems pretty convoluted and
> it would not survive without the front end. A bitcode file with the
> source location annotations would not be able to provide actual
> file/line/column info.

I came up with the following patch to emit accurate column-info for each 
load instruction. The patch seems to work for my limited test cases (the 
once above), but as I did not have worked in this area of
clang, I would appreciate some cross-checks.

Diego, you just recently run the -gcolumn-info test cases on your 
internal code base and on the gdb test suite. Would it be difficult for
you to create similar information for the attached patch to get an idea 
of how much overhead this patch would cause?

Cheers,
Tobias


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Emit-column-information-for-loads.patch
Type: text/x-patch
Size: 914 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140721/8e79e73b/attachment.bin>


More information about the llvm-commits mailing list