[PATCH] D119305: [AArch64][LoadStoreOptimizer] Make sure physical registers used by renamable undef are not picked as register to rename.

Huihui Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 8 17:32:35 PST 2022


huihuiz added a comment.

Take test mir attached test/CodeGen/AArch64/stp-opt-with-renaming-crash.mir
run with llc -run-pass=aarch64-ldst-opt -mtriple=aarch64 -verify-machineinstrs

Then you will see assertion
"Rename register used between paired instruction, trashing the content".

Although we don't really care trashing content of an undef, but should we exclude undef when checking for overlap ?

  #if !defined(NDEBUG)
      // Make sure the register used for renaming is not used between the paired
      // instructions. That would trash the content before the new paired
      // instruction.
      for (auto &MI :
           iterator_range<MachineInstrBundleIterator<llvm::MachineInstr>>(
               std::next(I), std::next(Paired)))
        assert(all_of(MI.operands(),
                      [this, &RenameReg](const MachineOperand &MOP) {
                        return !MOP.isReg() || MOP.isDebug() || !MOP.getReg() ||
                               **MOP.isUndef() ||**
                               !TRI->regsOverlap(MOP.getReg(), *RenameReg);
                      }) &&
               "Rename register used between paired instruction, trashing the "
               "content");
  #endif


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119305/new/

https://reviews.llvm.org/D119305



More information about the llvm-commits mailing list