From 289bd5f6843ba3e7a7a1831ce59d25aedae75aae Mon Sep 17 00:00:00 2001 From: Andrew Kaylor Date: Wed, 27 Apr 2016 19:39:32 +0000 Subject: [PATCH] Add optimization bisect opt-in calls for PowerPC passes Differential Revision: http://reviews.llvm.org/D19554 llvm-svn: 267769 --- llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp | 3 +++ llvm/lib/Target/PowerPC/PPCCTRLoops.cpp | 3 +++ llvm/lib/Target/PowerPC/PPCEarlyReturn.cpp | 3 +++ llvm/lib/Target/PowerPC/PPCLoopPreIncPrep.cpp | 3 +++ llvm/lib/Target/PowerPC/PPCMIPeephole.cpp | 2 ++ llvm/lib/Target/PowerPC/PPCQPXLoadSplat.cpp | 3 +++ llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 8 +++++--- llvm/lib/Target/PowerPC/PPCVSXFMAMutate.cpp | 3 +++ llvm/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp | 3 +++ 9 files changed, 28 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp b/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp index 9ca389f..bfb4d87 100644 --- a/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp +++ b/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp @@ -168,6 +168,9 @@ class PPCBoolRetToInt : public FunctionPass { } bool runOnFunction(Function &F) { + if (skipFunction(F)) + return false; + PHINodeSet PromotablePHINodes = getPromotablePHINodes(F); B2IMap Bool2IntMap; bool Changed = false; diff --git a/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp b/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp index 6e1d57a..8752266 100644 --- a/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp +++ b/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp @@ -166,6 +166,9 @@ FunctionPass *llvm::createPPCCTRLoopsVerify() { #endif // NDEBUG bool PPCCTRLoops::runOnFunction(Function &F) { + if (skipFunction(F)) + return false; + LI = &getAnalysis().getLoopInfo(); SE = &getAnalysis().getSE(); DT = &getAnalysis().getDomTree(); diff --git a/llvm/lib/Target/PowerPC/PPCEarlyReturn.cpp b/llvm/lib/Target/PowerPC/PPCEarlyReturn.cpp index 28798c3..fcd2f50 100644 --- a/llvm/lib/Target/PowerPC/PPCEarlyReturn.cpp +++ b/llvm/lib/Target/PowerPC/PPCEarlyReturn.cpp @@ -173,6 +173,9 @@ protected: public: bool runOnMachineFunction(MachineFunction &MF) override { + if (skipFunction(*MF.getFunction())) + return false; + TII = MF.getSubtarget().getInstrInfo(); bool Changed = false; diff --git a/llvm/lib/Target/PowerPC/PPCLoopPreIncPrep.cpp b/llvm/lib/Target/PowerPC/PPCLoopPreIncPrep.cpp index 5e18826..48a71cf 100644 --- a/llvm/lib/Target/PowerPC/PPCLoopPreIncPrep.cpp +++ b/llvm/lib/Target/PowerPC/PPCLoopPreIncPrep.cpp @@ -144,6 +144,9 @@ static Value *GetPointerOperand(Value *MemI) { } bool PPCLoopPreIncPrep::runOnFunction(Function &F) { + if (skipFunction(F)) + return false; + LI = &getAnalysis().getLoopInfo(); SE = &getAnalysis().getSE(); auto *DTWP = getAnalysisIfAvailable(); diff --git a/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp b/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp index fe339d7..a57a83d 100644 --- a/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp +++ b/llvm/lib/Target/PowerPC/PPCMIPeephole.cpp @@ -63,6 +63,8 @@ private: public: // Main entry point for this pass. bool runOnMachineFunction(MachineFunction &MF) override { + if (skipFunction(*MF.getFunction())) + return false; initialize(MF); return simplifyCode(); } diff --git a/llvm/lib/Target/PowerPC/PPCQPXLoadSplat.cpp b/llvm/lib/Target/PowerPC/PPCQPXLoadSplat.cpp index e15751e..642b90e 100644 --- a/llvm/lib/Target/PowerPC/PPCQPXLoadSplat.cpp +++ b/llvm/lib/Target/PowerPC/PPCQPXLoadSplat.cpp @@ -60,6 +60,9 @@ FunctionPass *llvm::createPPCQPXLoadSplatPass() { } bool PPCQPXLoadSplat::runOnMachineFunction(MachineFunction &MF) { + if (skipFunction(*MF.getFunction())) + return false; + bool MadeChange = false; const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo(); diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp index 3814b7e..b218274 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -382,9 +382,11 @@ void PPCPassConfig::addMachineSSAOptimization() { } void PPCPassConfig::addPreRegAlloc() { - initializePPCVSXFMAMutatePass(*PassRegistry::getPassRegistry()); - insertPass(VSXFMAMutateEarly ? &RegisterCoalescerID : &MachineSchedulerID, - &PPCVSXFMAMutateID); + if (getOptLevel() != CodeGenOpt::None) { + initializePPCVSXFMAMutatePass(*PassRegistry::getPassRegistry()); + insertPass(VSXFMAMutateEarly ? &RegisterCoalescerID : &MachineSchedulerID, + &PPCVSXFMAMutateID); + } if (getPPCTargetMachine().getRelocationModel() == Reloc::PIC_) addPass(createPPCTLSDynamicCallPass()); if (EnableExtraTOCRegDeps) diff --git a/llvm/lib/Target/PowerPC/PPCVSXFMAMutate.cpp b/llvm/lib/Target/PowerPC/PPCVSXFMAMutate.cpp index e3580ca..7c22cb2 100644 --- a/llvm/lib/Target/PowerPC/PPCVSXFMAMutate.cpp +++ b/llvm/lib/Target/PowerPC/PPCVSXFMAMutate.cpp @@ -342,6 +342,9 @@ protected: public: bool runOnMachineFunction(MachineFunction &MF) override { + if (skipFunction(*MF.getFunction())) + return false; + // If we don't have VSX then go ahead and return without doing // anything. const PPCSubtarget &STI = MF.getSubtarget(); diff --git a/llvm/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp b/llvm/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp index 27c540f..10636b8 100644 --- a/llvm/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp +++ b/llvm/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp @@ -191,6 +191,9 @@ private: public: // Main entry point for this pass. bool runOnMachineFunction(MachineFunction &MF) override { + if (skipFunction(*MF.getFunction())) + return false; + // If we don't have VSX on the subtarget, don't do anything. const PPCSubtarget &STI = MF.getSubtarget(); if (!STI.hasVSX()) -- 2.7.4