[llvm] [RISCV] Improve cleanup phase of RISCV Insert VSETVLI pass (PR #67144)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 29 06:14:48 PDT 2023
================
@@ -1458,8 +1458,10 @@ void RISCVInsertVSETVLI::doLocalPostpass(MachineBasicBlock &MBB) {
if (VRegDef != RISCV::X0 &&
!(VRegDef.isVirtual() && MRI->use_nodbg_empty(VRegDef))) {
for (MachineInstr &UserMI : MRI->use_nodbg_instructions(VRegDef)) {
- // ignore uses by *NextMI since we will deal with them explicitly
- if (!NextMI || !UserMI.isIdenticalTo(*NextMI)) {
+ // do not track uses by *NextMI since we will deal with them explicitly,
+ // and also ignore uses by instructions that will be removed
+ if ((!NextMI || !UserMI.isIdenticalTo(*NextMI)) &&
+ ToDelete.find(&UserMI) == ToDelete.end()) {
----------------
artagnon wrote:
Use `SmallPtrSet::contains()`.
https://github.com/llvm/llvm-project/pull/67144
More information about the llvm-commits
mailing list