]> granicus.if.org Git - llvm/commitdiff
TargetLowering::SimplifyDemandedBits - early-out for UNDEF ops. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 13 May 2019 12:44:03 +0000 (12:44 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 13 May 2019 12:44:03 +0000 (12:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360579 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/TargetLowering.cpp

index fc7e7d9c3ce460876ec0dc6a5d3491ff82e21d36..89298133a0d5e8d5a4c6f55631981de3b1cc2e99 100644 (file)
@@ -588,6 +588,10 @@ bool TargetLowering::SimplifyDemandedBits(
   // Don't know anything.
   Known = KnownBits(BitWidth);
 
+  // Undef operand.
+  if (Op.isUndef())
+    return false;
+
   if (Op.getOpcode() == ISD::Constant) {
     // We know all of the bits for a constant!
     Known.One = cast<ConstantSDNode>(Op)->getAPIntValue();
@@ -610,9 +614,7 @@ bool TargetLowering::SimplifyDemandedBits(
     DemandedElts = APInt::getAllOnesValue(NumElts);
   } else if (OriginalDemandedBits == 0 || OriginalDemandedElts == 0) {
     // Not demanding any bits/elts from Op.
-    if (!Op.isUndef())
-      return TLO.CombineTo(Op, TLO.DAG.getUNDEF(VT));
-    return false;
+    return TLO.CombineTo(Op, TLO.DAG.getUNDEF(VT));
   } else if (Depth == 6) { // Limit search depth.
     return false;
   }