[PATCH] D12460: AMDGPU/SI: Fix creating v_mov_b32s without exec uses
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 30 19:24:56 PDT 2015
arsenm updated this revision to Diff 33554.
arsenm added a comment.
Fix conflict with trunk from moving into separate function
http://reviews.llvm.org/D12460
Files:
lib/Target/AMDGPU/SIFoldOperands.cpp
Index: lib/Target/AMDGPU/SIFoldOperands.cpp
===================================================================
--- lib/Target/AMDGPU/SIFoldOperands.cpp
+++ lib/Target/AMDGPU/SIFoldOperands.cpp
@@ -189,6 +189,7 @@
static void foldOperand(MachineOperand &OpToFold, MachineInstr *UseMI,
unsigned UseOpIdx,
std::vector<FoldCandidate> &FoldList,
+ SmallVectorImpl<MachineInstr *> &CopiesToReplace,
const SIInstrInfo *TII, const SIRegisterInfo &TRI,
MachineRegisterInfo &MRI) {
const MachineOperand &UseOp = UseMI->getOperand(UseOpIdx);
@@ -242,6 +243,7 @@
return;
UseMI->setDesc(TII->get(MovOp));
+ CopiesToReplace.push_back(UseMI);
}
}
@@ -307,17 +309,27 @@
OpToFold.getSubReg()))
continue;
+
+ // We need mutate the operands of new mov instructions to add implicit
+ // uses of EXEC, but adding them invalidates the use_iterator, so defer
+ // this.
+ SmallVector<MachineInstr *, 4> CopiesToReplace;
+
std::vector<FoldCandidate> FoldList;
for (MachineRegisterInfo::use_iterator
Use = MRI.use_begin(MI.getOperand(0).getReg()), E = MRI.use_end();
Use != E; ++Use) {
MachineInstr *UseMI = Use->getParent();
foldOperand(OpToFold, UseMI, Use.getOperandNo(), FoldList,
- TII, TRI, MRI);
+ CopiesToReplace, TII, TRI, MRI);
}
+ // Make sure we add EXEC uses to any new v_mov instructions created.
+ for (MachineInstr *Copy : CopiesToReplace)
+ Copy->addImplicitDefUseOperands(MF);
+
for (FoldCandidate &Fold : FoldList) {
if (updateOperand(Fold, TRI)) {
// Clear kill flags.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12460.33554.patch
Type: text/x-patch
Size: 1819 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150831/2e5e0804/attachment.bin>
More information about the llvm-commits
mailing list