On 8/25/21 1:34 PM, Andrew MacLeod wrote:
On 8/25/21 3:15 PM, Martin Sebor wrote:
On 8/25/21 11:46 AM, Andrew MacLeod wrote:
On 8/25/21 1:25 PM, Martin Sebor wrote:
I noticed that the output of -fdump-tree-walloca (and probably all
passes that call gimple_ranger::export_global_ranges()) includes
the following two lines for all functions, even when there's
nothing else of relevance after them:

Exported global range table
===========================

I was a bit puzzled by it at first, wondering if it was leftover
debugging output, until I checked the code and realized it's
a header that may be (but isn't always) followed by the contents
of the table.

To reduce clutter in the dump the attached patch changes the function
to print the header only when it is followed by at least one line of
output.  (Another tweak to reduce even further the amount of output
printed by default that might be worth considering is to print
the table only when TDF_DETAILS is set.)

Martin

Except checking x == 1 won't work if ssa_name(1)  was not updated.

Just set a flag if the header hasn't been printed yet. tried and true. I guess you can protect it behind details if you want.

Doh!  I've fixed that.  While testing I came across another instance
of the same pattern so I've made the same change there as well.  I
also took the liberty to make the output slightly more consistent
between the two dumps.

Attached is what I'm planning to commit.  Please let me know if you
have any other suggestions.

OK, thats fine.

I got ahead of myself and pushed the change in r12-3144 before my
second test run finished.  A few tree-ssa tests needed adjusting
after the TDF_DETAILS change.  I fixed those r12-3152.



FWIW, I see duplicate output in the EVRP1 dump that looks just like
it could be the output under Non-varying global ranges. I wonder if
it's the result of the block in ranger_cache::fill_block_cache guarded
by if (DEBUG_RANGE_CACHE).

Martin


The cache debug mechanism hasnt been fully reworked yet... i moved GORI and the ranger to the trace class.. I haven't decided yet what I want to change in the cache. its a bit dated.

regardless, if your sources are up to date, DEBUG_RANGE_CACHE is now guarded by:

#define DEBUG_RANGE_CACHE (dump_file && (param_evrp_mode & EVRP_MODE_CACHE) \
                                          == EVRP_MODE_CACHE)

so you'd only see that output if you specify --param=evrp-mode=cache or debug

It's not a big deal but the output I noticed is actually coming
from gimple_ranger::dump_bb ().  In the test I happened to look
at it shows up just before Non-varying global ranges:  It's
attached just to show you what I mean.

Martin
;; Function foo (foo, funcdef_no=0, decl_uid=1943, cgraph_uid=1, symbol_order=0)

;; 1 loops found
;;
;; Loop 0
;;  header 0, latch 1
;;  depth 0, outer -1
;;  nodes: 0 1 2
;; 2 succs { 1 }

Substituting values and folding statements

Folding statement: _3 = *x_2(D);
Not folded
Folding statement: return _3;
Not folded

=========== BB 2 ============
    <bb 2> :
    _3 = *x_2(D);
    return _3;


char foo (char * x)
{
  char _3;

  <bb 2> :
  _3 = *x_2(D);
  return _3;

}



;; Function bar (bar, funcdef_no=1, decl_uid=1946, cgraph_uid=2, symbol_order=1)

;; 1 loops found
;;
;; Loop 0
;;  header 0, latch 1
;;  depth 0, outer -1
;;  nodes: 0 1 2
;; 2 succs { 1 }

Substituting values and folding statements

Folding statement: saved_stack.1_16 = __builtin_stack_save ();
Not folded
Folding statement: _18 = *x_17(D);
Not folded
Folding statement: _1 = (long int) _18;
Not folded
Folding statement: _2 = _1 + -1;
 Registering value_relation (_2 < _1) (bb2) at _2 = _1 + -1;
Not folded
Folding statement: _3 = (sizetype) _2;
Not folded
Folding statement: _4 = (sizetype) _18;
Not folded
Folding statement: _5 = (bitsizetype) _4;
Not folded
Folding statement: _6 = _5 * 64;
Not folded
Folding statement: _8 = _4 * 8;
Not folded
Folding statement: arr.0_26 = __builtin_alloca_with_align (_8, 64);
Not folded
Folding statement: __builtin_stack_restore (saved_stack.1_16);
Not folded
Folding statement: return;
Not folded

=========== BB 2 ============
Relational : (_2 < _1)
    <bb 2> :
    saved_stack.1_16 = __builtin_stack_save ();
    _18 = *x_17(D);
    _1 = (long int) _18;
    _2 = _1 + -1;
    _3 = (sizetype) _2;
    _4 = (sizetype) _18;
    _5 = (bitsizetype) _4;
    _6 = _5 * 64;
    _8 = _4 * 8;
    arr.0_26 = __builtin_alloca_with_align (_8, 64);
    __builtin_stack_restore (saved_stack.1_16);
    return;

_1 : long int [-128, 127]
_2 : long int [-129, 126]
_3 : sizetype [0, 126][18446744073709551487, +INF]
_4 : sizetype [0, 127][18446744073709551488, +INF]
_5 : bitsizetype [0, 127][18446744073709551488, 18446744073709551615]
_6 : bitsizetype [0, 8128][0x3fffffffffffffe000, 0x3fffffffffffffffc0]
_8 : sizetype [0, 1016][18446744073709550592, 18446744073709551608]
arr.0_26 : void *[0:D.1956] * [1B, +INF]
Non-varying global ranges:
=========================:
_1  : long int [-128, 127]
_2  : long int [-129, 126]
_3  : sizetype [0, 126][18446744073709551487, +INF]
_4  : sizetype [0, 127][18446744073709551488, +INF]
_5  : bitsizetype [0, 127][18446744073709551488, 18446744073709551615]
_6  : bitsizetype [0, 8128][0x3fffffffffffffe000, 0x3fffffffffffffffc0]
_8  : sizetype [0, 1016][18446744073709550592, 18446744073709551608]
arr.0_26  : void *[0:D.1956] * [1B, +INF]


Exported global range table:
============================
_1  : long int [-128, 127]
_2  : long int [-129, 126]
_3  : sizetype ~[127, 18446744073709551486]
_4  : sizetype ~[128, 18446744073709551487]
_5  : bitsizetype [0, 18446744073709551615]
         irange : bitsizetype [0, 127][18446744073709551488, 
18446744073709551615]
_6  : bitsizetype [0, 0x3fffffffffffffffc0]
         irange : bitsizetype [0, 8128][0x3fffffffffffffe000, 
0x3fffffffffffffffc0]
_8  : sizetype [0, 18446744073709551608]
         irange : sizetype [0, 1016][18446744073709550592, 18446744073709551608]
arr.0_26  : void *[0:D.1956] * [1B, +INF]
void bar (char * x)
{
  char D.1968;
  void *[0:D.1956] * arr.0;
  sizetype D.1956;
  long int _1;
  long int _2;
  sizetype _3;
  sizetype _4;
  bitsizetype _5;
  bitsizetype _6;
  sizetype _8;
  void * saved_stack.1_16;
  char _18;

  <bb 2> :
  saved_stack.1_16 = __builtin_stack_save ();
  _18 = *x_17(D);
  _1 = (long int) _18;
  _2 = _1 + -1;
  _3 = (sizetype) _2;
  _4 = (sizetype) _18;
  _5 = (bitsizetype) _4;
  _6 = _5 * 64;
  _8 = _4 * 8;
  arr.0_26 = __builtin_alloca_with_align (_8, 64);
  __builtin_stack_restore (saved_stack.1_16);
  return;

}



;; Function baz (baz, funcdef_no=2, decl_uid=1950, cgraph_uid=3, symbol_order=2)

;; 1 loops found
;;
;; Loop 0
;;  header 0, latch 1
;;  depth 0, outer -1
;;  nodes: 0 1 2
;; 2 succs { 1 }

Substituting values and folding statements

Folding statement: saved_stack.1_3 = __builtin_stack_save ();
Not folded
Folding statement: __builtin_stack_restore (saved_stack.1_3);
Not folded
Folding statement: return;
Not folded

=========== BB 2 ============
    <bb 2> :
    saved_stack.1_3 = __builtin_stack_save ();
    __builtin_stack_restore (saved_stack.1_3);
    return;


void baz (char * x)
{
  void * saved_stack.1_3;

  <bb 2> :
  saved_stack.1_3 = __builtin_stack_save ();
  __builtin_stack_restore (saved_stack.1_3);
  return;

}


Reply via email to