[all-commits] [llvm/llvm-project] e2632f: [NVPTX] Use MBB.begin() instead MBB.front() in NVP...

Shivam Gupta via All-commits all-commits at lists.llvm.org
Tue Sep 13 20:01:30 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e2632fbcdd8d8a5fff6c3ea4f4104cb63019f2c9
      https://github.com/llvm/llvm-project/commit/e2632fbcdd8d8a5fff6c3ea4f4104cb63019f2c9
  Author: Shivam Gupta <shivam98.tkg at gmail.com>
  Date:   2022-09-14 (Wed, 14 Sep 2022)

  Changed paths:
    M llvm/lib/Target/NVPTX/NVPTXFrameLowering.cpp
    A llvm/test/CodeGen/NVPTX/bug52623.ll

  Log Message:
  -----------
  [NVPTX] Use MBB.begin() instead MBB.front() in NVPTXFrameLowering::emitPrologue

The second argument of `NVPTXFrameLowering::emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB)` is the first MBB of the MF. In that function, it assumes the first MBB always contains instructions, so it gets the first instruction by MachineInstr *MI = &MBB.front();. However, with the reproducer/test case attached, all instructions in the first MBB is cleared in a previous pass for stack coloring. As a consequence, MBB.front() triggers the assertion that the first node is actually a sentinel node. Hence we are using MachineBasicBlock::iterator to iterate over MBB.

Fix #52623.

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




More information about the All-commits mailing list