[PATCH] D19172: New optimization bisect implementation (now modeled on optnone handling)

Andy Kaylor via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 15 12:36:05 PDT 2016


andrew.w.kaylor created this revision.
andrew.w.kaylor added reviewers: MatzeB, joker.eph.
andrew.w.kaylor added a subscriber: llvm-commits.
andrew.w.kaylor set the repository for this revision to rL LLVM.
Herald added a reviewer: tstellarAMD.
Herald added subscribers: jfb, mzolotukhin, dsanders, arsenm, MatzeB, jholewinski.

This is a new patch for the optimization bisect feature, which will allow optimizations to be selectively disabled at compile time in order to track down test failures that are caused by incorrect optimizations.

My previous patch (D18576) proposed adding new methods to the Pass base class (and various templates for the new pass manager) to allow the OptBisect object to query whether or not a pass is skippable with  the bisection being initiated from within the various pass managers.  During the review, an alternate approach was suggested, to be based on the function optnone handling, whereby each skippable pass would opt in to the bisection process at the start of its run routine.  This patch implements that alternate approach.

For function, loop and basic block passes, I am replacing the existing calls to "skipOptnoneFunction()" with a call to a new function that checks the opt bisect limit as well as the optnone attribute.  For the most part I treated the presence or absence of an existing call to skipOptnoneFunction() as an indication of whether or not the pass could be skipped.  There were three passes that were not calling skipOptnoneFunction() that seemed to me as if they should, so I added the call.  Those passes were:

MergedLoadStoreMotion
LoopVectorize
LoopLoadElimination

There was no equivalent mechanism for module passes and SCC passes.  For these passes, I attempted to discern whether or not the pass was skippable and added calls to the appropriate function to check the bisect limit.  The passes I chose to treat as skippable can be seen in the code changes in this review.  Those that I determined were not skippable do not show up here, so it seems worth noting the module and SCC passes I considered to be non-skippable.  Here's the list:

AMDGPUAnnotateKernelFeatures
AMDGPUOpenCLImageTypeLoweringPass
DOTGraphTraitsModuleViewer
DOTGraphTraitsModulePrinter
CallGraphWrapperPass
CGPassManager
GlobalsAAWrapperPass
ModuleDebugInfoPrinter
ModuleSummaryIndexWrapperPass
WriteBitcodePass
PrintModulePassWrapper
FPPassManager
MPPassManager
CppWriter
AddressSanitizerModule
DataFlowSanitizer
GCOVProfiler
InstrProfiling
SanitizerCoverageModule
NVPTXAssignValidGlobalNames
RewriteStatepointsForGC
MetaRenamer
RewriteSymbols
SampleProfileLoader
ForceFunctionAttrsLegacyPass
PrintCallGraphPass
CallGraphSCCPassPrinter

There was also no optnone equivalent for region passes.  However, since the only region passes in the LLVM code base (StructuralizeCFG, PrinRegionPass and RegionPassPrinter) would have been non-skippable, it seemed best to omit any handling for region passes at this time.  If anyone has region passes which should be included in the bisection, it will be a simple matter to add such support.

Repository:
  rL LLVM

http://reviews.llvm.org/D19172

Files:
  include/llvm/Analysis/CallGraphSCCPass.h
  include/llvm/Analysis/LazyCallGraph.h
  include/llvm/Analysis/LoopPass.h
  include/llvm/IR/LLVMContext.h
  include/llvm/IR/OptBisect.h
  include/llvm/Pass.h
  lib/Analysis/CallGraphSCCPass.cpp
  lib/Analysis/LoopPass.cpp
  lib/CodeGen/BranchFolding.cpp
  lib/CodeGen/CodeGenPrepare.cpp
  lib/CodeGen/DeadMachineInstructionElim.cpp
  lib/CodeGen/LowerEmuTLS.cpp
  lib/CodeGen/MachineBlockPlacement.cpp
  lib/CodeGen/MachineCSE.cpp
  lib/CodeGen/MachineCopyPropagation.cpp
  lib/CodeGen/MachineLICM.cpp
  lib/CodeGen/MachineScheduler.cpp
  lib/CodeGen/MachineSink.cpp
  lib/CodeGen/OptimizePHIs.cpp
  lib/CodeGen/PeepholeOptimizer.cpp
  lib/CodeGen/PostRASchedulerList.cpp
  lib/CodeGen/StackColoring.cpp
  lib/CodeGen/TailDuplication.cpp
  lib/IR/CMakeLists.txt
  lib/IR/LLVMContext.cpp
  lib/IR/LLVMContextImpl.cpp
  lib/IR/LLVMContextImpl.h
  lib/IR/OptBisect.cpp
  lib/IR/Pass.cpp
  lib/Passes/PassBuilder.cpp
  lib/Target/AArch64/AArch64PromoteConstant.cpp
  lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
  lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
  lib/Target/Mips/Mips16HardFloat.cpp
  lib/Target/Mips/MipsOs16.cpp
  lib/Target/NVPTX/NVPTXGenericToNVVM.cpp
  lib/Target/XCore/XCoreLowerThreadLocal.cpp
  lib/Transforms/IPO/ArgumentPromotion.cpp
  lib/Transforms/IPO/ConstantMerge.cpp
  lib/Transforms/IPO/CrossDSOCFI.cpp
  lib/Transforms/IPO/DeadArgumentElimination.cpp
  lib/Transforms/IPO/ElimAvailExtern.cpp
  lib/Transforms/IPO/ExtractGV.cpp
  lib/Transforms/IPO/FunctionAttrs.cpp
  lib/Transforms/IPO/FunctionImport.cpp
  lib/Transforms/IPO/GlobalDCE.cpp
  lib/Transforms/IPO/GlobalOpt.cpp
  lib/Transforms/IPO/IPConstantPropagation.cpp
  lib/Transforms/IPO/InferFunctionAttrs.cpp
  lib/Transforms/IPO/Inliner.cpp
  lib/Transforms/IPO/Internalize.cpp
  lib/Transforms/IPO/LoopExtractor.cpp
  lib/Transforms/IPO/LowerBitSets.cpp
  lib/Transforms/IPO/MergeFunctions.cpp
  lib/Transforms/IPO/PartialInlining.cpp
  lib/Transforms/IPO/PruneEH.cpp
  lib/Transforms/IPO/StripDeadPrototypes.cpp
  lib/Transforms/IPO/StripSymbols.cpp
  lib/Transforms/IPO/WholeProgramDevirt.cpp
  lib/Transforms/InstCombine/InstructionCombining.cpp
  lib/Transforms/Instrumentation/PGOInstrumentation.cpp
  lib/Transforms/ObjCARC/ObjCARCAPElim.cpp
  lib/Transforms/Scalar/ADCE.cpp
  lib/Transforms/Scalar/BDCE.cpp
  lib/Transforms/Scalar/ConstantHoisting.cpp
  lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
  lib/Transforms/Scalar/DCE.cpp
  lib/Transforms/Scalar/DeadStoreElimination.cpp
  lib/Transforms/Scalar/EarlyCSE.cpp
  lib/Transforms/Scalar/Float2Int.cpp
  lib/Transforms/Scalar/GVN.cpp
  lib/Transforms/Scalar/IndVarSimplify.cpp
  lib/Transforms/Scalar/JumpThreading.cpp
  lib/Transforms/Scalar/LICM.cpp
  lib/Transforms/Scalar/LoadCombine.cpp
  lib/Transforms/Scalar/LoopDeletion.cpp
  lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  lib/Transforms/Scalar/LoopInstSimplify.cpp
  lib/Transforms/Scalar/LoopLoadElimination.cpp
  lib/Transforms/Scalar/LoopRerollPass.cpp
  lib/Transforms/Scalar/LoopRotation.cpp
  lib/Transforms/Scalar/LoopSimplifyCFG.cpp
  lib/Transforms/Scalar/LoopStrengthReduce.cpp
  lib/Transforms/Scalar/LoopUnrollPass.cpp
  lib/Transforms/Scalar/LoopUnswitch.cpp
  lib/Transforms/Scalar/LoopVersioningLICM.cpp
  lib/Transforms/Scalar/LowerAtomic.cpp
  lib/Transforms/Scalar/MemCpyOptimizer.cpp
  lib/Transforms/Scalar/MergedLoadStoreMotion.cpp
  lib/Transforms/Scalar/NaryReassociate.cpp
  lib/Transforms/Scalar/Reassociate.cpp
  lib/Transforms/Scalar/SCCP.cpp
  lib/Transforms/Scalar/SROA.cpp
  lib/Transforms/Scalar/ScalarReplAggregates.cpp
  lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
  lib/Transforms/Scalar/SimplifyCFGPass.cpp
  lib/Transforms/Scalar/SpeculativeExecution.cpp
  lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
  lib/Transforms/Scalar/TailRecursionElimination.cpp
  lib/Transforms/Utils/Mem2Reg.cpp
  lib/Transforms/Vectorize/BBVectorize.cpp
  lib/Transforms/Vectorize/LoopVectorize.cpp
  lib/Transforms/Vectorize/SLPVectorizer.cpp
  test/Other/opt-bisect-helper.py
  test/Other/opt-bisect-legacy-pass-manager.ll
  test/Other/opt-bisect-new-pass-manager.ll
  test\Other\opt-bisect-helper.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19172.53929.patch
Type: text/x-patch
Size: 85757 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160415/cfa0185f/attachment-0001.bin>


More information about the llvm-commits mailing list