Hi Jeff,

On 9/19/23 07:59, Jeff Law wrote:


On 9/18/23 21:37, Vineet Gupta wrote:
On 9/18/23 19:41, Jeff Law wrote:
On 9/18/23 13:45, Vineet Gupta wrote:


For the cases which do require sign extends, but not being eliminated due to "missing definition(s)" I'm working on adapting Ajit's REE ABI interfaces work [2] to work for RISC-V as well.
I wonder if we could walk the DECL_ARGUMENTS for current_function_decl and create sign extensions for integer arguments smaller than XLEN at the start of the function. Record them in a list.

Then we just let the rest of REE do its thing.  When REE is done we go back and delete those sign extensions we created.

[..]

Right.  What I'm suggesting is to create an explicit extension in the IL at the very beginning of REE for the appropriate arguments.  Put the extension in the entry block.

That would make extensions that were previously in the RTL redundant allowing REE to remove them.

Then we also remove the explicitly added extensions.

Think of the extensions we're adding as expressing the the extension that the caller would have done and would expose the redundant extensions in the callee.  We put them in the IL merely to make the existing REE algorithm happy.  Once they've served their purpose in exposing redundant extensions we remove the ones we added.

If you're familiar with DSE there's a lot of similarities with how we discover dead stores into the stack.  We pretend there's a store to each local frame slot in the epilogue, that in turn exposes stores into the local frame that would never be read because we're exiting the function.

We touched upon this in our airport "rendezvous". I'm curious if you have the wip bits lying around - (a) to get a feel for how this could be done and (b) to see why REE and/or similar construct in CSE don't work as expected.

Thx,
-Vineet

Reply via email to