aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/R600/AMDILCFGStructurizer.cpp
diff options
context:
space:
mode:
authorVincent Lejeune <vljn@ovi.com>2013-07-31 19:31:14 +0000
committerVincent Lejeune <vljn@ovi.com>2013-07-31 19:31:14 +0000
commitacf73503851815f8251b78e3b2e7cf91ef738c50 (patch)
treeea4bcc1189be360fe65d47a7bcef3f154927604e /lib/Target/R600/AMDILCFGStructurizer.cpp
parent16e4ed5879da57502ea3686c79c63f86994fbe75 (diff)
downloadexternal_llvm-acf73503851815f8251b78e3b2e7cf91ef738c50.zip
external_llvm-acf73503851815f8251b78e3b2e7cf91ef738c50.tar.gz
external_llvm-acf73503851815f8251b78e3b2e7cf91ef738c50.tar.bz2
R600: Remove predicated_break inst
We were using two instructions for similar purpose : break and predicated break. Only predicated_break was emitted and it was lowered at R600ControlFlowFinalizer to JUMP;CF_BREAK;POP. This commit simplify the situation by making AMDILCFGStructurizer emit IF_PREDICATE;BREAK;ENDIF; instead of predicated_break (which is now removed). There is no functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187510 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/R600/AMDILCFGStructurizer.cpp')
-rw-r--r--lib/Target/R600/AMDILCFGStructurizer.cpp37
1 files changed, 5 insertions, 32 deletions
diff --git a/lib/Target/R600/AMDILCFGStructurizer.cpp b/lib/Target/R600/AMDILCFGStructurizer.cpp
index fac56f0..687eadb 100644
--- a/lib/Target/R600/AMDILCFGStructurizer.cpp
+++ b/lib/Target/R600/AMDILCFGStructurizer.cpp
@@ -251,7 +251,6 @@ protected:
MachineInstr *getLoopendBlockBranchInstr(MachineBasicBlock *MBB);
static MachineInstr *getReturnInstr(MachineBasicBlock *MBB);
static MachineInstr *getContinueInstr(MachineBasicBlock *MBB);
- static MachineInstr *getLoopBreakInstr(MachineBasicBlock *MBB);
static bool isReturnBlock(MachineBasicBlock *MBB);
static void cloneSuccessorList(MachineBasicBlock *DstMBB,
MachineBasicBlock *SrcMBB) ;
@@ -668,16 +667,6 @@ MachineInstr *AMDGPUCFGStructurizer::getContinueInstr(MachineBasicBlock *MBB) {
return NULL;
}
-MachineInstr *AMDGPUCFGStructurizer::getLoopBreakInstr(MachineBasicBlock *MBB) {
- for (MachineBasicBlock::iterator It = MBB->begin(); (It != MBB->end());
- ++It) {
- MachineInstr *MI = &(*It);
- if (MI->getOpcode() == AMDGPU::PREDICATED_BREAK)
- return MI;
- }
- return NULL;
-}
-
bool AMDGPUCFGStructurizer::isReturnBlock(MachineBasicBlock *MBB) {
MachineInstr *MI = getReturnInstr(MBB);
bool IsReturn = (MBB->succ_size() == 0);
@@ -1529,26 +1518,8 @@ void AMDGPUCFGStructurizer::mergeLooplandBlock(MachineBasicBlock *DstBlk,
DEBUG(dbgs() << "loopPattern header = BB" << DstBlk->getNumber()
<< " land = BB" << LandMBB->getNumber() << "\n";);
- /* we last inserterd the DebugLoc in the
- * BREAK_LOGICALZ_i32 or AMDGPU::BREAK_LOGICALNZ statement in the current
- * dstBlk.
- * search for the DebugLoc in the that statement.
- * if not found, we have to insert the empty/default DebugLoc */
- MachineInstr *LoopBreakInstr = getLoopBreakInstr(DstBlk);
- DebugLoc DLBreak = (LoopBreakInstr) ? LoopBreakInstr->getDebugLoc() :
- DebugLoc();
-
- insertInstrBefore(DstBlk, AMDGPU::WHILELOOP, DLBreak);
-
- /* we last inserterd the DebugLoc in the continue statement in the current
- * dstBlk.
- * search for the DebugLoc in the continue statement.
- * if not found, we have to insert the empty/default DebugLoc */
- MachineInstr *ContinueInstr = getContinueInstr(DstBlk);
- DebugLoc DLContinue = (ContinueInstr) ? ContinueInstr->getDebugLoc() :
- DebugLoc();
-
- insertInstrEnd(DstBlk, AMDGPU::ENDLOOP, DLContinue);
+ insertInstrBefore(DstBlk, AMDGPU::WHILELOOP, DebugLoc());
+ insertInstrEnd(DstBlk, AMDGPU::ENDLOOP, DebugLoc());
DstBlk->addSuccessor(LandMBB);
DstBlk->removeSuccessor(DstBlk);
}
@@ -1565,7 +1536,9 @@ void AMDGPUCFGStructurizer::mergeLoopbreakBlock(MachineBasicBlock *ExitingMBB,
MachineBasicBlock::iterator I = BranchMI;
if (TrueBranch != LandMBB)
reversePredicateSetter(I);
- insertCondBranchBefore(I, AMDGPU::PREDICATED_BREAK, DL);
+ insertCondBranchBefore(ExitingMBB, I, AMDGPU::IF_PREDICATE_SET, AMDGPU::PREDICATE_BIT, DL);
+ insertInstrBefore(I, AMDGPU::BREAK);
+ insertInstrBefore(I, AMDGPU::ENDIF);
//now branchInst can be erase safely
BranchMI->eraseFromParent();
//now take care of successors, retire blocks