Page MenuHomePhabricator

[InstCombine] Inefficient pattern for high-bits checking (PR38708)
ClosedPublic

Authored by lebedev.ri on Sep 12 2018, 7:21 AM.

Details

Summary

It is sometimes important to check that some newly-computed value
is non-negative and only n bits wide (where n is a variable.)
There are many ways to check that:
https://godbolt.org/z/o4RB8D
The last variant seems best?
(I'm sure there are some other variations i haven't thought of..)

Let's handle the second variant first, since it is much simpler.
https://rise4fun.com/Alive/LYjY

https://bugs.llvm.org/show_bug.cgi?id=38708

Diff Detail

Repository
rL LLVM

Event Timeline

lebedev.ri created this revision.Sep 12 2018, 7:21 AM
spatel accepted this revision.Sep 12 2018, 10:59 AM

LGTM

This revision is now accepted and ready to land.Sep 12 2018, 10:59 AM

LGTM

Thank you for the review!

This revision was automatically updated to reflect the committed changes.