From: Evan Cheng Date: Fri, 10 Nov 2006 21:23:04 +0000 (+0000) Subject: Fix a bug in SelectScalarSSELoad. Since the load is wrapped in a X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=d6373bcd8232fe40fc4296a6f5e2d374b196bc6c;p=oota-llvm.git Fix a bug in SelectScalarSSELoad. Since the load is wrapped in a SCALAR_TO_VECTOR, even if the hasOneUse() check pass we may end up folding the load into two instructions. Make sure we check the SCALAR_TO_VECTOR has only one use as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31641 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86ISelDAGToDAG.cpp b/lib/Target/X86/X86ISelDAGToDAG.cpp index b8f54145722..68b89a4d160 100644 --- a/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -815,6 +815,7 @@ bool X86DAGToDAGISel::SelectScalarSSELoad(SDOperand Op, SDOperand Pred, InChain = N.getOperand(0).getValue(1); if (ISD::isNON_EXTLoad(InChain.Val) && InChain.getValue(0).hasOneUse() && + N.hasOneUse() && CanBeFoldedBy(N.Val, Pred.Val, Op.Val)) { LoadSDNode *LD = cast(InChain); if (!SelectAddr(Op, LD->getBasePtr(), Base, Scale, Index, Disp))