[Bug tree-optimization/102794] [12 Regression] missing vrp in evrp dealing with casts and ands

2021-10-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102794

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #4 from Andrew Pinski  ---
Fixed most likely by r12-4526.

[Bug tree-optimization/102794] [12 Regression] missing vrp in evrp dealing with casts and ands

2021-10-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102794

--- Comment #3 from Andrew Pinski  ---
(In reply to Aldy Hernandez from comment #2)
> I haven't looked at this, but there's a pending patch with more
> restrictions for loop threading in the presence of loops.  Does this help?
> 
> https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581637.html
> 
> We really shouldn't be destroying loop info.

Yes I think it does, though I have not tried it.
There was a jump threading here:
   :
  if (d_10 != 0)
goto ; [INV]
  else
goto ; [INV]

   :
  foo ();

   :
  a_12 = a_3 + 1;

   : ;;; loop header
  # a_3 = PHI <-100(2), a_12(6)>
  if (a_3 != 0)
goto ; [INV]
  else
goto ; [INV]

where d_10 is defined as:
  d_10 = (short unsigned int) a_3;


So yes blocking jumping through the loop header would help.
It is very similar to your f3 in ssa-thread-invalid.c testcase.

[Bug tree-optimization/102794] [12 Regression] missing vrp in evrp dealing with casts and ands

2021-10-16 Thread aldyh at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102794

--- Comment #2 from Aldy Hernandez  ---
I haven't looked at this, but there's a pending patch with more
restrictions for loop threading in the presence of loops.  Does this help?

https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581637.html

We really shouldn't be destroying loop info.


On Sat, Oct 16, 2021, 07:01 pinskia at gcc dot gnu.org <
gcc-bugzi...@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102794
>
> Andrew Pinski  changed:
>
>What|Removed |Added
>
> 
>  CC||aldyh at gcc dot gnu.org
>
> --- Comment #1 from Andrew Pinski  ---
> Jump threading really messes up the loop here ...
> about to thread: path: 4 -> 6, 6 -> 7, 7 -> 3,
> just threaded: path: 4 -> 9, 6 -> 7, 7 -> 3,
>
> I don't know what else to say.  Maybe move ethread after evpr?
>
> Note with -fno-thread-jumps, evpr is able to figure out the induction
> variable
> goes from [-100, -1] .  It does look like jump threading is full on
> messing up
> how induction variable detection works; we get two a = a +1; statement
> after
> the jump threading improvements.
> Maybe there is another bug about that case already.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
>

[Bug tree-optimization/102794] [12 Regression] missing vrp in evrp dealing with casts and ands

2021-10-15 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102794

Andrew Pinski  changed:

   What|Removed |Added

 CC||aldyh at gcc dot gnu.org

--- Comment #1 from Andrew Pinski  ---
Jump threading really messes up the loop here ...
about to thread: path: 4 -> 6, 6 -> 7, 7 -> 3, 
just threaded: path: 4 -> 9, 6 -> 7, 7 -> 3, 

I don't know what else to say.  Maybe move ethread after evpr?

Note with -fno-thread-jumps, evpr is able to figure out the induction variable
goes from [-100, -1] .  It does look like jump threading is full on messing up
how induction variable detection works; we get two a = a +1; statement after
the jump threading improvements.
Maybe there is another bug about that case already.

[Bug tree-optimization/102794] [12 Regression] missing vrp in evrp dealing with casts and ands

2021-10-15 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102794

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |12.0