This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/SI: Teach SIInstrInfo::FoldImmediate() to fold immediates into copies
ClosedPublic

Authored by tstellarAMD on Aug 11 2016, 5:08 AM.

Details

Summary

I put this code here, because I want to re-use it in a few other places.
This supersedes some of the immediate folding code we have in SIFoldOperands.
I think the peephole optimizers is probably a better place for folding
immediates into copies, since it does some register coalescing in the same time.

This will also make it easier to transition SIFoldOperands into a smarter pass,
where it looks at all uses of instruction at once to determine the optimal way to
fold operands. Right now, the pass just considers one operand at a time.

Diff Detail

Event Timeline

tstellarAMD retitled this revision from to AMDGPU/SI: Teach SIInstrInfo::FoldImmediate() to fold immediates into copies.
tstellarAMD updated this object.
tstellarAMD added a reviewer: arsenm.
tstellarAMD added a subscriber: llvm-commits.
arsenm added inline comments.Aug 11 2016, 11:31 AM
lib/Target/AMDGPU/SIInstrInfo.cpp
1225–1226

I don't think this supports modifiers. I don't think there's any reason to ever use the v_mov_b32 as vop3 so it can probably just be skipped

arsenm added inline comments.Sep 1 2016, 3:38 PM
lib/Target/AMDGPU/SIInstrFormats.td
296–297

This isn't necessary here since they aren't used for any SOP instructions here

Rebase and drop code for folding v_mov_b32_e64.

arsenm accepted this revision.Sep 6 2016, 9:37 AM
arsenm edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 6 2016, 9:37 AM
This revision was automatically updated to reflect the committed changes.