[llvm] 4576606 - [X86] Remove unnecessary isNullConstant in LowerSelect. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 20 21:41:35 PST 2020


Author: Craig Topper
Date: 2020-02-20T21:41:13-08:00
New Revision: 457660683154014db4b649e852d152354844338a

URL: https://github.com/llvm/llvm-project/commit/457660683154014db4b649e852d152354844338a
DIFF: https://github.com/llvm/llvm-project/commit/457660683154014db4b649e852d152354844338a.diff

LOG: [X86] Remove unnecessary isNullConstant in LowerSelect. NFC

At this point in the code we know that Op1 or Op2 is
all ones. Y points to the other operand. In the case that
Op2 is zero, Op1 must be all ones and Y is Op2. The OR
ORs Y into Res. But if Y is 0 the OR will be folded away by
getNode so we don't need to check for it.

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 f0e40fd47de8..acb258b21f24 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -22526,9 +22526,7 @@ SDValue X86TargetLowering::LowerSELECT(SDValue Op, SelectionDAG &DAG) const {
       if (isAllOnesConstant(Op1) != (CondCode == X86::COND_E))
         Res = DAG.getNOT(DL, Res, Res.getValueType());
 
-      if (!isNullConstant(Op2))
-        Res = DAG.getNode(ISD::OR, DL, Res.getValueType(), Res, Y);
-      return Res;
+      return DAG.getNode(ISD::OR, DL, Res.getValueType(), Res, Y);
     } else if (!Subtarget.hasCMov() && CondCode == X86::COND_E &&
                Cmp.getOperand(0).getOpcode() == ISD::AND &&
                isOneConstant(Cmp.getOperand(0).getOperand(1))) {


        


More information about the llvm-commits mailing list