From: Quentin Colombet Date: Tue, 26 Apr 2016 23:14:29 +0000 (+0000) Subject: [MachineBasicBlock] Take advantage of the partially dead information. X-Git-Tag: llvmorg-3.9.0-rc1~7861 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=08e79990a0a8c40e1ebed0b8f90f993ea792cac7;p=platform%2Fupstream%2Fllvm.git [MachineBasicBlock] Take advantage of the partially dead information. Thanks to that information we wouldn't lie on a register being live whereas it is not. llvm-svn: 267622 --- diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 8b3f01f..58e71bb 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -1208,8 +1208,15 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI, if (Info.DeadDef) return LQR_Dead; // Register is (at least partially) live after a def. - if (Info.Defined) - return LQR_Live; + if (Info.Defined) { + if (!Info.PartialDeadDef) + return LQR_Live; + // As soon as we saw a partial definition (dead or not), + // we cannot tell if the value is partial live without + // tracking the lanemasks. We are not going to do this, + // so fall back on the remaining of the analysis. + break; + } // Register is dead after a full kill or clobber and no def. if (Info.Killed || Info.Clobbered) return LQR_Dead; diff --git a/llvm/test/CodeGen/X86/cmpxchg-clobber-flags.ll b/llvm/test/CodeGen/X86/cmpxchg-clobber-flags.ll index 74599cb..f2b9dee 100644 --- a/llvm/test/CodeGen/X86/cmpxchg-clobber-flags.ll +++ b/llvm/test/CodeGen/X86/cmpxchg-clobber-flags.ll @@ -167,11 +167,10 @@ define i32 @test_feed_cmov(i32* %addr, i32 %desired, i32 %new) { ; x8664-sahf-LABEL: test_feed_cmov: ; x8664-sahf: cmpxchgl -; x8664-sahf: pushq %rax +; RAX is dead, do not push or pop it. ; x8664-sahf-NEXT: seto %al ; x8664-sahf-NEXT: lahf ; x8664-sahf-NEXT: movq %rax, [[FLAGS:%.*]] -; x8664-sahf-NEXT: popq %rax ; x8664-sahf-NEXT: callq foo ; x8664-sahf-NEXT: pushq %rax ; x8664-sahf-NEXT: movq [[FLAGS]], %rax