[llvm] 9604601 - [SimplifyCFG] Remove redundant checks for hoisting (NFCI)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 4 01:54:02 PDT 2022


Author: Nikita Popov
Date: 2022-07-04T10:53:54+02:00
New Revision: 9604601c9394261af56f5cadfdaafef437be4275

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

LOG: [SimplifyCFG] Remove redundant checks for hoisting (NFCI)

These conditions are later checked in the HoistTerminator code
path. Checking them here is somewhat confusing, because this code
only checks the first instruction in the block, which is not
necessarily the terminator.

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 567b866f77778..a8b6a473bdf7f 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1473,10 +1473,7 @@ bool SimplifyCFGOpt::HoistThenElseCodeToIf(BranchInst *BI,
     while (isa<DbgInfoIntrinsic>(I2))
       I2 = &*BB2_Itr++;
   }
-  // FIXME: Can we define a safety predicate for CallBr?
-  if (isa<PHINode>(I1) || !I1->isIdenticalToWhenDefined(I2) ||
-      (isa<InvokeInst>(I1) && !isSafeToHoistInvoke(BB1, BB2, I1, I2)) ||
-      isa<CallBrInst>(I1))
+  if (isa<PHINode>(I1) || !I1->isIdenticalToWhenDefined(I2))
     return false;
 
   BasicBlock *BIParent = BI->getParent();


        


More information about the llvm-commits mailing list