Commit 3c0ebc71 authored by Marek Olsak's avatar Marek Olsak
Browse files

AMDGPU/SI: Remove ending s_endpgm from non-void functions

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm

Differential Revision: http://reviews.llvm.org/D16035

llvm-svn: 257623
parent 8e9cc63b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -494,6 +494,14 @@ bool SIInsertWaits::runOnMachineFunction(MachineFunction &MF) {

    // Wait for everything at the end of the MBB
    Changes |= insertWait(MBB, MBB.getFirstTerminator(), LastIssued);

    // Functions returning something shouldn't contain S_ENDPGM, because other
    // bytecode will be appended after it.
    if (!ReturnsVoid) {
      MachineBasicBlock::iterator I = MBB.getFirstTerminator();
      if (I != MBB.end() && I->getOpcode() == AMDGPU::S_ENDPGM)
        I->eraseFromParent();
    }
  }

  return Changes;