On 2026-02-18 22:46, Andrew Pinski wrote:
+ /* Skip over inval_bb. */
+ if (inval_bb != from)
+ for (auto gsi = gsi_start_bb (from); !gsi_end_p (gsi);
+ gsi_next_nondebug (&gsi))
+ {
+ gimple *stmt = gsi_stmt (gsi);
+ if (gimple_code (stmt) == GIMPLE_ASSIGN
+ && clobvar == gimple_assign_lhs (stmt))
I am not sure this is correct, this only works if clobvar does not escape.
I think you need to use the alias oracle here to query if the stmt
clobbers clobvar or not.
Ugh, sorry, I don't think I even need that; I had tried to combine the
loop in use_after_inval_p with this but that didn't work. Given that we
know that the use simply straight-lines into the exit block when this is
called, I think we could simply walk through the BBs to determine
reachability without looking for intervening clobbers/inits; the
intervening statements only show up in loops. I'll test and confirm.
Also I don't like introducing an extra walk of the IR . Especially
since this would be O(SUM(STMT,BB)) .
There must be a way to tell quickly if there is a path from BB1 to BB2
without walking the CFG.
I looked but couldn't find one :/ Let me take another look around to
see if I find something.
Thanks,
Sid