summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/R600/AMDGPUTargetMachine.cpp
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2015-05-12 17:13:02 +0000
committerTom Stellard <thomas.stellard@amd.com>2015-05-12 17:13:02 +0000
commit28d13a4b1298eab01e90580d13e1d2589d848862 (patch)
tree955dd1c2f4853e54ab5f51a05746a6d330e0fdc8 /llvm/lib/Target/R600/AMDGPUTargetMachine.cpp
parent3acf6275e629caba57e061b01adaf5185d81ac61 (diff)
downloadbcm5719-llvm-28d13a4b1298eab01e90580d13e1d2589d848862.tar.gz
bcm5719-llvm-28d13a4b1298eab01e90580d13e1d2589d848862.zip
R600/SI: add pass to mark CF live ranges as non-spillable
Spilling can insert instructions almost anywhere, and this can mess up control flow lowering in a multitude of ways, due to instruction reordering. Let's sort this out the easy way: never spill registers involved with control flow, i.e. saved EXEC masks. Unfortunately, this does not work at all with optimizations disabled, as the register allocator ignores spill weights. This should be addressed in a future commit. The test was reduced from the "stacks" shader of [1]. Some issues trigger the machine verifier while another one is checked manually. [1] http://madebyevan.com/webgl-path-tracing/ v2: only insert pass with optimizations enabled, merge test runs. Patch by: Grigori Goronzy llvm-svn: 237152
Diffstat (limited to 'llvm/lib/Target/R600/AMDGPUTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/R600/AMDGPUTargetMachine.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Target/R600/AMDGPUTargetMachine.cpp b/llvm/lib/Target/R600/AMDGPUTargetMachine.cpp
index cb95835d2db..44c2abd294f 100644
--- a/llvm/lib/Target/R600/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/R600/AMDGPUTargetMachine.cpp
@@ -252,6 +252,15 @@ bool GCNPassConfig::addInstSelector() {
void GCNPassConfig::addPreRegAlloc() {
const AMDGPUSubtarget &ST = *getAMDGPUTargetMachine().getSubtargetImpl();
+
+ // This needs to be run directly before register allocation because
+ // earlier passes might recompute live intervals.
+ // TODO: handle CodeGenOpt::None; fast RA ignores spill weights set by the pass
+ if (getOptLevel() > CodeGenOpt::None) {
+ initializeSIFixControlFlowLiveIntervalsPass(*PassRegistry::getPassRegistry());
+ insertPass(&MachineSchedulerID, &SIFixControlFlowLiveIntervalsID);
+ }
+
if (getOptLevel() > CodeGenOpt::None && ST.loadStoreOptEnabled()) {
// Don't do this with no optimizations since it throws away debug info by
// merging nonadjacent loads.
OpenPOWER on IntegriCloud