This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Don't transform ((C1 OP zext(X)) & C2) -> zext((C1 OP X) & C2) if either zext or OP has another use.
ClosedPublic

Authored by craig.topper on Mar 20 2019, 10:19 PM.

Details

Summary

If they have other users we'll just end up increasing the instruction count.

We might be able to weaken this to only one of them having a single use if we can prove that the and will be removed.

Fixes PR41164.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Mar 20 2019, 10:19 PM
spatel accepted this revision.Mar 21 2019, 6:40 AM

LGTM - could you add a TODO comment here about using m_APInt() instead of m_ConstantInt()...there's no reason to limit this to scalars AFAICT.

This revision is now accepted and ready to land.Mar 21 2019, 6:40 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2019, 10:50 AM