diff options
author | Luke Lau <luke@igalia.com> | 2024-04-26 08:56:33 +0800 |
---|---|---|
committer | Luke Lau <luke@igalia.com> | 2024-04-26 09:04:41 +0800 |
commit | 1e1ec916d30dc842e914e8a884f1bb4f62916730 (patch) | |
tree | 2c77823ba58d7cba84bccaa32679eb5c023b1a97 /llvm | |
parent | 771e4e89662f623be6e45bd4b84103552e5e910f (diff) | |
download | llvm-1e1ec916d30dc842e914e8a884f1bb4f62916730.zip llvm-1e1ec916d30dc842e914e8a884f1bb4f62916730.tar.gz llvm-1e1ec916d30dc842e914e8a884f1bb4f62916730.tar.bz2 |
[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.
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp index be01df0..3feb7ec 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; } |