This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] precommit test for D152068(NFC)
ClosedPublic

Authored by khei4 on Jun 3 2023, 9:35 PM.

Diff Detail

Event Timeline

khei4 created this revision.Jun 3 2023, 9:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 3 2023, 9:35 PM
Herald added a subscriber: StephenFan. · View Herald Transcript
khei4 requested review of this revision.Jun 3 2023, 9:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 3 2023, 9:35 PM
nikic added inline comments.Jun 4 2023, 3:13 AM
llvm/test/Transforms/InstCombine/addsub-constant-folding.ll
135

For tests with overflowing constants, I'd recommend using i8 as it's easier to see what overflows and what doesn't at a glance.

151

Can also add nuw here to check that the right attribute presence is checked.

175

It would be good to have a test with non-splat vector constants (one with and one without overflow), as this fold supports them.

khei4 added inline comments.Jun 4 2023, 7:23 AM
llvm/test/Transforms/InstCombine/addsub-constant-folding.ll
175

Thank you for a good catch! I could find currently, i.e. C = <i8 1, i8 3>, C2 = <i8 -127, i8 -125>, bool WillNotSOV = willNotOverflowSignedSub(C, C2, I); would be false because computeOverflowForSignedSub can't check correctly, but each vector's maximum and minimum element range??

nikic added inline comments.Jun 4 2023, 7:27 AM
llvm/test/Transforms/InstCombine/addsub-constant-folding.ll
175

In that case, just leave a TODO in the test.

khei4 updated this revision to Diff 528263.Jun 4 2023, 8:17 PM

add splat vector tests

khei4 updated this revision to Diff 528265.Jun 4 2023, 8:28 PM

fix typo

khei4 updated this revision to Diff 528269.Jun 4 2023, 8:53 PM

Add nuw case and non-splat vector cases

khei4 updated this revision to Diff 528270.Jun 4 2023, 8:55 PM

fix wrong diff upload

nikic accepted this revision.Jun 4 2023, 11:49 PM
This revision is now accepted and ready to land.Jun 4 2023, 11:49 PM
This revision was landed with ongoing or failed builds.Jun 5 2023, 4:05 AM
This revision was automatically updated to reflect the committed changes.