[PATCH] D112006: [DebugInfo][InstrRef] Add unit tests for transfer-function building

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 18 08:46:25 PDT 2021


jmorse created this revision.
jmorse added reviewers: StephenTozer, Orlando, TWeaver.
Herald added subscribers: pengfei, hiraditya.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch adds some unit tests for the machine-location transfer-function building parts of InstrRefBasedLDV: i.e., test that if we feed some MIR into the transfer-function building code, does it create the correct transfer function.

There are a number of minor defects that get corrected in the process:

- The unit test was selecting the x86 (i.e. 32 bit) backend rather than x86_64's 64 bit backend,
- COPY instructions weren't actually having their subregister values correctly represented in the transfer function. Subregisters were being defined by the COPY, rather than taking the value in the source register.
- All call instructions were clobbering the stack pointer: a recent patch that fiddled with this accidentally inverted the logic.

I'll drop inline comments in explaining the different parts.

Otherwise, cosmetically, I've replaced a "getNumAtPos" method with "readMLoc". This is more consistent with the other helper functions for, for example, setting the values in machine locations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112006

Files:
  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
  llvm/unittests/CodeGen/InstrRefLDVTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112006.380418.patch
Type: text/x-patch
Size: 22074 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211018/84a72045/attachment.bin>


More information about the llvm-commits mailing list