forked from OSchip/llvm-project
[X86] Move -x86-use-vzeroupper command line flag into runOnMachineFunction for the pass itself rather than the pass pipeline construction
This pass has no dependencies on other passes so conditionally including it in the pipeline doens't do much. Just move it the pass itself to keep it isolated.
This commit is contained in:
parent
e987ee6318
commit
6b4b660174
|
@ -313,14 +313,6 @@ X86TargetMachine::getSubtargetImpl(const Function &F) const {
|
|||
return I.get();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Command line options for x86
|
||||
//===----------------------------------------------------------------------===//
|
||||
static cl::opt<bool>
|
||||
UseVZeroUpper("x86-use-vzeroupper", cl::Hidden,
|
||||
cl::desc("Minimize AVX to SSE transition penalty"),
|
||||
cl::init(true));
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// X86 TTI query.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -513,7 +505,6 @@ void X86PassConfig::addPreEmitPass() {
|
|||
|
||||
addPass(createX86IndirectBranchTrackingPass());
|
||||
|
||||
if (UseVZeroUpper)
|
||||
addPass(createX86IssueVZeroUpperPass());
|
||||
|
||||
if (getOptLevel() != CodeGenOpt::None) {
|
||||
|
|
|
@ -39,6 +39,11 @@ using namespace llvm;
|
|||
|
||||
#define DEBUG_TYPE "x86-vzeroupper"
|
||||
|
||||
static cl::opt<bool>
|
||||
UseVZeroUpper("x86-use-vzeroupper", cl::Hidden,
|
||||
cl::desc("Minimize AVX to SSE transition penalty"),
|
||||
cl::init(true));
|
||||
|
||||
STATISTIC(NumVZU, "Number of vzeroupper instructions inserted");
|
||||
|
||||
namespace {
|
||||
|
@ -278,6 +283,9 @@ void VZeroUpperInserter::processBasicBlock(MachineBasicBlock &MBB) {
|
|||
/// Loop over all of the basic blocks, inserting vzeroupper instructions before
|
||||
/// function calls.
|
||||
bool VZeroUpperInserter::runOnMachineFunction(MachineFunction &MF) {
|
||||
if (!UseVZeroUpper)
|
||||
return false;
|
||||
|
||||
const X86Subtarget &ST = MF.getSubtarget<X86Subtarget>();
|
||||
if (!ST.hasAVX() || !ST.insertVZEROUPPER())
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue