From a997271e4d17b03992a767e40739d27e17ec0cad Mon Sep 17 00:00:00 2001 From: Luke Lau Date: Wed, 19 Jun 2024 18:59:53 +0800 Subject: [PATCH] [RISCV] Move RISCVInsertVSETVLI::coalesceVSETVLIs back to before insertReadVL In #88295 we split out coalesceVSETVLIs (f.k.a doLocalPostpass) into a separate pass, which meant moving it past the call to insertReadVL. Whenever we merged it back in #92869, we accidentally moved it after insertReadVL. This patch moves it back to its original position. --- llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp index d36ce60c24185..877535513c721 100644 --- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp +++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp @@ -1813,11 +1813,6 @@ bool RISCVInsertVSETVLI::runOnMachineFunction(MachineFunction &MF) { for (MachineBasicBlock &MBB : MF) emitVSETVLIs(MBB); - // Insert PseudoReadVL after VLEFF/VLSEGFF and replace it with the vl output - // of VLEFF/VLSEGFF. - for (MachineBasicBlock &MBB : MF) - insertReadVL(MBB); - // Now that all vsetvlis are explicit, go through and do block local // DSE and peephole based demanded fields based transforms. Note that // this *must* be done outside the main dataflow so long as we allow @@ -1827,6 +1822,11 @@ bool RISCVInsertVSETVLI::runOnMachineFunction(MachineFunction &MF) { for (MachineBasicBlock &MBB : MF) coalesceVSETVLIs(MBB); + // Insert PseudoReadVL after VLEFF/VLSEGFF and replace it with the vl output + // of VLEFF/VLSEGFF. + for (MachineBasicBlock &MBB : MF) + insertReadVL(MBB); + BlockInfo.clear(); return HaveVectorOp; }