From: Dan Gohman Date: Wed, 28 Oct 2009 01:13:53 +0000 (+0000) Subject: Mark dead physregdefs dead immediately. This helps MachineSink and X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a104d1eab279a39ebf0481269426c2e2de8f5587;p=oota-llvm.git Mark dead physregdefs dead immediately. This helps MachineSink and MachineLICM and other things which run before LiveVariables is run. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85360 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/lib/CodeGen/SelectionDAG/InstrEmitter.cpp index d3ffb2a22d9..425f670763a 100644 --- a/lib/CodeGen/SelectionDAG/InstrEmitter.cpp +++ b/lib/CodeGen/SelectionDAG/InstrEmitter.cpp @@ -571,6 +571,8 @@ void InstrEmitter::EmitNode(SDNode *Node, bool IsClone, bool IsCloned, unsigned Reg = II.getImplicitDefs()[i - II.getNumDefs()]; if (Node->hasAnyUseOfValue(i)) EmitCopyFromReg(Node, i, IsClone, IsCloned, Reg, VRBaseMap); + else + MI->addRegisterDead(Reg, TRI); } } return; diff --git a/test/CodeGen/X86/sink-hoist.ll b/test/CodeGen/X86/sink-hoist.ll index 4042a095c6c..7f6366972a9 100644 --- a/test/CodeGen/X86/sink-hoist.ll +++ b/test/CodeGen/X86/sink-hoist.ll @@ -41,3 +41,18 @@ bb: return: ret void } + +; Sink instructions with dead EFLAGS defs. + +; CHECK: je +; CHECK-NEXT: orb + +define zeroext i8 @zzz(i8 zeroext %a, i8 zeroext %b) nounwind readnone { +entry: + %tmp = zext i8 %a to i32 ; [#uses=1] + %tmp2 = icmp eq i8 %a, 0 ; [#uses=1] + %tmp3 = or i8 %b, -128 ; [#uses=1] + %tmp4 = and i8 %b, 127 ; [#uses=1] + %b_addr.0 = select i1 %tmp2, i8 %tmp4, i8 %tmp3 ; [#uses=1] + ret i8 %b_addr.0 +}