From 9b6fafa3990fb5963f0558d13d53abc461fb3f29 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 19 Dec 2019 20:41:02 -0800 Subject: [PATCH] [X86] Directly call EmitTest in two places instead of creating a null constant and calling EmitCmp. NFCI EmitCmp will just immediately call EmitTest and discard the null constant only to have EmitTest create it again if it doesn't fold. So just skip all that and go directly to EmitTest. --- llvm/lib/Target/X86/X86ISelLowering.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 63268bc..677dcab 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -21858,8 +21858,7 @@ SDValue X86TargetLowering::LowerSELECT(SDValue Op, SelectionDAG &DAG) const { if (AddTest) { CC = DAG.getTargetConstant(X86::COND_NE, DL, MVT::i8); - Cond = EmitCmp(Cond, DAG.getConstant(0, DL, Cond.getValueType()), - X86::COND_NE, DL, DAG); + Cond = EmitTest(Cond, X86::COND_NE, DL, DAG, Subtarget); } // a < b ? -1 : 0 -> RES = ~setcc_carry @@ -22580,8 +22579,7 @@ SDValue X86TargetLowering::LowerBRCOND(SDValue Op, SelectionDAG &DAG) const { if (addTest) { X86::CondCode X86Cond = Inverted ? X86::COND_E : X86::COND_NE; CC = DAG.getTargetConstant(X86Cond, dl, MVT::i8); - Cond = EmitCmp(Cond, DAG.getConstant(0, dl, Cond.getValueType()), - X86Cond, dl, DAG); + Cond = EmitTest(Cond, X86Cond, dl, DAG, Subtarget); } Cond = ConvertCmpIfNecessary(Cond, DAG); return DAG.getNode(X86ISD::BRCOND, dl, Op.getValueType(), -- 2.7.4