[llvm] r270242 - [RegBankSelect] Use the Fast mode for functions with the optnone attribute.

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Fri May 20 10:37:01 PDT 2016


Author: qcolombet
Date: Fri May 20 12:36:54 2016
New Revision: 270242

URL: http://llvm.org/viewvc/llvm-project?rev=270242&view=rev
Log:
[RegBankSelect] Use the Fast mode for functions with the optnone attribute.

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

Modified: llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp?rev=270242&r1=270241&r2=270242&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp Fri May 20 12:36:54 2016
@@ -16,6 +16,7 @@
 #include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
 #include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/IR/Function.h"
 #include "llvm/Support/BlockFrequency.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Target/TargetSubtargetInfo.h"
@@ -452,6 +453,10 @@ void RegBankSelect::assignInstr(MachineI
 
 bool RegBankSelect::runOnMachineFunction(MachineFunction &MF) {
   DEBUG(dbgs() << "Assign register banks for: " << MF.getName() << '\n');
+  const Function *F = MF.getFunction();
+  Mode SaveOptMode = OptMode;
+  if (F->hasFnAttribute(Attribute::OptimizeNone))
+    OptMode = Mode::Fast;
   init(MF);
   // Walk the function and assign register banks to all operands.
   // Use a RPOT to make sure all registers are assigned before we choose
@@ -464,6 +469,7 @@ bool RegBankSelect::runOnMachineFunction
     for (MachineInstr &MI : *MBB)
       assignInstr(MI);
   }
+  OptMode = SaveOptMode;
   return false;
 }
 




More information about the llvm-commits mailing list