diff options
author | Hal Finkel <hfinkel@anl.gov> | 2015-08-31 07:51:36 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2015-08-31 07:51:36 +0000 |
commit | e0a28e54c7ddd918b3b01805c20369b6078e0ce0 (patch) | |
tree | 805a8a1b021636b959a52600802a01a56f948d04 /llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp | |
parent | d6fdc8b6857635d4a641fe355afdbbd27c5803d7 (diff) | |
download | bcm5719-llvm-e0a28e54c7ddd918b3b01805c20369b6078e0ce0.tar.gz bcm5719-llvm-e0a28e54c7ddd918b3b01805c20369b6078e0ce0.zip |
[AggressiveAntiDepBreaker] Check for EarlyClobber on defining instruction
AggressiveAntiDepBreaker was doing some EarlyClobber checking, but was not
checking that the register being potentially renamed was defined by an
early-clobber def where there was also a use, in that instruction, of the
register being considered as the target of the rename. Fixes PR24014.
llvm-svn: 246423
Diffstat (limited to 'llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp b/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp index 3ac5a440094..7ba67687922 100644 --- a/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp +++ b/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp @@ -689,6 +689,20 @@ bool AggressiveAntiDepBreaker::FindSuitableFreeRegisters( } } + // Also, we cannot rename 'Reg' to 'NewReg' if the instruction defining + // 'Reg' is an early-clobber define and that instruction also uses + // 'NewReg'. + for (const auto &Q : make_range(RegRefs.equal_range(Reg))) { + if (!Q.second.Operand->isDef() || !Q.second.Operand->isEarlyClobber()) + continue; + + MachineInstr *DefMI = Q.second.Operand->getParent(); + if (DefMI->readsRegister(NewReg, TRI)) { + DEBUG(dbgs() << "(ec)"); + goto next_super_reg; + } + } + // Record that 'Reg' can be renamed to 'NewReg'. RenameMap.insert(std::pair<unsigned, unsigned>(Reg, NewReg)); } |