[PATCH] D18576: Initial implementation of optimization bisect

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 12 14:02:59 PDT 2016


MatzeB added a comment.

I still wonder whether we can reuse, the existing OptNone, handling. Would something like this work (pseudo patch):

  -  /// skipOptnoneFunction - This function has Attribute::OptimizeNone
  -  /// and most transformation passes should skip it.
  -  bool skipOptnoneFunction(const Function &F) const;
  +  /// Optional passes call this function to check whether the pass should be
  +  /// skipped. This is the case when Attribute::OptimizeNone is set or when
  +  /// optimization bisect is over the limit.
  +  bool skipFunction(const Function &F) const;



  -bool FunctionPass::skipOptnoneFunction(const Function &F) const {
  +bool FunctionPass::skipFunction(const Function &F) const {
  +  LLVMContext &C = F.getContext();
  +  if (C.getOptBisect().shouldSkipPass(F))
  +    return true;



   bool MyPass::runOnMachineFunction(MachineFunction &MF) {
  -  if (skipOptnoneFunction(*MF.getFunction()))
  +  if (skipFunction(*MF.getFunction()))

We could add an additional parameter if we find instances where we really want to run a pass when OptNone is set but not in an optimization bisect.


================
Comment at: include/llvm/Pass.h:118
@@ -117,1 +117,3 @@
 
+  /// isSkippable -- Queries whether the pass may be skipped if it is
+  /// present in a pass manager.  Some passes, such as the register
----------------
Don't repeat the function name in the doxygen comment (we avoid this in new code).


Repository:
  rL LLVM

http://reviews.llvm.org/D18576





More information about the llvm-commits mailing list