This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Forward source register of add-immediate to D-Form instructions
Needs ReviewPublic

Authored by nemanjai on May 2 2018, 8:32 PM.

Details

Summary

Most D-Form instructions add their immediate operand (displacement) to their register input (base register). If the register input is produced by an add-immediate, we can just forward the operand of the add-immediate and update the displacement (as long as alignment is respected).

This comes up for a number of reasons (converting reg+reg instructions to reg+imm, the node that becomes the add-immediate being in a different block, etc.).

Diff Detail

Repository
rL LLVM

Event Timeline

nemanjai created this revision.May 2 2018, 8:32 PM

If I understand correctly, we may also need to handle the DFLOADf32/DFLOADf64 and store pair here, as this is done pre-RA.

@qshanz I suspect this patch is obsolete now with your recent work on improving the r+r -> r+i transformations. If it is, I'll abandon it. If this still does something useful, we should update it and re-post.

@steven.zhang Seems I was mistaken about your nick on Phabricator. The above comment is meant for you Steven.

This is for pre-RA and my fix is for Post RA. Maybe, we can extend my fix to cover the pre-RA case. I will re-submit a new fix to cover this test case. I think, we could abandon this fix.