]> granicus.if.org Git - llvm/commitdiff
Add opt-bisect support to additional passes that can be skipped
authorAndrew Kaylor <andrew.kaylor@intel.com>
Tue, 3 May 2016 22:32:30 +0000 (22:32 +0000)
committerAndrew Kaylor <andrew.kaylor@intel.com>
Tue, 3 May 2016 22:32:30 +0000 (22:32 +0000)
Differential Revision: http://reviews.llvm.org/D19882

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268457 91177308-0d34-0410-b5e6-96231b3b80d8

16 files changed:
lib/CodeGen/EarlyIfConversion.cpp
lib/CodeGen/ExecutionDepsFix.cpp
lib/CodeGen/IfConversion.cpp
lib/CodeGen/MachineBlockPlacement.cpp
lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
lib/Transforms/Scalar/ConstantProp.cpp
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
lib/Transforms/Scalar/LoopDataPrefetch.cpp
lib/Transforms/Scalar/LoopDistribute.cpp
lib/Transforms/Scalar/LoopInterchange.cpp
lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
lib/Transforms/Scalar/Reg2Mem.cpp
lib/Transforms/Scalar/Scalarizer.cpp
lib/Transforms/Scalar/SimplifyCFGPass.cpp
lib/Transforms/Utils/SimplifyInstructions.cpp
test/Other/opt-bisect-legacy-pass-manager.ll

index f253dc8a10f0c6b258d8ed46dde13f4cce0b5a8e..4915447c502f23d30095365715f8bc53eb19e438 100644 (file)
@@ -785,6 +785,9 @@ bool EarlyIfConverter::tryConvertIf(MachineBasicBlock *MBB) {
 bool EarlyIfConverter::runOnMachineFunction(MachineFunction &MF) {
   DEBUG(dbgs() << "********** EARLY IF-CONVERSION **********\n"
                << "********** Function: " << MF.getName() << '\n');
+  if (skipFunction(*MF.getFunction()))
+    return false;
+
   // Only run if conversion if the target wants it.
   const TargetSubtargetInfo &STI = MF.getSubtarget();
   if (!STI.enableEarlyIfConversion())
index 7555f403aae0067fc76528c08eb7eda4c5538b9d..0ba9b038007dce6a0c0ebcfa771e07843dbfbe20 100644 (file)
@@ -726,6 +726,8 @@ void ExeDepsFix::visitSoftInstr(MachineInstr *mi, unsigned mask) {
 }
 
 bool ExeDepsFix::runOnMachineFunction(MachineFunction &mf) {
+  if (skipFunction(*mf.getFunction()))
+    return false;
   MF = &mf;
   TII = MF->getSubtarget().getInstrInfo();
   TRI = MF->getSubtarget().getRegisterInfo();
index 8ac5a397e65fe885102aa4d4566c50b1a0a5e4cd..319c4f5b995478f3e7f0daec0fb325aa08d5a2c5 100644 (file)
@@ -282,7 +282,8 @@ INITIALIZE_PASS_DEPENDENCY(MachineBranchProbabilityInfo)
 INITIALIZE_PASS_END(IfConverter, "if-converter", "If Converter", false, false)
 
 bool IfConverter::runOnMachineFunction(MachineFunction &MF) {
-  if (PredicateFtor && !PredicateFtor(*MF.getFunction()))
+  if (skipFunction(*MF.getFunction()) ||
+      (PredicateFtor && !PredicateFtor(*MF.getFunction())))
     return false;
 
   const TargetSubtargetInfo &ST = MF.getSubtarget();
index fb722a166a0c2fb929fb74c5ae5205d2eb251cce..d849509ce12977e59f76969524e8189fbd7d0f87 100644 (file)
@@ -1442,6 +1442,9 @@ void MachineBlockPlacement::alignBlocks(MachineFunction &F) {
 }
 
 bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &F) {
+  if (skipFunction(*F.getFunction()))
+    return false;
+
   // Check for single-block functions and skip them.
   if (std::next(F.begin()) == F.end())
     return false;
index 4b721d38adba796c77b7380ca4b57c9087412152..8332c8edb9ff0c9e8ccc3fa8f4f27b53d4cecb10 100644 (file)
@@ -411,6 +411,9 @@ bool AlignmentFromAssumptions::processAssumption(CallInst *ACall) {
 }
 
 bool AlignmentFromAssumptions::runOnFunction(Function &F) {
+  if (skipFunction(F))
+    return false;
+
   bool Changed = false;
   auto &AC = getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
   SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
index c2be8de877d06427c5acc76b312f75bc276f6cb8..88172d19fe5a9966db8d4397da58a807c58cabd6 100644 (file)
@@ -61,6 +61,9 @@ FunctionPass *llvm::createConstantPropagationPass() {
 }
 
 bool ConstantPropagation::runOnFunction(Function &F) {
+  if (skipFunction(F))
+    return false;
+
   // Initialize the worklist to all of the instructions ready to process...
   std::set<Instruction*> WorkList;
   for (Instruction &I: instructions(&F))
index e4b03efa5d20095a5fbe42cc784cb298dd6ea09a..5501800196337dc6478177c8bb90d0658cdb8e4f 100644 (file)
@@ -1383,6 +1383,9 @@ IntersectRange(ScalarEvolution &SE,
 }
 
 bool InductiveRangeCheckElimination::runOnLoop(Loop *L, LPPassManager &LPM) {
+  if (skipLoop(L))
+    return false;
+
   if (L->getBlocks().size() >= LoopSizeCutoff) {
     DEBUG(dbgs() << "irce: giving up constraining loop, too large\n";);
     return false;
index d6a8f48b5f6934bd9f50a34eb6a3279fb47d0952..b044fe842b2fed8a3e340009d1ba1a9e8fe69469 100644 (file)
@@ -147,6 +147,9 @@ bool LoopDataPrefetch::isStrideLargeEnough(const SCEVAddRecExpr *AR) {
 }
 
 bool LoopDataPrefetch::runOnFunction(Function &F) {
+  if (skipFunction(F))
+    return false;
+
   LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
   SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
   DL = &F.getParent()->getDataLayout();
index dee21676165c56810faa48be489fc3d7155de122..a1e4f225b019e038d08960ecc99a5eefa2731595 100644 (file)
@@ -871,6 +871,9 @@ public:
   }
 
   bool runOnFunction(Function &F) override {
+    if (skipFunction(F))
+      return false;
+
     auto *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
     auto *LAA = &getAnalysis<LoopAccessAnalysis>();
     auto *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
index 4295235a3f36422aa52e39dd4889d3c7deeccb19..a03bd2dc893d33623058cb037bbc87c16409300a 100644 (file)
@@ -449,6 +449,9 @@ struct LoopInterchange : public FunctionPass {
   }
 
   bool runOnFunction(Function &F) override {
+    if (skipFunction(F))
+      return false;
+
     SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
     LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
     DA = &getAnalysis<DependenceAnalysis>();
index 6c41f9145e62902e8c7f522d80c0d43e6d8b0e22..27bb230af2f06c1ffe66685ba8add32605e167de 100644 (file)
@@ -57,6 +57,9 @@ void PartiallyInlineLibCalls::getAnalysisUsage(AnalysisUsage &AU) const {
 }
 
 bool PartiallyInlineLibCalls::runOnFunction(Function &F) {
+  if (skipFunction(F))
+    return false;
+
   bool Changed = false;
   Function::iterator CurrBB;
   TargetLibraryInfo *TLI =
index 915f89780c080ab707551c940e106331e8f6008e..5ee2070d86c53b3dfb7d48d3e049e3695a064d1f 100644 (file)
@@ -68,7 +68,7 @@ INITIALIZE_PASS_END(RegToMem, "reg2mem", "Demote all values to stack slots",
                 false, false)
 
 bool RegToMem::runOnFunction(Function &F) {
-  if (F.isDeclaration())
+  if (F.isDeclaration() || skipFunction(F))
     return false;
 
   // Insert all new allocas into entry block.
index 446c78f0bffe5adf206832a599462670888d332e..3f6fd8fa1a71e9a85c0eef3e8b1d073cfc783af2 100644 (file)
@@ -252,6 +252,8 @@ bool Scalarizer::doInitialization(Module &M) {
 }
 
 bool Scalarizer::runOnFunction(Function &F) {
+  if (skipFunction(F))
+    return false;
   assert(Gathered.empty() && Scattered.empty());
   for (BasicBlock &BB : F) {
     for (BasicBlock::iterator II = BB.begin(), IE = BB.end(); II != IE;) {
index 7dd36d7360132257e90e0be4d9f0f72821484806..e69333369471431061bfa828d279363586a139e2 100644 (file)
@@ -209,10 +209,7 @@ struct CFGSimplifyPass : public FunctionPass {
     initializeCFGSimplifyPassPass(*PassRegistry::getPassRegistry());
   }
   bool runOnFunction(Function &F) override {
-    if (PredicateFtor && !PredicateFtor(F))
-      return false;
-
-    if (skipFunction(F))
+    if (skipFunction(F) || (PredicateFtor && !PredicateFtor(F)))
       return false;
 
     AssumptionCache *AC =
index d5377f9a4c1ff9b82244bcd8d0c94d55ae1a163e..edba5d2656ed7bdb28bf8110ba948ce6b7c9db7e 100644 (file)
@@ -48,6 +48,9 @@ namespace {
 
     /// runOnFunction - Remove instructions that simplify.
     bool runOnFunction(Function &F) override {
+      if (skipFunction(F))
+        return false;
+
       const DominatorTreeWrapperPass *DTWP =
           getAnalysisIfAvailable<DominatorTreeWrapperPass>();
       const DominatorTree *DT = DTWP ? &DTWP->getDomTree() : nullptr;
index 8c39187fcf099d74983a52b28cf6c7002927535b..0e528ea4b32468898be8abd7912bdb6dd2bf2452 100644 (file)
 ; CHECK-SKIP-ALL-NOT: BISECT: running pass ({{[0-9]+}})
 
 
+; Verify that no passes run at -O0 are skipped
+; RUN: opt -opt-bisect-limit=0 < %s 2>&1 | FileCheck %s --check-prefix=OPTBISECT-O0
+; RUN: opt -opt-bisect-limit=0 < %s | llc -O0 -opt-bisect-limit=0 2>&1 | FileCheck %s --check-prefix=OPTBISECT-O0
+; OPTBISECT-O0-NOT: BISECT: NOT running
+
+; FIXME: There are still some AMDGPU passes being skipped that run at -O0.
+; XFAIL: r600, amdgcn
+
 ; Verify that we can use the opt-bisect-helper.py script (derived from
 ; utils/bisect) to locate the optimization that inlines the call to
 ; f2() in f3().