diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-07-01 17:08:01 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-07-01 17:08:01 +0000 |
commit | 9c3d5a70f40f9e7bb90f3cb8ec1d87cff6e3f0ae (patch) | |
tree | 88824de000b5e42fd0e3cc787c771d415888da49 /lib/CodeGen/RegisterCoalescer.cpp | |
parent | 8f40f7b8676ae7931baaecb1046a21f09471384b (diff) | |
download | llvm-9c3d5a70f40f9e7bb90f3cb8ec1d87cff6e3f0ae.tar.gz llvm-9c3d5a70f40f9e7bb90f3cb8ec1d87cff6e3f0ae.tar.bz2 llvm-9c3d5a70f40f9e7bb90f3cb8ec1d87cff6e3f0ae.tar.xz |
Now that RegistersDefinedFromSameValue handles one instruction being an
implicit_def, the other instruction can be anything, including instructions
that define multiple values. Be careful about that and don't assume what operand
0 is.
Fixes pr13249.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159509 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegisterCoalescer.cpp')
-rw-r--r-- | lib/CodeGen/RegisterCoalescer.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp index 6ef098d1a1..733312fbd0 100644 --- a/lib/CodeGen/RegisterCoalescer.cpp +++ b/lib/CodeGen/RegisterCoalescer.cpp @@ -1175,28 +1175,18 @@ static bool RegistersDefinedFromSameValue(LiveIntervals &li, if (!MI || CP.isPartial() || CP.isPhys()) return false; - unsigned Dst = MI->getOperand(0).getReg(); - if (!TargetRegisterInfo::isVirtualRegister(Dst)) + unsigned A = CP.getDstReg(); + if (!TargetRegisterInfo::isVirtualRegister(A)) return false; - unsigned A = CP.getDstReg(); unsigned B = CP.getSrcReg(); - - if (B == Dst) - std::swap(A, B); - assert(Dst == A); + if (!TargetRegisterInfo::isVirtualRegister(B)) + return false; MachineInstr *OtherMI = li.getInstructionFromIndex(OtherVNI->def); - if (!OtherMI) return false; - unsigned OtherDst = OtherMI->getOperand(0).getReg(); - if (!TargetRegisterInfo::isVirtualRegister(OtherDst)) - return false; - - assert(OtherDst == B); - if (MI->isImplicitDef()) { DupCopies.push_back(MI); return true; |