[llvm] [RISCV][VLOPT] Allow propagation even when VL isn't VLMAX (PR #112228)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 15 09:09:26 PDT 2024
================
@@ -759,29 +787,45 @@ bool RISCVVLOptimizer::tryReduceVL(MachineInstr &OrigMI) {
MachineInstr &MI = *Worklist.pop_back_val();
LLVM_DEBUG(dbgs() << "Trying to reduce VL for " << MI << "\n");
- std::optional<Register> CommonVL;
+ std::optional<const MachineOperand *> CommonVL;
----------------
lukel97 wrote:
For pointers you don't need to wrap it with std::optional, I think you can just do
```suggestion
const MachineOperand * CommonVL = nullptr;
```
And check if that's null instead. So the signature of checkUsers would be
```c++
bool RISCVVLOptimizer::checkUsers(const MachineOperand *&CommonVL, MachineInstr &MI)
```
https://github.com/llvm/llvm-project/pull/112228
More information about the llvm-commits
mailing list