This is an archive of the discontinued LLVM Phabricator instance.

[x86] X86ISelLowering zext(add_nuw(x, C)) --> add(zext(x), C_zext)
ClosedPublic

Authored by apilipenko on Aug 10 2016, 9:44 AM.

Details

Summary

Currently X86ISelLowering has a similar transformation for sexts:
sext(add_nsw(x, C)) --> add(sext(x), C_sext)
See D13757 for motivation.

In this change I extend this code to handle zexts as well.

Diff Detail

Repository
rL LLVM

Event Timeline

apilipenko updated this revision to Diff 67539.Aug 10 2016, 9:44 AM
apilipenko retitled this revision from to [x86] X86ISelLowering zext(add_nuw(x, C)) --> add(zext(x), C_zext).
apilipenko updated this object.
apilipenko added a reviewer: spatel.
apilipenko added a subscriber: llvm-commits.
spatel accepted this revision.Aug 10 2016, 1:21 PM
spatel edited edge metadata.

LGTM. See inline comment for one nit. Also, unless there's some reason to break this regression test off by itself, I'd prefer to add this test directly to the related test file (and rename the file so it's not inaccurate). Keeping the tests next to each other for context seems better to me.

lib/Target/X86/X86ISelLowering.cpp
30492 ↗(On Diff #67539)

This should be named 'NewExt' now for consistency.

This revision is now accepted and ready to land.Aug 10 2016, 1:21 PM
This revision was automatically updated to reflect the committed changes.
llvm/trunk/test/CodeGen/X86/add-ext.ll