This is an archive of the discontinued LLVM Phabricator instance.

[TargetLowering] Fix propagation of undefs in zero extension ops (PR40091)
ClosedPublic

Authored by RKSimon on Dec 19 2018, 3:20 AM.

Details

Summary

As described on PR40091, we have several places where zext (and zext_vector_inreg) fold an undef input into an undef output. For zero extensions this incorrect as the output should guarantee to least have the new upper bits set to zero.

SimplifyDemandedVectorElts is the worst offender (and its the most likely to cause new undefs to appear) but DAGCombiner's tryToFoldExtendOfConstant has a similar issue.

Thanks to @dmgreen for catching this.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Dec 19 2018, 3:20 AM
andreadb accepted this revision.Dec 19 2018, 3:57 AM

LGTM

lib/CodeGen/SelectionDAG/TargetLowering.cpp
1852–1866 ↗(On Diff #178860)

You can probably try to merge this case with the previous one, since they have a lot of code in common.
That being said, I leave this decision to you. If you think it would make it less readable then it is fine to keep it like this.

This revision is now accepted and ready to land.Dec 19 2018, 3:57 AM
This revision was automatically updated to reflect the committed changes.