[TargetLowering] SimplifyDemandedVectorElts - don't alter DemandedElts mask

Fix potential issue with the ISD::INSERT_VECTOR_ELT case tweaking the DemandedElts mask instead of using a local copy - so later uses of the mask use the tweaked version.....

Noticed while investigating adding zero/undef folding to SimplifyDemandedVectorElts and the altered DemandedElts mask was causing mismatches.

llvm-svn: 348348
This commit is contained in:
Simon Pilgrim 2018-12-05 10:37:45 +00:00
parent 8a1b4f57c9
commit d24730cdda
1 changed files with 3 additions and 2 deletions

View File

@ -1614,9 +1614,10 @@ bool TargetLowering::SimplifyDemandedVectorElts(
unsigned Idx = CIdx->getZExtValue();
if (!DemandedElts[Idx])
return TLO.CombineTo(Op, Vec);
DemandedElts.clearBit(Idx);
if (SimplifyDemandedVectorElts(Vec, DemandedElts, KnownUndef,
APInt DemandedVecElts(DemandedElts);
DemandedVecElts.clearBit(Idx);
if (SimplifyDemandedVectorElts(Vec, DemandedVecElts, KnownUndef,
KnownZero, TLO, Depth + 1))
return true;