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
This commit is contained in:
Marek Olsak 2016-01-13 17:23:12 +00:00
parent 8e9cc63bfb
commit 3c0ebc71f1
1 changed files with 8 additions and 0 deletions

View File

@ -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;