[llvm] [RISCV][VLOpt] Reorganize visit order and worklist management (PR #123973)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 10:10:02 PST 2025


================
@@ -1292,53 +1292,60 @@ std::optional<MachineOperand> RISCVVLOptimizer::checkUsers(MachineInstr &MI) {
   return CommonVL;
 }
 
-bool RISCVVLOptimizer::tryReduceVL(MachineInstr &OrigMI) {
-  SetVector<MachineInstr *> Worklist;
-  Worklist.insert(&OrigMI);
+bool RISCVVLOptimizer::tryReduceVL(MachineInstr &MI) {
+  LLVM_DEBUG(dbgs() << "Trying to reduce VL for " << MI << "\n");
 
-  bool MadeChange = false;
-  while (!Worklist.empty()) {
-    MachineInstr &MI = *Worklist.pop_back_val();
-    LLVM_DEBUG(dbgs() << "Trying to reduce VL for " << MI << "\n");
+  if (!isVectorRegClass(MI.getOperand(0).getReg(), MRI))
----------------
preames wrote:

There's a bit more cleanup on some the workload invariants here.  I'm planning a separate patch.  

https://github.com/llvm/llvm-project/pull/123973


More information about the llvm-commits mailing list