Page MenuHomePhabricator

Fix *_EXTEND_VECTOR_INREG legalization
ClosedPublic

Authored by pirama on Oct 19 2016, 12:55 PM.

Details

Summary

While promoting *_EXTEND_VECTOR_INREG nodes whose inputs are already
promoted, perform the appropriate sign extension for the promoted node
before doing the *_EXTEND_VECTOR_INREG operation. If not, the undefined
high-order bits of the promoted operand may (a) be garbage inc ase of
zext) or (b) contribute the wrong sign-bit (in case of sext)

Updated the promote-vec3.ll test after this change. The diff shows
explicit zeroing in case of zext and intermediate sign extension in case
of sext.

Diff Detail

Repository
rL LLVM

Event Timeline

pirama updated this revision to Diff 75205.Oct 19 2016, 12:55 PM
pirama retitled this revision from to Fix *_EXTEND_VECTOR_INREG legalization.
pirama updated this object.
pirama added a reviewer: RKSimon.
pirama added subscribers: srhines, llvm-commits.
RKSimon added inline comments.Oct 19 2016, 1:11 PM
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
3366 ↗(On Diff #75205)

Either move the return into each case of the switch statement (to allow defaults to elegantly fall through) or provide an llvm_unreachable for default.

pirama updated this revision to Diff 75223.Oct 19 2016, 2:20 PM

Added a default case to the switch statement.

RKSimon accepted this revision.Oct 20 2016, 10:53 AM
RKSimon edited edge metadata.

LGTM

This revision is now accepted and ready to land.Oct 20 2016, 10:53 AM
This revision was automatically updated to reflect the committed changes.