diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2018-08-28 18:55:55 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2018-08-28 18:55:55 +0000 |
| commit | 755f41f3a2125d3ef56dfe2cb0997ae7243785c5 (patch) | |
| tree | 1a1e6bfdb074470dd5f3b89bbddd3182d47b2711 /llvm/lib/Target | |
| parent | 6b4d343e1365ac1e8f04659216d5b190f90b4694 (diff) | |
| download | bcm5719-llvm-755f41f3a2125d3ef56dfe2cb0997ae7243785c5.tar.gz bcm5719-llvm-755f41f3a2125d3ef56dfe2cb0997ae7243785c5.zip | |
AMDGPU: Don't delete instructions if S_ENDPGM has implicit uses
This can leave behind the uses with the defs removed.
Since this should only really happen in tests, it's not worth the
effort of trying to handle this.
llvm-svn: 340866
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp b/llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp index 7b678d12ba8..e53d876f232 100644 --- a/llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp +++ b/llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp @@ -119,7 +119,14 @@ bool SIOptimizeExecMaskingPreRA::runOnMachineFunction(MachineFunction &MF) { // Try to remove unneeded instructions before s_endpgm. if (MBB.succ_empty()) { - if (MBB.empty() || MBB.back().getOpcode() != AMDGPU::S_ENDPGM) + if (MBB.empty()) + continue; + + // Skip this if the endpgm has any implicit uses, otherwise we would need + // to be careful to update / remove them. + MachineInstr &Term = MBB.back(); + if (Term.getOpcode() != AMDGPU::S_ENDPGM || + Term.getNumOperands() != 0) continue; SmallVector<MachineBasicBlock*, 4> Blocks({&MBB}); |

