llvm/tools/bugpoint
Sanjay Patel 4bac65ed04 [SimplifyCFG] add a struct to house optional folds (PR34603)
This was intended to be no-functional-change, but it's not - there's a test diff.

So I thought I should stop here and post it as-is to see if this looks like what was expected 
based on the discussion in PR34603:
https://bugs.llvm.org/show_bug.cgi?id=34603

Notes:
 1. The test improvement occurs because the existing 'LateSimplifyCFG' marker is not carried 
    through the recursive calls to 'SimplifyCFG()->SimplifyCFGOpt().run()->SimplifyCFG()'. 
    The parameter isn't passed down, so we pick up the default value from the function signature 
    after the first level. I assumed that was a bug, so I've passed 'Options' down in all of the 
    'SimplifyCFG' calls.

 2. I split 'LateSimplifyCFG' into 2 bits: ConvertSwitchToLookupTable and KeepCanonicalLoops. 
    This would theoretically allow us to differentiate the transforms controlled by those params 
    independently.

 3. We could stash the optional AssumptionCache pointer and 'LoopHeaders' pointer in the struct too. 
    I just stopped here to minimize the diffs.

 4. Similarly, I stopped short of messing with the pass manager layer. I have another question that 
    could wait for the follow-up: why is the new pass manager creating the pass with LateSimplifyCFG 
    set to true no matter where in the pipeline it's creating SimplifyCFG passes?

    // Create an early function pass manager to cleanup the output of the
    // frontend.
    EarlyFPM.addPass(SimplifyCFGPass());

    -->

    /// \brief Construct a pass with the default thresholds
    /// and switch optimizations.
    SimplifyCFGPass::SimplifyCFGPass()
       : BonusInstThreshold(UserBonusInstThreshold),
         LateSimplifyCFG(true) {}   <-- switches get converted to lookup tables and loops may not be in canonical form

    If this is unintended, then it's possible that the current behavior of dropping the 'LateSimplifyCFG' 
    setting via recursion was masking this bug.

Differential Revision: https://reviews.llvm.org/D38138


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314308 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27 14:54:16 +00:00
..
BugDriver.cpp bugpoint: Return Errors instead of passing around strings 2016-09-06 17:18:22 +00:00
BugDriver.h bugpoint: Return Errors instead of passing around strings 2016-09-06 17:18:22 +00:00
bugpoint.cpp Fix check-llvm on kernel 4.9+ with asan or msan 2017-09-01 01:47:34 +00:00
CMakeLists.txt Ensure backends available in 'opt' are also available in 'bugpoint' 2017-06-24 08:09:33 +00:00
CrashDebugger.cpp [SimplifyCFG] add a struct to house optional folds (PR34603) 2017-09-27 14:54:16 +00:00
ExecutionDriver.cpp Turn cl::values() (for enum) from a vararg function to using C++ variadic template 2016-10-08 19:41:06 +00:00
ExtractFunction.cpp [Support] Rename tool_output_file to ToolOutputFile, NFC 2017-09-23 01:03:17 +00:00
FindBugs.cpp Remove uses of deprecated std::random_shuffle in the LLVM code base. Reviewed as https://reviews.llvm.org/D29780. 2017-02-16 14:37:03 +00:00
ListReducer.h Remove uses of deprecated std::random_shuffle in the LLVM code base. Reviewed as https://reviews.llvm.org/D29780. 2017-02-16 14:37:03 +00:00
LLVMBuild.txt Ensure backends available in 'opt' are also available in 'bugpoint' 2017-06-24 08:09:33 +00:00
Miscompilation.cpp Module::getOrInsertFunction is using C-style vararg instead of variadic templates. 2017-04-11 15:01:18 +00:00
OptimizerDriver.cpp [Support] Rename tool_output_file to ToolOutputFile, NFC 2017-09-23 01:03:17 +00:00
ToolRunner.cpp Convenience/safety fix for llvm::sys::Execute(And|No)Wait 2017-09-13 17:03:37 +00:00
ToolRunner.h bugpoint: Return Errors instead of passing around strings 2016-09-06 17:18:22 +00:00