summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2019-03-27 16:58:27 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2019-03-27 16:58:27 +0000
commit4ab28b64b4cea1fc7d12a352e706a46eb5e5fe4c (patch)
tree3b013e8636ba558597e46c508960075d5737a5dc /llvm/lib/Target
parenta42b7247d36a43d5c5b58c99aafce9ad6d1fe796 (diff)
downloadbcm5719-llvm-4ab28b64b4cea1fc7d12a352e706a46eb5e5fe4c.tar.gz
bcm5719-llvm-4ab28b64b4cea1fc7d12a352e706a46eb5e5fe4c.zip
AMDGPU: Skip debug_instr when collapsing end_cf
Based on how these are inserted, I doubt this was causing a problem in practice. llvm-svn: 357090
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp b/llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp
index 21eecb1007f..f5724a71e1d 100644
--- a/llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp
+++ b/llvm/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp
@@ -308,7 +308,8 @@ bool SIOptimizeExecMaskingPreRA::runOnMachineFunction(MachineFunction &MF) {
}
// Try to collapse adjacent endifs.
- auto Lead = MBB.begin(), E = MBB.end();
+ auto E = MBB.end();
+ auto Lead = skipDebugInstructionsForward(MBB.begin(), E);
if (MBB.succ_size() != 1 || Lead == E || !isEndCF(*Lead, TRI))
continue;
@@ -318,14 +319,18 @@ bool SIOptimizeExecMaskingPreRA::runOnMachineFunction(MachineFunction &MF) {
auto I = std::next(Lead);
- for ( ; I != E; ++I)
+ for ( ; I != E; ++I) {
+ if (I->isDebugInstr())
+ continue;
+
if (!TII->isSALU(*I) || I->readsRegister(AMDGPU::EXEC, TRI))
break;
+ }
if (I != E)
continue;
- const auto NextLead = Succ->begin();
+ auto NextLead = skipDebugInstructionsForward(Succ->begin(), Succ->end());
if (NextLead == Succ->end() || !isEndCF(*NextLead, TRI) ||
!getOrExecSource(*NextLead, *TII, MRI))
continue;
OpenPOWER on IntegriCloud