[PATCH] D150816: [llvm-mca][RISCV] Fix llvm-mca RISCVInstrument memory leak

Michael Maitland via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 13:53:54 PDT 2023


michaelmaitland created this revision.
michaelmaitland added reviewers: craig.topper, reames, myhsu, andreadb.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, gbedwell, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, arichardson.
Herald added a project: All.
michaelmaitland requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

There was a memory leak that presented itself once the llvm-mca
tests were committed. This leak was not checked for by the pre-commit
tests. This change changes the shared_ptr to a unique_ptr to avoid
this problem.

We will know that this fix works once committed since I don't know
whether it is possible to force a lit test to use LSan. I spent the
day trying to build llvm with LSan enabled without much luck. If
anyone knows how to build llvm with LSan for the lit-tests, I am
happy to give it another try locally.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150816

Files:
  llvm/include/llvm/MCA/CustomBehaviour.h
  llvm/include/llvm/MCA/InstrBuilder.h
  llvm/lib/MCA/CustomBehaviour.cpp
  llvm/lib/MCA/InstrBuilder.cpp
  llvm/lib/Target/RISCV/MCA/RISCVCustomBehaviour.cpp
  llvm/lib/Target/RISCV/MCA/RISCVCustomBehaviour.h
  llvm/tools/llvm-mca/CodeRegion.cpp
  llvm/tools/llvm-mca/CodeRegion.h
  llvm/tools/llvm-mca/CodeRegionGenerator.cpp
  llvm/tools/llvm-mca/llvm-mca.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150816.523167.patch
Type: text/x-patch
Size: 11682 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230517/a6e68dc8/attachment.bin>


More information about the llvm-commits mailing list