This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Fold icmp ugt/ult (udiv i32 C2, X), C1
ClosedPublic

Authored by mcrosier on May 10 2016, 11:30 AM.

Diff Detail

Event Timeline

mcrosier updated this revision to Diff 56767.May 10 2016, 11:30 AM
mcrosier retitled this revision from to [InstCombine] Fold icmp ugt/ult (udiv i32 C2, X), C1.
mcrosier updated this object.
mcrosier added reviewers: majnemer, gberry.
mcrosier added a subscriber: llvm-commits.
majnemer added inline comments.May 10 2016, 11:57 AM
lib/Transforms/InstCombine/InstCombineCompares.cpp
2103–2106

What if C1 is -1? Won't this divide by zero?

majnemer accepted this revision.May 10 2016, 12:04 PM
majnemer edited edge metadata.

LGTM with nits.

lib/Transforms/InstCombine/InstCombineCompares.cpp
2103–2106

Ah, you have a test for this case, it is handled by InstSimplify.

Please add an assertion for this like you do for C1 != 0 below.

This revision is now accepted and ready to land.May 10 2016, 12:04 PM
This revision was automatically updated to reflect the committed changes.