diff options
author | Matthias Braun <matze@braunis.de> | 2016-12-01 22:39:51 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2016-12-01 22:39:51 +0000 |
commit | 709a4cc2381d9c530331ba8ff9244628ae252727 (patch) | |
tree | c69cd7e0b496f23ac51d7342741c89fb1dcc11f3 /llvm/lib | |
parent | e7c0b2e0f81a0c810840dbd34739616895df4b2c (diff) | |
download | bcm5719-llvm-709a4cc2381d9c530331ba8ff9244628ae252727.tar.gz bcm5719-llvm-709a4cc2381d9c530331ba8ff9244628ae252727.zip |
RegisterCoalscer: Only coalesce complete reserved registers.
The coalescer eliminates copies from reserved registers of the form:
%vregX = COPY %rY
in the case where %rY is a reserved register. However this turns out to
be invalid if only some of the subregisters are reserved (see also
https://reviews.llvm.org/D26648).
Differential Revision: https://reviews.llvm.org/D26687
llvm-svn: 288428
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/RegisterCoalescer.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp index 9705efccb6e..d4f585515d6 100644 --- a/llvm/lib/CodeGen/RegisterCoalescer.cpp +++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp @@ -1571,11 +1571,17 @@ bool RegisterCoalescer::joinReservedPhysReg(CoalescerPair &CP) { // Deny any overlapping intervals. This depends on all the reserved // register live ranges to look like dead defs. if (!MRI->isConstantPhysReg(DstReg)) { - for (MCRegUnitIterator UI(DstReg, TRI); UI.isValid(); ++UI) + for (MCRegUnitIterator UI(DstReg, TRI); UI.isValid(); ++UI) { + // Abort if not all the regunits are reserved. + for (MCRegUnitRootIterator RI(*UI, TRI); RI.isValid(); ++RI) { + if (!MRI->isReserved(*RI)) + return false; + } if (RHS.overlaps(LIS->getRegUnit(*UI))) { DEBUG(dbgs() << "\t\tInterference: " << PrintRegUnit(*UI, TRI) << '\n'); return false; } + } } // Skip any value computations, we are not adding new values to the |