[llvm] 9b6fafa - [X86] Directly call EmitTest in two places instead of creating a null constant and calling EmitCmp. NFCI

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 23:04:13 PST 2019


Author: Craig Topper
Date: 2019-12-19T23:03:06-08:00
New Revision: 9b6fafa3990fb5963f0558d13d53abc461fb3f29

URL: https://github.com/llvm/llvm-project/commit/9b6fafa3990fb5963f0558d13d53abc461fb3f29
DIFF: https://github.com/llvm/llvm-project/commit/9b6fafa3990fb5963f0558d13d53abc461fb3f29.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 63268bc3c016..677dcab499a9 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(),


        


More information about the llvm-commits mailing list