summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
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