From a55301287494d75309f62a15c3d1b221b5e447a0 Mon Sep 17 00:00:00 2001 From: Quentin Colombet Date: Fri, 20 May 2016 17:36:54 +0000 Subject: [RegBankSelect] Use the Fast mode for functions with the optnone attribute. llvm-svn: 270242 --- llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp') diff --git a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp index 9586223ac13..4a052ca84cb 100644 --- a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp +++ b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp @@ -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(MachineInstr &MI) { 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(MachineFunction &MF) { for (MachineInstr &MI : *MBB) assignInstr(MI); } + OptMode = SaveOptMode; return false; } -- cgit v1.2.3