[PATCH] D137445: [SelectDagISEL] refactor HandlePHINodesInSuccessorBlocks NFC.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 4 11:51:46 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:10876
       ComputeValueVTs(TLI, DAG.getDataLayout(), PN.getType(), ValueVTs);
-      for (unsigned vti = 0, vte = ValueVTs.size(); vti != vte; ++vti) {
-        EVT VT = ValueVTs[vti];
-        unsigned NumRegisters = TLI.getNumRegisters(*DAG.getContext(), VT);
-        for (unsigned i = 0, e = NumRegisters; i != e; ++i)
+      for (EVT &VT : ValueVTs) {
+        const unsigned NumRegisters = TLI.getNumRegisters(*DAG.getContext(), VT);
----------------
nickdesaulniers wrote:
> arsenm wrote:
> > Can drop the &
> Aren't `EVT`s larger than the word size?  Isn't it cheaper to take by ref to avoid a copy?
It's an int and a pointer. It's going to get copied to pass by value to getNumRegisters anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137445



More information about the llvm-commits mailing list