loop-split improvements, part 3
commitf5fb9ff2396fd41fdd2e6d35a412e936d2d42f75
authorJan Hubicka <jh@suse.cz>
Fri, 28 Jul 2023 14:18:32 +0000 (28 16:18 +0200)
committerJan Hubicka <jh@suse.cz>
Fri, 28 Jul 2023 14:19:21 +0000 (28 16:19 +0200)
treedcbebedc3915ec7bb64564cb2b94af0eedd4d86d
parent095eb138f736d94dabf9a07a6671bd351be0e66a
loop-split improvements, part 3

extend tree-ssa-loop-split to understand test of the form
 if (i==0)
and
 if (i!=0)
which triggers only during the first iteration.  Naturally we should
also be able to trigger last iteration or split into 3 cases if
the test indeed can fire in the middle of the loop.

Last iteration is bit trickier pattern matching so I want to do it
incrementally, but I implemented easy case using value range that handled
loops with constant iterations.

The testcase gets misupdated profile, I will also fix that incrementally.

gcc/ChangeLog:

PR middle-end/77689
* tree-ssa-loop-split.cc: Include value-query.h.
(split_at_bb_p): Analyze cases where EQ/NE can be turned
into LT/LE/GT/GE; return updated guard code.
(split_loop): Use guard code.

gcc/testsuite/ChangeLog:

PR middle-end/77689
* g++.dg/tree-ssa/loop-split-1.C: New test.
gcc/testsuite/g++.dg/tree-ssa/loop-split-1.C [new file with mode: 0644]
gcc/tree-ssa-loop-split.cc