This is an archive of the discontinued LLVM Phabricator instance.

[CVP] When proving that @llvm.with.overflow()/@llvm.sat() don't overflow, also try to prove other no-wrap
ClosedPublic

Authored by lebedev.ri on Oct 18 2019, 10:23 AM.

Details

Summary

CVP, unlike InstCombine, does not run till exaustion.
It only does a single pass.

When dealing with those special binops, if we prove that they can
safely be demoted into their usual binop form,
we do set the no-wrap we deduced. But when dealing with usual binops,
we try to deduce both no-wraps.

So if we convert e.g. @llvm.uadd.with.overflow() to add nuw,
we won't attempt to check whether it can be add nuw nsw.

This patch proposes to call processBinOp() on newly-created binop.

Diff Detail

Event Timeline

lebedev.ri created this revision.Oct 18 2019, 10:23 AM
nikic accepted this revision.Oct 18 2019, 11:10 AM

LGTM, we already do the same for div/rem.

This revision is now accepted and ready to land.Oct 18 2019, 11:10 AM

LGTM

Thank you for the review.
I think i'll try to add no-wrap deduction for mul here next.

we already do the same for div/rem.

Ah, indeed, good point.

This revision was automatically updated to reflect the committed changes.