[llvm] [RISCV][VLOPT] Look through PHI instructions (PR #132236)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 20 10:52:11 PDT 2025
================
@@ -1340,6 +1341,17 @@ RISCVVLOptimizer::checkUsers(const MachineInstr &MI) const {
continue;
}
+ if (UserMI.isPHI() && PHISeen.insert(&UserMI).second) {
+ LLVM_DEBUG(dbgs() << " Peeking through uses of PHI\n");
+ for (auto &PhiUse : MRI->use_operands(UserMI.getOperand(0).getReg())) {
+ // If UserMI has a PHI cycle, don't analyze it.
+ if (PhiUse.getParent() == &UserMI)
----------------
topperc wrote:
You can have a cycle without the phi directly using itself. The phi using itself is a more unusual case. The common case is there being some operation modifying the phi and then the result of that being used by the phi.
Example:
preheader:
...
loop:
a = phi [preheader, 0], [loop, b]
b = add a, 1
...
branch to loop
https://github.com/llvm/llvm-project/pull/132236
More information about the llvm-commits
mailing list