[llvm] [NewPM] Remove UnifyFunctionExitNodesLegacyPass (PR #72816)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 19 16:44:04 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Aiden Grossman (boomanaiden154)
<details>
<summary>Changes</summary>
UnifyFunctionExitNodesLegacyPass isn't used anywhere in upstream and thus isn't tested at all. For these reasons, remove it.
---
Full diff: https://github.com/llvm/llvm-project/pull/72816.diff
5 Files Affected:
- (modified) llvm/include/llvm/InitializePasses.h (-1)
- (modified) llvm/include/llvm/LinkAllPasses.h (-2)
- (modified) llvm/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h (-13)
- (modified) llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp (-32)
- (modified) llvm/lib/Transforms/Utils/Utils.cpp (-1)
``````````diff
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index da38a38b87ebc4d..8e5332a228a71ba 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -327,7 +327,6 @@ void initializeTwoAddressInstructionPassPass(PassRegistry&);
void initializeTypeBasedAAWrapperPassPass(PassRegistry&);
void initializeTypePromotionLegacyPass(PassRegistry&);
void initializeUniformityInfoWrapperPassPass(PassRegistry &);
-void initializeUnifyFunctionExitNodesLegacyPassPass(PassRegistry &);
void initializeUnifyLoopExitsLegacyPassPass(PassRegistry &);
void initializeUnpackMachineBundlesPass(PassRegistry&);
void initializeUnreachableBlockElimLegacyPassPass(PassRegistry&);
diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index 3fc90e85c3533e2..9761264b0b761f5 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -44,7 +44,6 @@
#include "llvm/Transforms/Scalar/Scalarizer.h"
#include "llvm/Transforms/Utils.h"
#include "llvm/Transforms/Utils/SymbolRewriter.h"
-#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
#include "llvm/Transforms/Vectorize/LoadStoreVectorizer.h"
#include <cstdlib>
@@ -121,7 +120,6 @@ namespace {
(void) llvm::createSingleLoopExtractorPass();
(void) llvm::createTailCallEliminationPass();
(void)llvm::createTLSVariableHoistPass();
- (void) llvm::createUnifyFunctionExitNodesPass();
(void) llvm::createInstCountPass();
(void) llvm::createConstantHoistingPass();
(void) llvm::createCodeGenPreparePass();
diff --git a/llvm/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h b/llvm/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
index 461669d6a217876..296d3b755e2c85e 100644
--- a/llvm/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
+++ b/llvm/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
@@ -19,19 +19,6 @@
namespace llvm {
-class UnifyFunctionExitNodesLegacyPass : public FunctionPass {
-public:
- static char ID; // Pass identification, replacement for typeid
- UnifyFunctionExitNodesLegacyPass();
-
- // We can preserve non-critical-edgeness when we unify function exit nodes
- void getAnalysisUsage(AnalysisUsage &AU) const override;
-
- bool runOnFunction(Function &F) override;
-};
-
-Pass *createUnifyFunctionExitNodesPass();
-
class UnifyFunctionExitNodesPass
: public PassInfoMixin<UnifyFunctionExitNodesPass> {
public:
diff --git a/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
index e5adbe5133cf457..d5468909dd4ea75 100644
--- a/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
+++ b/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
@@ -16,31 +16,9 @@
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Type.h"
-#include "llvm/InitializePasses.h"
#include "llvm/Transforms/Utils.h"
using namespace llvm;
-char UnifyFunctionExitNodesLegacyPass::ID = 0;
-
-UnifyFunctionExitNodesLegacyPass::UnifyFunctionExitNodesLegacyPass()
- : FunctionPass(ID) {
- initializeUnifyFunctionExitNodesLegacyPassPass(
- *PassRegistry::getPassRegistry());
-}
-
-INITIALIZE_PASS(UnifyFunctionExitNodesLegacyPass, "mergereturn",
- "Unify function exit nodes", false, false)
-
-Pass *llvm::createUnifyFunctionExitNodesPass() {
- return new UnifyFunctionExitNodesLegacyPass();
-}
-
-void UnifyFunctionExitNodesLegacyPass::getAnalysisUsage(
- AnalysisUsage &AU) const {
- // We preserve the non-critical-edgeness property
- AU.addPreservedID(BreakCriticalEdgesID);
-}
-
namespace {
bool unifyUnreachableBlocks(Function &F) {
@@ -108,16 +86,6 @@ bool unifyReturnBlocks(Function &F) {
}
} // namespace
-// Unify all exit nodes of the CFG by creating a new BasicBlock, and converting
-// all returns to unconditional branches to this new basic block. Also, unify
-// all unreachable blocks.
-bool UnifyFunctionExitNodesLegacyPass::runOnFunction(Function &F) {
- bool Changed = false;
- Changed |= unifyUnreachableBlocks(F);
- Changed |= unifyReturnBlocks(F);
- return Changed;
-}
-
PreservedAnalyses UnifyFunctionExitNodesPass::run(Function &F,
FunctionAnalysisManager &AM) {
bool Changed = false;
diff --git a/llvm/lib/Transforms/Utils/Utils.cpp b/llvm/lib/Transforms/Utils/Utils.cpp
index 91c743f17764123..f096c1ec7540c39 100644
--- a/llvm/lib/Transforms/Utils/Utils.cpp
+++ b/llvm/lib/Transforms/Utils/Utils.cpp
@@ -30,7 +30,6 @@ void llvm::initializeTransformUtils(PassRegistry &Registry) {
initializeLowerInvokeLegacyPassPass(Registry);
initializeLowerSwitchLegacyPassPass(Registry);
initializePromoteLegacyPassPass(Registry);
- initializeUnifyFunctionExitNodesLegacyPassPass(Registry);
initializeStripGCRelocatesLegacyPass(Registry);
initializePredicateInfoPrinterLegacyPassPass(Registry);
initializeFixIrreduciblePass(Registry);
``````````
</details>
https://github.com/llvm/llvm-project/pull/72816
More information about the llvm-commits
mailing list