diff mbox

[PR70161] Fix fdump-ipa-all-graph

Message ID 56EBCBF5.8060302@mentor.com
State New
Headers show

Commit Message

Tom de Vries March 18, 2016, 9:35 a.m. UTC
On 18/03/16 10:23, Tom de Vries wrote:
> On 15/03/16 12:37, Richard Biener wrote:
>> On Mon, 14 Mar 2016, Tom de Vries wrote:
>>
>>> Hi,
>>>
>>> this patch fixes PR70161, a 4.9/5/6 regression.
>>>
>>> Currently when using -fdump-ipa-all-graph, the compiler ICEs in
>>> execute_function_dump when testing for pass->graph_dump_initialized,
>>> because
>>> pass == NULL.
>>>
>>> The patch fixes:
>>> - the ICE by setting the pass argument in the call to
>>>    execute_function_dump in execute_one_ipa_transform_pass
>>> - a subsequent ICE (triggered with -fipa-pta) by saving, resetting and
>>>    restoring dump_file_name in cgraph_node::get_body, alongside the
>>>    saving and restoring of the dump_file variable.
>>> - the duplicate edges in the subsequently generated dot file by
>>>    ensuring that execute_function_dump is called only once per function
>>>    per pass. [ Note that this bit also has an effect for the normal dump
>>>    files for the ipa passes with transform function. For those
>>> functions,
>>>    atm execute_function_dump is called both after execute and after
>>>    transform. With the patch, it's only called after transform. ]
>>>
>>> Bootstrapped and reg-tested on x86_64.
>>>
>>> OK for stage4?
>>
>> Ok.
>>
>
> I've added these two test-cases that test the first two fixes.
>
> Committed to trunk as obvious.
>

This patch adds testing for the last fix.

In order to make scanning lines in a .dot file work, I needed a fix in 
dump-suffix to show cp.dot and inline.dot in the test summary:
...
PASS: gcc.dg/pr70161.c scan-ipa-dump-times cp.dot "subgraph" 1
PASS: gcc.dg/pr70161.c scan-ipa-dump-times inline.dot "subgraph" 1
...
Otherwise it would just show 'dot'.

Bootstrapped and reg-tested on x86_64.

OK for stage4 trunk, 4.9/5 release branches?

Thanks,
- Tom

Comments

Tom de Vries April 17, 2016, 6:07 a.m. UTC | #1
[ was: PATCH, PR70161] Fix fdump-ipa-all-graph ]

On 18/03/16 10:35, Tom de Vries wrote:
> On 18/03/16 10:23, Tom de Vries wrote:
>> On 15/03/16 12:37, Richard Biener wrote:
>>> On Mon, 14 Mar 2016, Tom de Vries wrote:
>>>
>>>> Hi,
>>>>
>>>> this patch fixes PR70161, a 4.9/5/6 regression.
>>>>
>>>> Currently when using -fdump-ipa-all-graph, the compiler ICEs in
>>>> execute_function_dump when testing for pass->graph_dump_initialized,
>>>> because
>>>> pass == NULL.
>>>>
>>>> The patch fixes:
>>>> - the ICE by setting the pass argument in the call to
>>>>    execute_function_dump in execute_one_ipa_transform_pass
>>>> - a subsequent ICE (triggered with -fipa-pta) by saving, resetting and
>>>>    restoring dump_file_name in cgraph_node::get_body, alongside the
>>>>    saving and restoring of the dump_file variable.
>>>> - the duplicate edges in the subsequently generated dot file by
>>>>    ensuring that execute_function_dump is called only once per function
>>>>    per pass. [ Note that this bit also has an effect for the normal
>>>> dump
>>>>    files for the ipa passes with transform function. For those
>>>> functions,
>>>>    atm execute_function_dump is called both after execute and after
>>>>    transform. With the patch, it's only called after transform. ]
>>>>
>>>> Bootstrapped and reg-tested on x86_64.
>>>>
>>>> OK for stage4?
>>>
>>> Ok.
>>>
>>
>> I've added these two test-cases that test the first two fixes.
>>
>> Committed to trunk as obvious.
>>
>
> This patch adds testing for the last fix.
>
> In order to make scanning lines in a .dot file work, I needed a fix in
> dump-suffix to show cp.dot and inline.dot in the test summary:
> ...
> PASS: gcc.dg/pr70161.c scan-ipa-dump-times cp.dot "subgraph" 1
> PASS: gcc.dg/pr70161.c scan-ipa-dump-times inline.dot "subgraph" 1
> ...
> Otherwise it would just show 'dot'.
>
> Bootstrapped and reg-tested on x86_64.
>
> OK for stage4 trunk, 4.9/5 release branches?
>

Ping.

Thanks,
- Tom

> 0004-Add-dot-file-scans-to-pr70161.c.patch
>
>
> Add dot-file scans to pr70161.c
>
> 2016-03-18  Tom de Vries  <tom@codesourcery.com>
>
> 	* gcc.dg/pr70161.c: Add dot-file scans.
> 	* lib/scandump.exp (dump-suffix): Return suffix after first dot char,
> 	instead of after last dot char.
>
> ---
>   gcc/testsuite/gcc.dg/pr70161.c | 3 +++
>   gcc/testsuite/lib/scandump.exp | 2 +-
>   2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/testsuite/gcc.dg/pr70161.c b/gcc/testsuite/gcc.dg/pr70161.c
> index 0b173c7..9b77d90 100644
> --- a/gcc/testsuite/gcc.dg/pr70161.c
> +++ b/gcc/testsuite/gcc.dg/pr70161.c
> @@ -5,3 +5,6 @@ void
>   foo (void)
>   {
>   }
> +
> +/* { dg-final { scan-ipa-dump-times "subgraph" 1 "inline.dot" } } */
> +/* { dg-final { scan-ipa-dump-times "subgraph" 1 "cp.dot" } } */
> diff --git a/gcc/testsuite/lib/scandump.exp b/gcc/testsuite/lib/scandump.exp
> index 74d27cc..89b3944 100644
> --- a/gcc/testsuite/lib/scandump.exp
> +++ b/gcc/testsuite/lib/scandump.exp
> @@ -22,7 +22,7 @@
>   # Extract the constant part of the dump file suffix from the regexp.
>   # Argument 0 is the regular expression.
>   proc dump-suffix { arg } {
> -    set idx [expr [string last "." $arg] + 1]
> +    set idx [expr [string first "." $arg] + 1]
>       return [string range $arg $idx end]
>   }
>
>
Richard Biener April 18, 2016, 7:30 a.m. UTC | #2
On Sun, 17 Apr 2016, Tom de Vries wrote:

> [ was: PATCH, PR70161] Fix fdump-ipa-all-graph ]
> 
> On 18/03/16 10:35, Tom de Vries wrote:
> > On 18/03/16 10:23, Tom de Vries wrote:
> > > On 15/03/16 12:37, Richard Biener wrote:
> > > > On Mon, 14 Mar 2016, Tom de Vries wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > this patch fixes PR70161, a 4.9/5/6 regression.
> > > > > 
> > > > > Currently when using -fdump-ipa-all-graph, the compiler ICEs in
> > > > > execute_function_dump when testing for pass->graph_dump_initialized,
> > > > > because
> > > > > pass == NULL.
> > > > > 
> > > > > The patch fixes:
> > > > > - the ICE by setting the pass argument in the call to
> > > > >    execute_function_dump in execute_one_ipa_transform_pass
> > > > > - a subsequent ICE (triggered with -fipa-pta) by saving, resetting and
> > > > >    restoring dump_file_name in cgraph_node::get_body, alongside the
> > > > >    saving and restoring of the dump_file variable.
> > > > > - the duplicate edges in the subsequently generated dot file by
> > > > >    ensuring that execute_function_dump is called only once per
> > > > > function
> > > > >    per pass. [ Note that this bit also has an effect for the normal
> > > > > dump
> > > > >    files for the ipa passes with transform function. For those
> > > > > functions,
> > > > >    atm execute_function_dump is called both after execute and after
> > > > >    transform. With the patch, it's only called after transform. ]
> > > > > 
> > > > > Bootstrapped and reg-tested on x86_64.
> > > > > 
> > > > > OK for stage4?
> > > > 
> > > > Ok.
> > > > 
> > > 
> > > I've added these two test-cases that test the first two fixes.
> > > 
> > > Committed to trunk as obvious.
> > > 
> > 
> > This patch adds testing for the last fix.
> > 
> > In order to make scanning lines in a .dot file work, I needed a fix in
> > dump-suffix to show cp.dot and inline.dot in the test summary:
> > ...
> > PASS: gcc.dg/pr70161.c scan-ipa-dump-times cp.dot "subgraph" 1
> > PASS: gcc.dg/pr70161.c scan-ipa-dump-times inline.dot "subgraph" 1
> > ...
> > Otherwise it would just show 'dot'.
> > 
> > Bootstrapped and reg-tested on x86_64.
> > 
> > OK for stage4 trunk, 4.9/5 release branches?
> > 
> 
> Ping.
> 
> Thanks,
> - Tom
> 
> > 0004-Add-dot-file-scans-to-pr70161.c.patch
> > 
> > 
> > Add dot-file scans to pr70161.c
> > 
> > 2016-03-18  Tom de Vries  <tom@codesourcery.com>
> > 
> > 	* gcc.dg/pr70161.c: Add dot-file scans.
> > 	* lib/scandump.exp (dump-suffix): Return suffix after first dot char,
> > 	instead of after last dot char.
> > 
> > ---
> >   gcc/testsuite/gcc.dg/pr70161.c | 3 +++
> >   gcc/testsuite/lib/scandump.exp | 2 +-
> >   2 files changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/gcc/testsuite/gcc.dg/pr70161.c b/gcc/testsuite/gcc.dg/pr70161.c
> > index 0b173c7..9b77d90 100644
> > --- a/gcc/testsuite/gcc.dg/pr70161.c
> > +++ b/gcc/testsuite/gcc.dg/pr70161.c
> > @@ -5,3 +5,6 @@ void
> >   foo (void)
> >   {
> >   }
> > +
> > +/* { dg-final { scan-ipa-dump-times "subgraph" 1 "inline.dot" } } */
> > +/* { dg-final { scan-ipa-dump-times "subgraph" 1 "cp.dot" } } */
> > diff --git a/gcc/testsuite/lib/scandump.exp b/gcc/testsuite/lib/scandump.exp
> > index 74d27cc..89b3944 100644
> > --- a/gcc/testsuite/lib/scandump.exp
> > +++ b/gcc/testsuite/lib/scandump.exp
> > @@ -22,7 +22,7 @@
> >   # Extract the constant part of the dump file suffix from the regexp.
> >   # Argument 0 is the regular expression.
> >   proc dump-suffix { arg } {
> > -    set idx [expr [string last "." $arg] + 1]
> > +    set idx [expr [string first "." $arg] + 1]

Does that even work?  For t.c.012t.foo the first "." is after 't'.

Richard.

> >       return [string range $arg $idx end]
> >   }
> > 
> > 
> 
>
diff mbox

Patch

Add dot-file scans to pr70161.c

2016-03-18  Tom de Vries  <tom@codesourcery.com>

	* gcc.dg/pr70161.c: Add dot-file scans.
	* lib/scandump.exp (dump-suffix): Return suffix after first dot char,
	instead of after last dot char.

---
 gcc/testsuite/gcc.dg/pr70161.c | 3 +++
 gcc/testsuite/lib/scandump.exp | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/pr70161.c b/gcc/testsuite/gcc.dg/pr70161.c
index 0b173c7..9b77d90 100644
--- a/gcc/testsuite/gcc.dg/pr70161.c
+++ b/gcc/testsuite/gcc.dg/pr70161.c
@@ -5,3 +5,6 @@  void
 foo (void)
 {
 }
+
+/* { dg-final { scan-ipa-dump-times "subgraph" 1 "inline.dot" } } */
+/* { dg-final { scan-ipa-dump-times "subgraph" 1 "cp.dot" } } */
diff --git a/gcc/testsuite/lib/scandump.exp b/gcc/testsuite/lib/scandump.exp
index 74d27cc..89b3944 100644
--- a/gcc/testsuite/lib/scandump.exp
+++ b/gcc/testsuite/lib/scandump.exp
@@ -22,7 +22,7 @@ 
 # Extract the constant part of the dump file suffix from the regexp.
 # Argument 0 is the regular expression.
 proc dump-suffix { arg } {
-    set idx [expr [string last "." $arg] + 1]
+    set idx [expr [string first "." $arg] + 1]
     return [string range $arg $idx end]
 }