From ba0e0664ff55752edae0b994f3a324cc3617c04b Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Mon, 24 Nov 2014 18:57:58 +0000 Subject: [PATCH] [AArch64] Fix clobber computation in A57LoadBalancing pass. Extremely difficult to reproduce, so no test case included. PR21637 llvm-svn: 222677 --- llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp b/llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp index 2503764..d4c742b 100644 --- a/llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp +++ b/llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp @@ -481,10 +481,16 @@ int AArch64A57FPLoadBalancing::scavengeRegister(Chain *G, Color C, RS.forward(I); AvailableRegs &= RS.getRegsAvailable(TRI->getRegClass(RegClassID)); - // Remove any registers clobbered by a regmask. + // Remove any registers clobbered by a regmask or any def register that is + // immediately dead. for (auto J : I->operands()) { if (J.isRegMask()) AvailableRegs.clearBitsNotInMask(J.getRegMask()); + + if (J.isReg() && J.isDef() && AvailableRegs[J.getReg()]) { + assert(J.isDead() && "Non-dead def should have been removed by now!"); + AvailableRegs.reset(J.getReg()); + } } } -- 2.7.4