This is an archive of the discontinued LLVM Phabricator instance.

[X86][AArch64][NFC] Simplify querying used argument registers
ClosedPublic

Authored by void on Aug 18 2022, 2:55 PM.

Details

Summary

Registers used for arguments are listed as "live-ins" into the starting
basic block. This means we don't have to go through a potentially
expensive search through all possible argument registers when we only
care about used argument registers.

Diff Detail

Event Timeline

void created this revision.Aug 18 2022, 2:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2022, 2:55 PM
void requested review of this revision.Aug 18 2022, 2:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2022, 2:55 PM
nickdesaulniers accepted this revision.Aug 19 2022, 10:37 AM
nickdesaulniers added inline comments.
llvm/lib/CodeGen/PrologEpilogInserter.cpp
1211

RegisterMaskPair

1230–1234

This could probably be 2 statements rather than 5.

if ((OnlyUsed && !LiveIns[Reg]) || !TRI.isArgumentRegister(MF, Reg))
  continue;
This revision is now accepted and ready to land.Aug 19 2022, 10:37 AM
void added inline comments.Aug 19 2022, 10:50 AM
llvm/lib/CodeGen/PrologEpilogInserter.cpp
1211

What?

1230–1234

That doesn't result in the same logic. If OnlyUsed is true and !LiveIns[Reg] is false, then it will execute the TRI.isArgumentRegister call, which is what I want it to avoid in that situation.

llvm/lib/CodeGen/PrologEpilogInserter.cpp
1211

I think the type of LI here is const RegisterMaskPair &.

1230–1234

Ack...oops!

void added inline comments.Aug 19 2022, 11:38 AM
llvm/lib/CodeGen/PrologEpilogInserter.cpp
1211

Changed to MachineBasicBlock::RegisterMaskPair.