This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Test cases for D154937
ClosedPublic

Authored by 0xdc03 on Jul 11 2023, 3:08 AM.

Details

Summary

Create test cases for the following two folds:

(icmp eq X, C) | (icmp ult Other, (X - C)) -> (icmp ule Other, (X - (C + 1)))
(icmp ne X, C) & (icmp uge Other, (X - C)) -> (icmp ugt Other, (X - (C + 1)))

Diff Detail

Event Timeline

0xdc03 created this revision.Jul 11 2023, 3:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2023, 3:08 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
0xdc03 requested review of this revision.Jul 11 2023, 3:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2023, 3:08 AM
0xdc03 updated this revision to Diff 539013.Jul 11 2023, 4:05 AM
  • Remove unnecessary tests
  • Fix typo: 'vetor' -> 'vector'
  • Fix commuted test cases
nikic accepted this revision.Jul 11 2023, 6:38 AM

LGTM

llvm/test/Transforms/InstCombine/and-or-icmp-const-icmp.ll
504

I'd personally save a lot of these tests -- generally we want to see one test of each "kind", but not every possible combination. So a test for eq, ne, vectors and mismatched constants each, rather than all 8 combinations of eq/ne, scalar/vector and matching/mismatching for example.

This revision is now accepted and ready to land.Jul 11 2023, 6:38 AM
0xdc03 updated this revision to Diff 539083.Jul 11 2023, 7:12 AM
  • Reduce test count to half
0xdc03 marked an inline comment as done.Jul 11 2023, 7:13 AM
0xdc03 added inline comments.
llvm/test/Transforms/InstCombine/and-or-icmp-const-icmp.ll
504

That's a great idea, I have halved the test count by interpolating the eq and ne tests :)

0xdc03 marked an inline comment as done.Jul 11 2023, 7:14 AM
0xdc03 updated this revision to Diff 539098.Jul 11 2023, 7:45 AM
  • Add an undef splat vector test
This revision was automatically updated to reflect the committed changes.