diff mbox

Improving alias dumps

Message ID 5630E5DE.2020306@mentor.com
State New
Headers show

Commit Message

Tom de Vries Oct. 28, 2015, 3:12 p.m. UTC
On 28/10/15 14:01, Richard Biener wrote:
> On Wed, Oct 28, 2015 at 1:04 PM, Tom de Vries <Tom_deVries@mentor.com> wrote:
>> On 26/10/15 14:29, Richard Biener wrote:
>>>
>>> On Mon, Oct 26, 2015 at 1:26 PM, Tom de Vries <Tom_deVries@mentor.com>
>>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> After spending some time looking at ealias/pta dumps, I realized that
>>>> they're hard to understand because we use varinfo names to identify
>>>> varinfos, while those names are not necessarily unique.
>>>>
>>>> F.i., for a function f:
>>>> ...
>>>> void
>>>> f (int *__restrict__ a, int *__restrict__ b)
>>>> {
>>>>     *a = 1;
>>>>     *b = 2;
>>>> }
>>>> ...
>>>>
>>>> we have at ealias the constraints:
>>>> ...
>>>> a = &PARM_NOALIAS
>>>> PARM_NOALIAS = NONLOCAL
>>>> b = &PARM_NOALIAS
>>>> PARM_NOALIAS = NONLOCAL
>>>> derefaddrtmp = &NONLOCAL
>>>> *a = derefaddrtmp
>>>> derefaddrtmp = &NONLOCAL
>>>> *b = derefaddrtmp
>>>> ...
>>>> F.i. PARM_NOALIAS occurs several times, and it's not clear if there are
>>>> one
>>>> or two varinfos with that name.
>>>>
>>>> Using attached patch, it's clearer what varinfos the constraints relate
>>>> to:
>>>> ...
>>>> a(8) = &PARM_NOALIAS(9)
>>>> PARM_NOALIAS(9) = NONLOCAL(5)
>>>> b(10) = &PARM_NOALIAS(11)
>>>> PARM_NOALIAS(11) = NONLOCAL(5)
>>>> derefaddrtmp(12) = &NONLOCAL(5)
>>>> *a(8) = derefaddrtmp(12)
>>>> derefaddrtmp(13) = &NONLOCAL(5)
>>>> *b(10) = derefaddrtmp(13)
>>>> ...
>>>>
>>>> It this a good idea, f.i. guarded by (dump_flags & TDF_DETAILS) not to
>>>> disturb scans of current tests?
>>>>
>>>> Or, do we f.i. want to fix the names themselves to be unique?
>>>
>>>
>>> I think so, on most cases the (n) adds clutter without extra info.
>>>
>>
>> Attached patch implements that approach. We get:
>>
>> a = &PARM_NOALIAS(9)
>> PARM_NOALIAS(9) = NONLOCAL
>> b = &PARM_NOALIAS(11)
>> PARM_NOALIAS(11) = NONLOCAL
>> derefaddrtmp(12) = &NONLOCAL
>> *a = derefaddrtmp(12)
>> derefaddrtmp(13) = &NONLOCAL
>> *b = derefaddrtmp(13)
>>
>> OK for trunk if bootstrap and reg-test succeeds?
>
> Ok.
>

Committed with this test-case patch added on.

Thanks,
- Tom
diff mbox

Patch

2015-10-28  Tom de Vries  <tom@codesourcery.com>

	* gcc.dg/tree-ssa/pta-callused.c: Update to scan for CALLUSED(id).
---
 gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c |   2 +-
 gcc/tree-ssa-structalias.c                   | 112 +++++++++++++++------------
 2 files changed, 63 insertions(+), 51 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c
index 59408fa..b9a57d8 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c
@@ -22,5 +22,5 @@  int bar (int b)
   return *foo (&q);
 }
 
-/* { dg-final { scan-tree-dump "CALLUSED = { ESCAPED NONLOCAL f.* i q }" "alias" } } */
+/* { dg-final { scan-tree-dump "CALLUSED\\(\[0-9\]+\\) = { ESCAPED NONLOCAL f.* i q }" "alias" } } */