[llvm] bfc1217 - [NFC] Introduce option to switch off compatible invokes merge

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 06:51:29 PST 2022


Author: Max Kazantsev
Date: 2022-02-15T21:51:03+07:00
New Revision: bfc12171192c7b8717a16d8ff1a3b6952b20ca53

URL: https://github.com/llvm/llvm-project/commit/bfc12171192c7b8717a16d8ff1a3b6952b20ca53
DIFF: https://github.com/llvm/llvm-project/commit/bfc12171192c7b8717a16d8ff1a3b6952b20ca53.diff

LOG: [NFC] Introduce option to switch off compatible invokes merge

Does not affect default behavior (transform is on).

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 5c6a7b7dec564..865a236a048c2 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -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?


        


More information about the llvm-commits mailing list