[PATCH] D98940: [AMDGPU] Allow mode optimisation in SIPreEmitPeephole for bundles
Carl Ritson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 19 04:49:57 PDT 2021
critson created this revision.
critson added reviewers: kerbowa, rampitec, foad.
Herald added subscribers: hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl, arsenm.
critson requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
Add code so duplication mode register changes can be removed from
inside bundles.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D98940
Files:
llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp
Index: llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp
+++ llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp
@@ -219,8 +219,11 @@
return false;
// Scan back to find an identical S_SET_GPR_IDX_ON
- for (MachineBasicBlock::iterator I = std::next(First.getIterator()),
- E = MI.getIterator(); I != E; ++I) {
+ for (MachineBasicBlock::instr_iterator I = std::next(First.getIterator()),
+ E = MI.getIterator();
+ I != E; ++I) {
+ if (I->isBundle())
+ continue;
switch (I->getOpcode()) {
case AMDGPU::S_SET_GPR_IDX_MODE:
return false;
@@ -249,9 +252,9 @@
}
}
- MI.eraseFromParent();
+ MI.eraseFromBundle();
for (MachineInstr *RI : ToRemove)
- RI->eraseFromParent();
+ RI->eraseFromBundle();
return true;
}
@@ -315,7 +318,8 @@
// Scan the block for two S_SET_GPR_IDX_ON instructions to see if a
// second is not needed. Do expensive checks in the optimizeSetGPR()
// and limit the distance to 20 instructions for compile time purposes.
- for (MachineBasicBlock::iterator MBBI = MBB.begin(); MBBI != MBBE; ) {
+ for (MachineBasicBlock::instr_iterator MBBI = MBB.instr_begin();
+ MBBI != MBBE;) {
MachineInstr &MI = *MBBI;
++MBBI;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98940.331827.patch
Type: text/x-patch
Size: 1392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210319/06dc54c3/attachment.bin>
More information about the llvm-commits
mailing list