[NFC] Introduce option to switch off compatible invokes merge

Does not affect default behavior (transform is on).
This commit is contained in:
Max Kazantsev 2022-02-15 21:34:55 +07:00
parent ac5a5a9cfe
commit bfc1217119
1 changed files with 7 additions and 0 deletions

View File

@ -167,6 +167,10 @@ static cl::opt<unsigned> BranchFoldToCommonDestVectorMultiplier(
"to fold branch to common destination when vector operations are "
"present"));
static cl::opt<bool> 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<InvokeInst *> 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?