[PATCH] D92247: [IR][LoopRotate] avoid leaving phi with no operands (PR48296)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 27 14:30:18 PST 2020

lebedev.ri added inline comments.

Comment at: llvm/lib/IR/BasicBlock.cpp:335-337
+/// If \p KeepOneInputPHIs is true, then don't remove PHIs that are left with
+/// one incoming value, and don't simplify PHIs with all incoming values that
+/// are the same constant.
There's also a comment at the declaration of the function

Comment at: llvm/lib/IR/BasicBlock.cpp:338-366
 void BasicBlock::removePredecessor(BasicBlock *Pred,
                                    bool KeepOneInputPHIs) {
   // Use hasNUsesOrMore to bound the cost of this assertion for complex CFGs.
   assert((hasNUsesOrMore(16) || llvm::is_contained(predecessors(this), Pred)) &&
          "Pred is not a predecessor!");
   // Return early if there are no PHI nodes to update.
Ok, but i think this is rather akward.
It should be more like this.
Note that `removeIncomingValue()` *only* removes PHI's if they had a single pred,
so it doesn't make sense to pass anything related to `KeepOneInputPHIs` to it.



More information about the llvm-commits mailing list