Re: [PATCH] backwards threader: handle SSA names occurring in abnormal PHIs

Aldy Hernandez <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
On Thu, Aug 13, 2026 at 08:40:38AM +0200, Richard Biener wrote:

> Hmm, there's no reason to not perform analysis on SSA names marked
> as abnormal.  You'd not get any useful control expression for the
> edges, but the copy part holds.  What you have to be careful with
> is not disrupting coalescing during transforms because where
> SSA names on abnormal edges (thus in PHI args) are special is that
> you cannot insert a copy there, so we have to allocate the incoming
> value and the PHI result to the same register.
> 
> So I wonder why gimple_range_ssa_p cares about abnormals at all.
> 
> What can be problematic is duplicating a PHI where the copy
> inherits an abnormal incoming edge - extra copies of abnormally
> marked SSA names are to be avoided.
> 
> So I wonder if you can split this up and remove the abnormal
> restriction from range analysis (and see what breaks - I'm curious).

Surprisingly (for me anyhow), nothing.  Also, the consumers of this
info (substitute_and_fold and tree-vrp.cc) seem to already have guards
for abnormal PHIs.

Could these restrictions be an inherited
restriction from when we had ASSERT_EXPR copies to represent ranges?

Your suggestion reduces my two patches to one line a piece :).

I'll post as a follow-up.

Thanks.
Aldy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.