[llvm] [RISCV][VLOPT] Compute demanded VLs up front (PR #124530)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 28 08:35:44 PST 2025
================
@@ -56,6 +57,10 @@ class RISCVVLOptimizer : public MachineFunctionPass {
std::optional<MachineOperand> checkUsers(MachineInstr &MI);
bool tryReduceVL(MachineInstr &MI);
bool isCandidate(const MachineInstr &MI) const;
+
+ /// For a given instruction, records what elements of it are demanded by
+ /// downstream users.
+ DenseMap<const MachineInstr *, MachineOperand> DemandedVLs;
----------------
preames wrote:
Please just have the value be an optional<MachineOperand>. This simplifies the code, and has no real additional cost. Please stop trying to micro-optimize this. If you want to come back to it, please feel free, but let's do the simple version first.
To be clear, this is *not* just a stylistic point. I am suspecting from your code structure below that you have a bug in your handling of the std::nullopt case, and want as much of that logic to disappear from this review as possible.
https://github.com/llvm/llvm-project/pull/124530
More information about the llvm-commits
mailing list