This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Add tests to show missing fold opportunity for "icmp and shift" (nfc).
ClosedPublic

Authored by huihuiz on Jun 7 2019, 1:11 PM.

Details

Summary

For icmp pred (and (sh X, Y), C), 0

  When C is signbit, expect to fold (X << Y) & signbit ==/!= 0 into (X << Y) >=/< 0,
  rather than (X & (signbit >> Y)) != 0.

  When C+1 is power of 2, expect to fold (X << Y) & ~C ==/!= 0 into (X << Y) </>= C+1,
  rather than (X & (~C >> Y)) == 0.

For icmp pred (and X, (sh signbit, Y)), 0

  Expect to fold (X & (signbit l>> Y)) ==/!= 0 into (X << Y) >=/< 0
  Expect to fold (X & (signbit << Y)) ==/!= 0 into (X l>> Y) >=/< 0

Diff Detail

Repository
rL LLVM

Event Timeline

huihuiz created this revision.Jun 7 2019, 1:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2019, 1:11 PM

D62818
Split D62818 into 4 differentials.

huihuiz updated this revision to Diff 204434.Jun 12 2019, 11:43 PM
huihuiz retitled this revision from [InstCombine] Add tests to show fold order is wrong for icmp pred (and (sh X, Y), C), 0. to [InstCombine] Add tests to show missing fold opportunity for "icmp and shift" (nfc)..
huihuiz edited the summary of this revision. (Show Details)
lebedev.ri accepted this revision.Jun 14 2019, 3:11 PM

Please land this, it can be adjusted later if needed.

This revision is now accepted and ready to land.Jun 14 2019, 3:11 PM
huihuiz closed this revision.Jun 14 2019, 5:38 PM

Merged

Hmm, which commit? Could you just use either arc patch, or manually add Differential Revision: <link> so that there is a reference between them?

Hmm, which commit? Could you just use either arc patch, or manually add Differential Revision: <link> so that there is a reference between them?

Hey @lebedev.ri , my apology for this confusion.
The Differential Revision: <link> was added in the commit message.

I did try using "arc patch D*" , but all the tests were added into a new directory , not under the "llvm/test/". So I used "git llvm push" instead.
the commit number is "llvm-svn: 363479"

Sorry about any confusion I might have caused.
Thank you so much again for all your review feedback, really appreciate it!