https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122502
--- Comment #11 from Andrew Macleod <amacleod at redhat dot com> ---
>
> That said - does ranger really need to look at immediate uses from folding
> context? This on-demand filling bites back here and makes things a lot more
> fragile as to at which point we have to have an absolutely consistent IL.
> Maybe have a ranger->stop_fill (), ranger->start_fill () flag passes could
> set around code that does IL transforms but fold()s to avoid running into
> these kind of issues?
No, it doesn't:
/* Create a new ranger instance and associate it with a function.
Each call must be paired with a call to disable_ranger to release
resources. If USE_IMM_USES is true, pre-calculate side effects like
non-null uses as required using the immediate use chains. */
extern gimple_ranger *enable_ranger (struct function *m,
bool use_imm_uses = true);
A purely on-demand ranger will run over the immediate uses mostly to determine
if there are side effects feeding into this block, the most common one being
non-null ranges.
You can disable that behaviour by simply running enable_ranger(false) instead
of the default... you lose information from any statements not seen yet using
the ssa-name... but thats about it. we still fully process the dependency
chains feeding the statement.