summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2019-02-21 15:48:13 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2019-02-21 15:48:13 +0000
commit8df2f3dab203acbb84e6a9c88433f13fc62d573d (patch)
treec8a5be1a7d3658cf188b4cabaa1cec969422656d
parente1cbabaff0498efb40ff1f96c32fe95adbc8a49e (diff)
downloadbcm5719-llvm-8df2f3dab203acbb84e6a9c88433f13fc62d573d.tar.gz
bcm5719-llvm-8df2f3dab203acbb84e6a9c88433f13fc62d573d.zip
RegBankSelect: Allow targets to introduce control flow for mapping
For AMDGPU, if an operand requires an SGPR but is only available as a VGPR, a loop needs to be introduced to execute the instruction with each unique combination of values across all lanes. The rest of the instructions in the block will be moved to a new block following the loop. Check if the next instruction's parent changed, and update the iterators and insertion block if this happened. Tests will be included in a future patch. llvm-svn: 354591
-rw-r--r--llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
index 2c231709240..bd0c141c298 100644
--- a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
@@ -692,8 +692,21 @@ bool RegBankSelect::runOnMachineFunction(MachineFunction &MF) {
"unable to map instruction", MI);
return false;
}
+
+ // It's possible the mapping changed control flow, and moved the following
+ // instruction to a new block, so figure out the new parent.
+ if (MII != End) {
+ MachineBasicBlock *NextInstBB = MII->getParent();
+ if (NextInstBB != MBB) {
+ LLVM_DEBUG(dbgs() << "Instruction mapping changed control flow\n");
+ MBB = NextInstBB;
+ MIRBuilder.setMBB(*MBB);
+ End = MBB->end();
+ }
+ }
}
}
+
OptMode = SaveOptMode;
return false;
}
OpenPOWER on IntegriCloud