[llvm] r315757 - [LegalizerInfo] Don't evaluate end boundary every time through the loop

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 13 14:16:13 PDT 2017


Author: qcolombet
Date: Fri Oct 13 14:16:13 2017
New Revision: 315757

URL: http://llvm.org/viewvc/llvm-project?rev=315757&view=rev
Log:
[LegalizerInfo] Don't evaluate end boundary every time through the loop

Match the LLVM coding standard for loop conditions.

NFC.

Modified:
    llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp

Modified: llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp?rev=315757&r1=315756&r2=315757&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/LegalizerInfo.cpp Fri Oct 13 14:16:13 2017
@@ -58,7 +58,7 @@ LegalizerInfo::LegalizerInfo() {
 
 void LegalizerInfo::computeTables() {
   for (unsigned Opcode = 0; Opcode <= LastOp - FirstOp; ++Opcode) {
-    for (unsigned Idx = 0; Idx != Actions[Opcode].size(); ++Idx) {
+    for (unsigned Idx = 0, End = Actions[Opcode].size(); Idx != End; ++Idx) {
       for (auto &Action : Actions[Opcode][Idx]) {
         LLT Ty = Action.first;
         if (!Ty.isVector())
@@ -145,8 +145,9 @@ std::tuple<LegalizerInfo::LegalizeAction
 LegalizerInfo::getAction(const MachineInstr &MI,
                          const MachineRegisterInfo &MRI) const {
   SmallBitVector SeenTypes(8);
-  const MCOperandInfo *OpInfo = MI.getDesc().OpInfo;
-  for (unsigned i = 0; i < MI.getDesc().getNumOperands(); ++i) {
+  const MCInstrDesc &MCID = MI.getDesc();
+  const MCOperandInfo *OpInfo = MCID.OpInfo;
+  for (unsigned i = 0, e = MCID.getNumOperands(); i != e; ++i) {
     if (!OpInfo[i].isGenericType())
       continue;
 




More information about the llvm-commits mailing list