This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Add new tests in preparation for a combine of icmp (mul nsw/nuw X, C2), C
ClosedPublic

Authored by Nicola on Sep 4 2018, 6:06 AM.

Details

Summary

I'll also open a review for the new combine in InstCombine after this is submitted

Alive proofs for the combines I want to add:

ult/slt https://rise4fun.com/Alive/DJg
ugt/sgt https://rise4fun.com/Alive/2RBn
eq/ne   https://rise4fun.com/Alive/iUsl

Diff Detail

Repository
rL LLVM

Event Timeline

Nicola created this revision.Sep 4 2018, 6:06 AM

Does this contain negative tests, that should not be folded?

Nicola updated this revision to Diff 163999.Sep 5 2018, 3:10 AM

Added some negative tests

spatel accepted this revision.Sep 5 2018, 7:25 AM

LGTM - the tests can be enhanced as we add/evolve the code for these folds.

I didn't look at all of the proofs, but at least for this pair, we can simplify the pre-conditions:
https://rise4fun.com/Alive/plgd

Also, for unsigned math, I think you want to use Alive's unsigned notation to match how the transforms will be coded:
https://rise4fun.com/Alive/nE9

Getting the pre-conditions right looks tricky, so I think it will be best to introduce the transforms for these 1 or 2 patterns at a time, so we can be sure we get each case right.

This revision is now accepted and ready to land.Sep 5 2018, 7:25 AM
This revision was automatically updated to reflect the committed changes.