This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Test cases for D154206
ClosedPublic

Authored by 0xdc03 on Jul 3 2023, 6:19 AM.

Details

Summary

Create a test case to test the fold for the expression pattern
'usub_sat(X, C) pred C2'.

Diff Detail

Event Timeline

0xdc03 created this revision.Jul 3 2023, 6:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 3 2023, 6:19 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
0xdc03 requested review of this revision.Jul 3 2023, 6:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 3 2023, 6:19 AM
0xdc03 updated this revision to Diff 537252.Jul 5 2023, 1:01 AM
  • Rebase on main
nikic added inline comments.Jul 5 2023, 1:29 AM
llvm/test/Transforms/InstCombine/icmp-usub-sat.ll
54

ult 1 is eq 0 which is a special case. I'd adjust the constant to be 2 here.

179

Pick different constants so it's not always false?

258

The standard pattern for multi-use tests is call void @use(i8 %sub). Avoids any funny folds.

277

As you don't allow multi-use folds, it's enough to have a single test to cover this -- there's no much in point in having 10 tests that all show the same thing.

0xdc03 updated this revision to Diff 537282.Jul 5 2023, 3:10 AM
  • Address reviewer comments
    • Fix cases which return true/false/zeroinitializer
    • Fix (and remove a lot of) multi-use tests
    • Reorganize some cases
0xdc03 marked 4 inline comments as done.Jul 5 2023, 3:10 AM

Hopefully this fixes everything.

nikic accepted this revision.Jul 5 2023, 5:05 AM

LGTM

This revision is now accepted and ready to land.Jul 5 2023, 5:05 AM
This revision was automatically updated to reflect the committed changes.