From ee3f12e22972588cd054a310c3f891e20065f59b Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Mon, 13 May 2019 12:44:03 +0000 Subject: [PATCH] TargetLowering::SimplifyDemandedBits - early-out for UNDEF ops. NFCI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360579 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/TargetLowering.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index fc7e7d9c3ce..89298133a0d 100644 --- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -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(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; } -- 2.50.1