diff options
author | Andrew Trick <atrick@apple.com> | 2014-01-21 21:27:37 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2014-01-21 21:27:37 +0000 |
commit | 350ff2c084470a846bd652d5d4fc99413f65bfa4 (patch) | |
tree | 67c6bc10eafbb013a8d1d5568762c9b5e114285d /llvm/lib/CodeGen/MachineScheduler.cpp | |
parent | 83405928940e2377b4b852e3fb37e0dbfa0d73ca (diff) | |
download | llvm-350ff2c084470a846bd652d5d4fc99413f65bfa4.zip llvm-350ff2c084470a846bd652d5d4fc99413f65bfa4.tar.gz llvm-350ff2c084470a846bd652d5d4fc99413f65bfa4.tar.bz2 |
Fix PR18572 - llc crash during GenericScheduler::initPolicy().
Generalized the heuristic that looks at the (very rough) size of the
register file before enabling regpressure tracking.
llvm-svn: 199766
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineScheduler.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp index b1dd34bc..4812b30 100644 --- a/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/llvm/lib/CodeGen/MachineScheduler.cpp @@ -2531,10 +2531,16 @@ void GenericScheduler::initPolicy(MachineBasicBlock::iterator Begin, // Avoid setting up the register pressure tracker for small regions to save // compile time. As a rough heuristic, only track pressure when the number of // schedulable instructions exceeds half the integer register file. - unsigned NIntRegs = Context->RegClassInfo->getNumAllocatableRegs( - TM.getTargetLowering()->getRegClassFor(MVT::i32)); - - RegionPolicy.ShouldTrackPressure = NumRegionInstrs > (NIntRegs / 2); + RegionPolicy.ShouldTrackPressure = true; + unsigned LegalIntVT = MVT::i32; + for (; LegalIntVT > (unsigned)MVT::i1; --LegalIntVT) { + if (TM.getTargetLowering()->isTypeLegal((MVT::SimpleValueType)LegalIntVT)) { + unsigned NIntRegs = Context->RegClassInfo->getNumAllocatableRegs( + TM.getTargetLowering()->getRegClassFor( + (MVT::SimpleValueType)LegalIntVT)); + RegionPolicy.ShouldTrackPressure = NumRegionInstrs > (NIntRegs / 2); + } + } // For generic targets, we default to bottom-up, because it's simpler and more // compile-time optimizations have been implemented in that direction. |