diff --git a/llvm/include/llvm/Transforms/Utils/SSAUpdaterBulk.h b/llvm/include/llvm/Transforms/Utils/SSAUpdaterBulk.h index a1a2cac76bde8..a489daa8035ee 100644 --- a/llvm/include/llvm/Transforms/Utils/SSAUpdaterBulk.h +++ b/llvm/include/llvm/Transforms/Utils/SSAUpdaterBulk.h @@ -14,12 +14,12 @@ #define LLVM_TRANSFORMS_UTILS_SSAUPDATERBULK_H #include "llvm/ADT/StringRef.h" +#include "llvm/IR/BasicBlock.h" #include "llvm/IR/PredIteratorCache.h" #include "llvm/Support/Compiler.h" namespace llvm { -class BasicBlock; class PHINode; template class SmallVectorImpl; class Type; @@ -84,6 +84,10 @@ class SSAUpdaterBulk { LLVM_ABI_FOR_TEST void RewriteAndOptimizeAllUses(DominatorTree &DT); }; +LLVM_ABI_FOR_TEST bool +EliminateNewDuplicatePHINodes(BasicBlock *BB, + BasicBlock::phi_iterator FirstExistingPN); + } // end namespace llvm #endif // LLVM_TRANSFORMS_UTILS_SSAUPDATERBULK_H diff --git a/llvm/lib/Transforms/Utils/SSAUpdaterBulk.cpp b/llvm/lib/Transforms/Utils/SSAUpdaterBulk.cpp index fb39fddde72e2..c5bd0567d8d66 100644 --- a/llvm/lib/Transforms/Utils/SSAUpdaterBulk.cpp +++ b/llvm/lib/Transforms/Utils/SSAUpdaterBulk.cpp @@ -267,6 +267,8 @@ static bool replaceIfIdentical(PHINode &PHI, PHINode &ReplPHI) { return true; } +namespace llvm { + bool EliminateNewDuplicatePHINodes(BasicBlock *BB, BasicBlock::phi_iterator FirstExistingPN) { assert(!PHIAreRefEachOther(make_range(BB->phis().begin(), FirstExistingPN))); @@ -293,6 +295,8 @@ bool EliminateNewDuplicatePHINodes(BasicBlock *BB, return Changed; } +} // end namespace llvm + static void deduplicatePass(ArrayRef Worklist) { SmallDenseMap BBs; for (PHINode *PHI : Worklist) { diff --git a/llvm/unittests/Transforms/Utils/SSAUpdaterBulkTest.cpp b/llvm/unittests/Transforms/Utils/SSAUpdaterBulkTest.cpp index 13cfaf3a0345e..503d3a0f9bfa9 100644 --- a/llvm/unittests/Transforms/Utils/SSAUpdaterBulkTest.cpp +++ b/llvm/unittests/Transforms/Utils/SSAUpdaterBulkTest.cpp @@ -374,9 +374,6 @@ TEST(SSAUpdaterBulk, SimplifyPHIs) { EXPECT_EQ(Phi, Cmp->getOperand(1)); } -bool EliminateNewDuplicatePHINodes(BasicBlock *BB, - BasicBlock::phi_iterator FirstExistingPN); - // Helper to run both versions on the same input. static void RunEliminateNewDuplicatePHINode( const char *AsmText,