>On 11/6/2021 4:20 PM, Roger Sayle wrote: >> Simplify paradoxical subreg extensions of TRUNCATE >> https://gcc.gnu.org/pipermail/gcc-patches/2021-September/578848.html > So the discussion seemed to end with a recommendation to try and address this > earlier in the call chain rather than in simplify_rtx.
I take full responsibility that my poor choice of wording in describing this patch may be confusing to those not familiar with this style of describing middle-end transformations in GCC. Take the opening sentence "This patch simplifies the RTX (subreg:HI (truncate:QI (reg:SI))) as (truncate:HI (reg:SI))", taken literally someone may look-up the RTL documentation and observe that SUBREG may never be applied to truncate hence the above is invalid, and therefore this transformation could never fire. The wording is perhaps unfortunate; the abstract RTL above is never actually created/allocated, instead we're describing the transformation/context, i.e. the behaviour of the call to gen_lowpart when passed a TRUCATE rtx as an operand. Hence, this patch is already "earlier in the call chain" and where it should be. This is no different to how GCC's match describes tree expressions to be folded, but that never physically exist in GIMPLE, where the single-static assignment form guarantees no operator may have another as an operand. If someone could review the code change itself, and not misinterpret the patch description that would be much appreciated. Thanks in advance, Roger --