[llvm] [Bitcode] Fix incomplete deduplication of PHI entries (PR #162860)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 10 07:58:40 PDT 2025
================
@@ -658,6 +658,26 @@ void BasicBlock::replaceSuccessorsPhiUsesWith(BasicBlock *New) {
this->replaceSuccessorsPhiUsesWith(this, New);
}
+void BasicBlock::deduplicatePhiUsesOf(BasicBlock *BB) {
+ // N.B. This might not be a complete BasicBlock, so don't assume
+ // that it ends with a non-phi instruction.
+ for (Instruction &I : *this) {
+ PHINode *PN = dyn_cast<PHINode>(&I);
+ if (!PN)
+ break;
+ // Since the order of basic blocks in a PHINode are sorted we can
+ // use the index of \p BB + 1 as the first index to check for duplicates.
----------------
nikic wrote:
The blocks are generally not sorted.
https://github.com/llvm/llvm-project/pull/162860
More information about the llvm-commits
mailing list