diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 5c6a7b7dec5641..865a236a048c2f 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -167,6 +167,10 @@ static cl::opt BranchFoldToCommonDestVectorMultiplier( "to fold branch to common destination when vector operations are " "present")); +static cl::opt EnableMergeCompatibleInvokes( + "simplifycfg-merge-compatible-invokes", cl::Hidden, cl::init(true), + cl::desc("Allow SimplifyCFG to merge invokes together when appropriate")); + STATISTIC(NumBitMaps, "Number of switch instructions turned into bitmaps"); STATISTIC(NumLinearMaps, "Number of switch instructions turned into linear mapping"); @@ -2528,6 +2532,9 @@ static void MergeCompatibleInvokesImpl(ArrayRef Invokes, /// edges invoke0->cont0 and invoke1->cont1 are "compatible", /// and the invoked functions are "compatible". static bool MergeCompatibleInvokes(BasicBlock *BB, DomTreeUpdater *DTU) { + if (!EnableMergeCompatibleInvokes) + return false; + bool Changed = false; // FIXME: generalize to all exception handling blocks?