https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94311

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
For PHIs we could use the cache but I see we're simply dropping the BLOCKs
there (now that block location is encoded in the location we _do_ have
a location BLOCK there as well).

At least

      /* Do not cache a location - we do not have API to get pointer to the
         location in PHI statement and we may trigger reallocation.  */

the comment is wrong in both regards.  The API is gimple_phi_arg
which yields a phi_arg_d * which has the location member.  And re-allocation
shouldn't happen because

  len = EDGE_COUNT (bb->preds);
  result = create_phi_node (phi_result, bb);

so preds are set up and create_phi_node ensures there's enough capacity.

So it boils down to the same issue that BLOCKs are not handled by the
location cache.

I don't remember exactly but in principle we do not need any BLOCKs
on stmts in LTRANS (inline diagnostics uses it though).

Amending the location cache with a BLOCK pointer should be possible
but I wonder how to sort them?  I guess same location usually means
same BLOCK.  Otherwise sort after BLOCK_NUMBER?

That is, the idea would then be to apply the location cache only
at the end of input_function.

Reply via email to