[llvm] r363716 - [TargetLowering] SimplifyDemandedBits - Cleanup ANY_EXTEND handling
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 11:22:30 PDT 2019
Author: rksimon
Date: Tue Jun 18 11:22:30 2019
New Revision: 363716
URL: http://llvm.org/viewvc/llvm-project?rev=363716&view=rev
Log:
[TargetLowering] SimplifyDemandedBits - Cleanup ANY_EXTEND handling
Match SIGN_EXTEND + ZERO_EXTEND handling - will be adding ANY_EXTEND_VECTOR_INREG support in a future patch.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=363716&r1=363715&r2=363716&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Tue Jun 18 11:22:30 2019
@@ -1440,12 +1440,18 @@ bool TargetLowering::SimplifyDemandedBit
break;
}
case ISD::ANY_EXTEND: {
+ // TODO: Add ISD::ANY_EXTEND_VECTOR_INREG support.
SDValue Src = Op.getOperand(0);
- unsigned InBits = Src.getScalarValueSizeInBits();
+ EVT SrcVT = Src.getValueType();
+ unsigned InBits = SrcVT.getScalarSizeInBits();
+ unsigned InElts = SrcVT.isVector() ? SrcVT.getVectorNumElements() : 1;
APInt InDemandedBits = DemandedBits.trunc(InBits);
- if (SimplifyDemandedBits(Src, InDemandedBits, Known, TLO, Depth + 1))
+ APInt InDemandedElts = DemandedElts.zextOrSelf(InElts);
+ if (SimplifyDemandedBits(Src, InDemandedBits, InDemandedElts, Known, TLO,
+ Depth + 1))
return true;
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
+ assert(Known.getBitWidth() == InBits && "Src width has changed?");
Known = Known.zext(BitWidth, false /* => any extend */);
break;
}
More information about the llvm-commits
mailing list