[llvm] [RISCV][VLOPT] Compute demanded VLs up front (PR #124530)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 07:17:12 PST 2025


================
@@ -1285,9 +1290,9 @@ std::optional<MachineOperand> RISCVVLOptimizer::checkUsers(MachineInstr &MI) {
 bool RISCVVLOptimizer::tryReduceVL(MachineInstr &MI) {
   LLVM_DEBUG(dbgs() << "Trying to reduce VL for " << MI << "\n");
 
-  auto CommonVL = checkUsers(MI);
-  if (!CommonVL)
+  if (!DemandedVLs.contains(&MI))
     return false;
+  auto CommonVL = std::make_optional(DemandedVLs.at(&MI));
----------------
lukel97 wrote:

Yeah, I changed it back to an optional to remove the `->` to `.` diff below, and was hoping to clean it up in a follow up. If reviewers would prefer I can convert it in this PR

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


More information about the llvm-commits mailing list