[PATCH] D132181: [X86][AArch64][NFC] Simplify querying used argument registers

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 11:13:23 PDT 2022


nickdesaulniers added inline comments.


================
Comment at: llvm/lib/CodeGen/PrologEpilogInserter.cpp:1211
+  BitVector LiveIns(TRI.getNumRegs());
+  for (const auto &LI : MF.front().liveins())
+    LiveIns.set(LI.PhysReg);
----------------
void wrote:
> nickdesaulniers wrote:
> > RegisterMaskPair
> What?
I think the type of `LI` here is `const RegisterMaskPair &`.


================
Comment at: llvm/lib/CodeGen/PrologEpilogInserter.cpp:1230-1234
+      if (OnlyUsed) {
+        if (!LiveIns[Reg])
+          continue;
+      } else if (!TRI.isArgumentRegister(MF, Reg)) {
+        continue;
----------------
void wrote:
> nickdesaulniers wrote:
> > This could probably be 2 statements rather than 5.
> > ```
> > if ((OnlyUsed && !LiveIns[Reg]) || !TRI.isArgumentRegister(MF, Reg))
> >   continue;
> > ```
> 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.
Ack...oops!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132181/new/

https://reviews.llvm.org/D132181



More information about the llvm-commits mailing list