[PATCH] D151314: [RegisterCoalescer] Fix updating LiveIntervals in joinReservedPhysReg

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 04:08:21 PDT 2023

foad added reviewers: kparzysz, arsenm, qcolombet, MatzeB, fhahn.
foad added inline comments.
Herald added a subscriber: wdng.

Comment at: llvm/lib/CodeGen/RegisterCoalescer.cpp:2242
     LIS->removePhysRegDefAt(DstReg.asMCReg(), CopyRegIdx);
     // Create a new dead def at the new def location.
In the old code, if the live interval did not already exist, this would do nothing...

Comment at: llvm/lib/CodeGen/RegisterCoalescer.cpp:2245
     for (MCRegUnitIterator UI(DstReg, TRI); UI.isValid(); ++UI) {
       LiveRange &LR = LIS->getRegUnit(*UI);
       LR.createDeadDef(DestRegIdx, LIS->getVNInfoAllocator());
... and this would create a new live interval including the dead def at 32B, which would not get removed when CopyMI was deleted.

Comment at: llvm/test/CodeGen/AArch64/regcoal-physreg.mir:1
-# RUN: llc -mtriple=aarch64-apple-ios -run-pass=simple-register-coalescing -verify-machineinstrs %s -o - | FileCheck %s
+# RUN: llc -mtriple=aarch64-apple-ios -run-pass=simple-register-coalescing,simple-register-coalescing -verify-machineinstrs %s -o - | FileCheck %s
 --- |
This is a hack to ensure that machine verification gets run after (the first run of) simple-register-coalescing. It will not be required after D129208 lands.

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list