public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/91789] Value ranges determined from comparisons not used transitively
       [not found] <bug-91789-4@http.gcc.gnu.org/bugzilla/>
@ 2020-11-06 22:20 ` amacleod at redhat dot com
  2021-12-16  0:09 ` pinskia at gcc dot gnu.org
  2021-12-16  3:04 ` amacleod at redhat dot com
  2 siblings, 0 replies; 3+ messages in thread
From: amacleod at redhat dot com @ 2020-11-06 22:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91789

--- Comment #5 from Andrew Macleod <amacleod at redhat dot com> ---
Ranger made it in, but relations have not been implemented for this release.
GCC 12 for sure!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/91789] Value ranges determined from comparisons not used transitively
       [not found] <bug-91789-4@http.gcc.gnu.org/bugzilla/>
  2020-11-06 22:20 ` [Bug tree-optimization/91789] Value ranges determined from comparisons not used transitively amacleod at redhat dot com
@ 2021-12-16  0:09 ` pinskia at gcc dot gnu.org
  2021-12-16  3:04 ` amacleod at redhat dot com
  2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-16  0:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91789

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
We have in evrp:
 Registering value_relation (b_2(D) >= a_3(D)) on (2->4)

...

Relational : (b_2(D) >= a_3(D))
    <bb 4> :
    if (a_3(D) < 0)
      goto <bb 5>; [INV]
    else
      goto <bb 6>; [INV]

4->5  (T) a_3(D) :      int [-INF, -1]
4->6  (F) a_3(D) :      int [0, +INF]

But then we don't update the value relationship for what we had for b_2 for the
branch where a_3 >= 0, we should also a range for b_2(D) of [0, +INF] for 4->6.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/91789] Value ranges determined from comparisons not used transitively
       [not found] <bug-91789-4@http.gcc.gnu.org/bugzilla/>
  2020-11-06 22:20 ` [Bug tree-optimization/91789] Value ranges determined from comparisons not used transitively amacleod at redhat dot com
  2021-12-16  0:09 ` pinskia at gcc dot gnu.org
@ 2021-12-16  3:04 ` amacleod at redhat dot com
  2 siblings, 0 replies; 3+ messages in thread
From: amacleod at redhat dot com @ 2021-12-16  3:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91789

--- Comment #7 from Andrew Macleod <amacleod at redhat dot com> ---
hmm. yeah. we have the knowledge... but how to apply it efficiently.



=========== BB 4 ============
Imports: a_3(D)
Exports: a_3(D)
b_2(D)  int VARYING
a_3(D)  int VARYING
Relational : (b_2(D) >= a_3(D))
    <bb 4> :
    if (a_3(D) < 0)
      goto <bb 5>; [INV]
    else
      goto <bb 6>; [INV]

4->5  (T) a_3(D) :      int [-INF, -1]
4->6  (F) a_3(D) :      int [0, +INF]

We know the relationship upon entry to BB 4, but with no reference to b_2,
there is no reason to update b_2's range.  b_2 may never be reference again.

=========== BB 6 ============
Imports: b_2(D)
Exports: b_2(D)
b_2(D)  int VARYING
    <bb 6> :
    if (b_2(D) < 0)
      goto <bb 7>; [INV]
    else
      goto <bb 8>; [INV]

6->7  (T) b_2(D) :      int [-INF, -1]
6->8  (F) b_2(D) :      int [0, +INF]

And upon entry to BB6, we do know that a_3 is [0, +INF], but with no reference
to a_3 in this block, we don't see any reason to look to see if there is a
relationship.  And with no further references to a_3 in the IL, we wont
propagate its value to here either.


THe problem is that unless we do an exhaustive search of every possible
relation of b_2, there is nothing in the IL at each point to indicate we should
look at the other name.

Perhaps it isnt as bad as I make it sound.

r perhaps I can add relations to the export list for a block and have gori
figure it out.
IE, in bb4  a_3 is the only export, and we can calculate a range for it. 
If we note at this point that there is a relation between a_3 and b_2, perhaps
I can add b_2 to the export list as well, and the GORI how to process the
relation much like it process recalculations.

IF we have c_9 = a_3 - 10 somewhere in the program, we note the dependence of
c_9 on a_3, and we "recalculate" c_9 as [0,+INF] - 10  == [-10, +INF-10] on
that edge.

Perhaps I can likewise add relations to this recomputation and flag b_3 as a
recomputation.. Since the relation is technically "true", it could be solved
for b_2 as 
  [1, 1] = b_2(D) >= [1, +INF] and everything should just work... 
hmm.  
I shall give it a go after a bit more thought.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-16  3:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-91789-4@http.gcc.gnu.org/bugzilla/>
2020-11-06 22:20 ` [Bug tree-optimization/91789] Value ranges determined from comparisons not used transitively amacleod at redhat dot com
2021-12-16  0:09 ` pinskia at gcc dot gnu.org
2021-12-16  3:04 ` amacleod at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).