This is an archive of the discontinued LLVM Phabricator instance.

DAGCombine: Let truncates negate extension through extract-subvector
ClosedPublic

Authored by zvi on Jan 10 2018, 4:51 PM.

Details

Summary

Fold cases such as:
(v8i8 truncate (v8i32 extract_subvector (v16i32 sext (v16i8 V), Idx)))
->
(v8i8 extract_subvector (v16i8 V), Idx)

This can be generalized to cases where the truncate and extend do not
fully cancel each other out, but it may require querying the target
about profitability.

Event Timeline

zvi created this revision.Jan 10 2018, 4:51 PM
RKSimon accepted this revision.Jan 11 2018, 3:01 AM

LGTM - possibly add some explicit zext test cases as well?

This revision is now accepted and ready to land.Jan 11 2018, 3:01 AM
zvi updated this revision to Diff 129468.Jan 11 2018, 9:56 AM

Rebase after adding the missing zext cases

This revision was automatically updated to reflect the committed changes.