This is an archive of the discontinued LLVM Phabricator instance.

Don't claim the udiv created in BypassSlowDivision is exact.
ClosedPublic

Authored by jlebar on Oct 28 2016, 1:58 PM.

Details

Summary

In BypassSlowDivision's short-dividend path, we would create e.g.

udiv exact i32 %a, %b

"exact" here means that we are asserting that %a is a multiple of %b.
But we have no reason to believe this must be true -- this is just a
bug, as far as I can tell.

Diff Detail

Repository
rL LLVM

Event Timeline

jlebar updated this revision to Diff 76242.Oct 28 2016, 1:58 PM
jlebar retitled this revision from to Don't claim the udiv created in BypassSlowDivision is exact..
jlebar updated this object.
jlebar added a reviewer: tra.
jlebar added a subscriber: llvm-commits.
hfinkel accepted this revision.Oct 28 2016, 2:11 PM
hfinkel added a reviewer: hfinkel.
hfinkel added a subscriber: hfinkel.

But we have no reason to believe this must be true -- this is just a bug, as far as I can tell.

I agree. All we know is that the truncation of the operands to the smaller type did not drop any set bits. That says nothing about the division having no remainder. LGTM.

This revision is now accepted and ready to land.Oct 28 2016, 2:11 PM
This revision was automatically updated to reflect the committed changes.

Thank you for the review!