public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/79119] absolute value of a pointer difference can be assumed to be less than or equal to PTRDIFF_MAX
[not found] <bug-79119-4@http.gcc.gnu.org/bugzilla/>
@ 2023-04-27 22:31 ` pinskia at gcc dot gnu.org
2023-05-02 0:15 ` pinskia at gcc dot gnu.org
2023-05-06 20:20 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-27 22:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79119
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So a couple of things need to happen really:
optimized now:
if (p_10 < q_12)
goto <bb 3>; [50.00%]
else
goto <bb 4>; [50.00%]
<bb 3> [local count: 536870913]:
_3 = _22 - _21;
_4 = _3 /[ex] 4;
iftmp.0_14 = (long unsigned int) _4;
goto <bb 5>; [100.00%]
<bb 4> [local count: 536870913]:
_5 = _21 - _22;
_6 = _5 /[ex] 4;
iftmp.0_13 = (long unsigned int) _6;
<bb 5> [local count: 1073741824]:
# iftmp.0_7 = PHI <iftmp.0_14(3), iftmp.0_13(4)>
I have a patch which is able to move the cast out of the PHI (will be posting
it today or tomorrow).
The next thing is we need to move the /[ext] 4 out of the PHI, I have not
extended PHIOPT to do that just yet (just extended it to handle unary
operations though).
And then we have to see the abs but with _22/_21 being unrelated to p_10/q_12
except with a cast, it might be hard. I am looking into a patch for the case
where if _22/_21 was in the conditional.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/79119] absolute value of a pointer difference can be assumed to be less than or equal to PTRDIFF_MAX
[not found] <bug-79119-4@http.gcc.gnu.org/bugzilla/>
2023-04-27 22:31 ` [Bug tree-optimization/79119] absolute value of a pointer difference can be assumed to be less than or equal to PTRDIFF_MAX pinskia at gcc dot gnu.org
@ 2023-05-02 0:15 ` pinskia at gcc dot gnu.org
2023-05-06 20:20 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-02 0:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79119
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm:
# RANGE [irange] long unsigned int [0,
2305843009213693951][16140901064495857664, +INF]
iftmp.0_7 = (long unsigned intD.10) _19;
if (iftmp.0_7 > 2305843009213693951)
So that is _19 < 0 If I read this correctly.
The only reason why it was not converted is because of the /4 that was before.
So we have a hole in the range.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/79119] absolute value of a pointer difference can be assumed to be less than or equal to PTRDIFF_MAX
[not found] <bug-79119-4@http.gcc.gnu.org/bugzilla/>
2023-04-27 22:31 ` [Bug tree-optimization/79119] absolute value of a pointer difference can be assumed to be less than or equal to PTRDIFF_MAX pinskia at gcc dot gnu.org
2023-05-02 0:15 ` pinskia at gcc dot gnu.org
@ 2023-05-06 20:20 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-06 20:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79119
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=94274
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> So a couple of things need to happen really:
> optimized now:
> if (p_10 < q_12)
> goto <bb 3>; [50.00%]
> else
> goto <bb 4>; [50.00%]
>
> <bb 3> [local count: 536870913]:
> _3 = _22 - _21;
> _4 = _3 /[ex] 4;
> iftmp.0_14 = (long unsigned int) _4;
> goto <bb 5>; [100.00%]
>
> <bb 4> [local count: 536870913]:
> _5 = _21 - _22;
> _6 = _5 /[ex] 4;
> iftmp.0_13 = (long unsigned int) _6;
>
> <bb 5> [local count: 1073741824]:
> # iftmp.0_7 = PHI <iftmp.0_14(3), iftmp.0_13(4)>
Most of that is PR 94274 .
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-06 20:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-79119-4@http.gcc.gnu.org/bugzilla/>
2023-04-27 22:31 ` [Bug tree-optimization/79119] absolute value of a pointer difference can be assumed to be less than or equal to PTRDIFF_MAX pinskia at gcc dot gnu.org
2023-05-02 0:15 ` pinskia at gcc dot gnu.org
2023-05-06 20:20 ` pinskia at gcc dot gnu.org
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).