https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122436
Bug ID: 122436
Summary: gimple match should not call functions which walk the
ssa without valueizer
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code, internal-improvement
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Splitting this out from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280#c11
as we should track this seperately as the bug could hit in theory right now:
```
Well, the issue is that tree_expr_nonnegative_p does not honor
no_follow_ssa_edges in
...
this is done because we operate on a partially valid SSA form only.
Esp. the PHI handling in gimple_stmt_nonnegative_warnv_p is problematic
here.
So I'd say match.pd should never use any of the SSA following predicates (...).
...
In the overall GCC design plan I've always wanted some kind of folding
context - there we could eventually check for an active no_follow_ssa_edges
or other valueization hook. But apart from some ad-hoc partial conversion
by adding some global "fold_context" pointer (and possibly ways to stack
them, like we can with the gimplify context), this is a lot of work.
Now, another idea might be to add
(define_predicate_with_valueization
tree_expr_nonnegative_p)
```
In the next couple of weeks I will audit the predicates that are used in match
to record which ones are problemantic.
So far tree_expr_nonnegative_p is known to be one.