[llvm] 1e1ec91 - [RISCV] Move PPBInfo exit check in needVSETVLIPHI. NFC
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 25 18:04:53 PDT 2024
Author: Luke Lau
Date: 2024-04-26T09:04:41+08:00
New Revision: 1e1ec916d30dc842e914e8a884f1bb4f62916730
URL: https://github.com/llvm/llvm-project/commit/1e1ec916d30dc842e914e8a884f1bb4f62916730
DIFF: https://github.com/llvm/llvm-project/commit/1e1ec916d30dc842e914e8a884f1bb4f62916730.diff
LOG: [RISCV] Move PPBInfo exit check in needVSETVLIPHI. NFC
Compare the predecessor's exit after we've already checked that the PHI
comes from a vsetvli. That way it's more obvious that Require has the same
VL as PBBExit.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index be01df0f1ea9eb..3feb7ec347543c 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -1337,11 +1337,7 @@ bool RISCVInsertVSETVLI::needVSETVLIPHI(const VSETVLIInfo &Require,
PHIOp += 2) {
Register InReg = PHI->getOperand(PHIOp).getReg();
MachineBasicBlock *PBB = PHI->getOperand(PHIOp + 1).getMBB();
- const BlockData &PBBInfo = BlockInfo[PBB->getNumber()];
- // If the exit from the predecessor has the VTYPE we are looking for
- // we might be able to avoid a VSETVLI.
- if (PBBInfo.Exit.isUnknown() || !PBBInfo.Exit.hasSameVTYPE(Require))
- return true;
+ const VSETVLIInfo &PBBExit = BlockInfo[PBB->getNumber()].Exit;
// We need the PHI input to the be the output of a VSET(I)VLI.
MachineInstr *DefMI = MRI->getVRegDef(InReg);
@@ -1351,7 +1347,13 @@ bool RISCVInsertVSETVLI::needVSETVLIPHI(const VSETVLIInfo &Require,
// We found a VSET(I)VLI make sure it matches the output of the
// predecessor block.
VSETVLIInfo DefInfo = getInfoForVSETVLI(*DefMI);
- if (DefInfo != PBBInfo.Exit)
+ if (DefInfo != PBBExit)
+ return true;
+
+ // Require has the same VL as PBBExit, so if the exit from the
+ // predecessor has the VTYPE we are looking for we might be able
+ // to avoid a VSETVLI.
+ if (PBBExit.isUnknown() || !PBBExit.hasSameVTYPE(Require))
return true;
}
More information about the llvm-commits
mailing list