[llvm] r296057 - [GlobalISel] Remove now-unnecessary variable. NFC.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 16:34:41 PST 2017


Author: ab
Date: Thu Feb 23 18:34:41 2017
New Revision: 296057

URL: http://llvm.org/viewvc/llvm-project?rev=296057&view=rev
Log:
[GlobalISel] Remove now-unnecessary variable. NFC.

Since r296047, we're able to return early on failures.
Don't track whether we succeeded.

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

Modified: llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp?rev=296057&r1=296056&r2=296057&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp Thu Feb 23 18:34:41 2017
@@ -1048,8 +1048,7 @@ bool IRTranslator::runOnMachineFunction(
   SmallVector<unsigned, 8> VRegArgs;
   for (const Argument &Arg: F.args())
     VRegArgs.push_back(getOrCreateVReg(Arg));
-  bool Succeeded = CLI->lowerFormalArguments(EntryBuilder, F, VRegArgs);
-  if (!Succeeded) {
+  if (!CLI->lowerFormalArguments(EntryBuilder, F, VRegArgs)) {
     OptimizationRemarkMissed R("gisel-irtranslator", "GISelFailure", DebugLoc(),
                                &MF->getFunction()->getEntryBlock());
     R << "unable to lower arguments: " << ore::NV("Prototype", F.getType());
@@ -1065,19 +1064,19 @@ bool IRTranslator::runOnMachineFunction(
     CurBuilder.setMBB(MBB);
 
     for (const Instruction &Inst: BB) {
-      Succeeded &= translate(Inst);
-      if (!Succeeded) {
-        std::string InstStrStorage;
-        raw_string_ostream InstStr(InstStrStorage);
-        InstStr << Inst;
+      if (translate(Inst))
+        continue;
 
-        OptimizationRemarkMissed R("gisel-irtranslator", "IRTranslatorFailure: ",
-                                   &Inst);
-        R << "unable to translate instruction: " << ore::NV("Opcode", &Inst)
-          << ": '" << InstStr.str() << "'";
-        reportTranslationError(*MF, *TPC, *ORE, R);
-        return false;
-      }
+      std::string InstStrStorage;
+      raw_string_ostream InstStr(InstStrStorage);
+      InstStr << Inst;
+
+      OptimizationRemarkMissed R("gisel-irtranslator", "IRTranslatorFailure: ",
+                                 &Inst);
+      R << "unable to translate instruction: " << ore::NV("Opcode", &Inst)
+        << ": '" << InstStr.str() << "'";
+      reportTranslationError(*MF, *TPC, *ORE, R);
+      return false;
     }
   }
 




More information about the llvm-commits mailing list