[TargetLowering] SimplifyDemandedBits - don't use OriginalDemanded variables in analysis.

These might have been replaced in multiple use cases.

llvm-svn: 362322
This commit is contained in:
Simon Pilgrim 2019-06-02 10:12:55 +00:00
parent 30a6caa3e7
commit 88522ce388
1 changed files with 5 additions and 5 deletions

View File

@ -676,27 +676,27 @@ bool TargetLowering::SimplifyDemandedBits(
// If index isn't constant, assume we need all vector elements AND the // If index isn't constant, assume we need all vector elements AND the
// inserted element. // inserted element.
APInt DemandedVecElts(OriginalDemandedElts); APInt DemandedVecElts(DemandedElts);
if (CIdx && CIdx->getAPIntValue().ult(VecVT.getVectorNumElements())) { if (CIdx && CIdx->getAPIntValue().ult(VecVT.getVectorNumElements())) {
unsigned Idx = CIdx->getZExtValue(); unsigned Idx = CIdx->getZExtValue();
DemandedVecElts.clearBit(Idx); DemandedVecElts.clearBit(Idx);
// Inserted element is not required. // Inserted element is not required.
if (!OriginalDemandedElts[Idx]) if (!DemandedElts[Idx])
return TLO.CombineTo(Op, Vec); return TLO.CombineTo(Op, Vec);
} }
KnownBits KnownScl; KnownBits KnownScl;
unsigned NumSclBits = Scl.getScalarValueSizeInBits(); unsigned NumSclBits = Scl.getScalarValueSizeInBits();
APInt DemandedSclBits = OriginalDemandedBits.zextOrTrunc(NumSclBits); APInt DemandedSclBits = DemandedBits.zextOrTrunc(NumSclBits);
if (SimplifyDemandedBits(Scl, DemandedSclBits, KnownScl, TLO, Depth + 1)) if (SimplifyDemandedBits(Scl, DemandedSclBits, KnownScl, TLO, Depth + 1))
return true; return true;
Known = KnownScl.zextOrTrunc(BitWidth, false); Known = KnownScl.zextOrTrunc(BitWidth, false);
KnownBits KnownVec; KnownBits KnownVec;
if (SimplifyDemandedBits(Vec, OriginalDemandedBits, DemandedVecElts, if (SimplifyDemandedBits(Vec, DemandedBits, DemandedVecElts, KnownVec, TLO,
KnownVec, TLO, Depth + 1)) Depth + 1))
return true; return true;
if (!!DemandedVecElts) { if (!!DemandedVecElts) {