[all-commits] [llvm/llvm-project] a23f98: [CodeGen] Add unittest for findDebugLoc, rfindDebu...

Björn Pettersson via All-commits all-commits at lists.llvm.org
Thu May 25 05:50:48 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a23f9846163956b74ab578bc972415c015022d10
      https://github.com/llvm/llvm-project/commit/a23f9846163956b74ab578bc972415c015022d10
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M llvm/include/llvm/CodeGen/MachineBasicBlock.h
    M llvm/lib/CodeGen/MachineBasicBlock.cpp
    M llvm/unittests/CodeGen/CMakeLists.txt
    A llvm/unittests/CodeGen/MachineBasicBlockTest.cpp
    M llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn

  Log Message:
  -----------
  [CodeGen] Add unittest for findDebugLoc, rfindDebugLoc, findPrevDebugLoc and rfindPrevDebugLoc. NFC

- Add some unittests for the findDebugLoc, rfindDebugLoc,
  findPrevDebugLoc and rfindPrevDebugLoc helpers in MachineBasicBlock.

- Clean up code comments and code formatting related to the functions
  mentioned above.

This was extracted as a pre-commit to D150577, adn some of the tests
are commented out since they would crash/assert in a rather
uncontrolled way.


  Commit: 63c9fe2db5cbaa7e068d24472d1aabed084789ce
      https://github.com/llvm/llvm-project/commit/63c9fe2db5cbaa7e068d24472d1aabed084789ce
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M llvm/lib/CodeGen/MachineBasicBlock.cpp
    M llvm/unittests/CodeGen/MachineBasicBlockTest.cpp

  Log Message:
  -----------
  [CodeGen] Fix for MachineBasicBlock::rfindDebugLoc(instr_rend())

Make sure we do not crash in rfindDebugLoc when starting at
instr_rend(). Solution is to see it as we start one MI before the
first MI, so we can start searching forward at instr_begin()
instead.

This behavior is similar to how findPrevDebugLoc(instr_end()) works.

Differential Revision: https://reviews.llvm.org/D150577


Compare: https://github.com/llvm/llvm-project/compare/ce2631d14727...63c9fe2db5cb


More information about the All-commits mailing list