[PATCH] D132080: RegisterClassInfo: Fix CSR cache invalidation

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 16:21:28 PDT 2022


MatzeB created this revision.
MatzeB added reviewers: qcolombet, arsenm, mtrofin.
Herald added subscribers: modimo, wenlei, hiraditya, nemanjai, mcrosier.
Herald added a project: All.
MatzeB requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

`RegisterClassInfo` caches information like allocation orders and reuses it for multiple machine functions where possible. However the `MCPhysReg *CalleeSavedRegs` field used to test whether the set of callee saved registers changed did not work: After D28566 <https://reviews.llvm.org/D28566> `MachineRegisterInfo::getCalleeSavedRegs()` can return dynamically computed CSR sets that are only valid while the `MachineRegisterInfo` object of the current function exists.

This changes the code to make a copy of the CSR list instead of keeping a possibly invalid pointer around.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132080

Files:
  llvm/include/llvm/CodeGen/RegisterClassInfo.h
  llvm/lib/CodeGen/RegisterClassInfo.cpp
  llvm/test/CodeGen/PowerPC/pcrel-call-linkage-leaf.ll
  llvm/test/CodeGen/XCore/scavenging.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132080.453466.patch
Type: text/x-patch
Size: 5623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220817/117db077/attachment-0001.bin>


More information about the llvm-commits mailing list