[PATCH] D29897: [BypassSlowDivision] Use ValueTracking to simplify run-time checks
Nikolai Bozhenov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 20 10:56:10 PST 2017
n.bozhenov added a comment.
In https://reviews.llvm.org/D29897#681222, @jlebar wrote:
> When we see x/y, in addition to checking whether x and y are known "long", should we also check whether `x | y` is known-long? This way if we saw something like:
>
> if (x | y & 0xffffffff00000000) return x / y;
> else return static_cast<int32_t>(x) / static_cast<int32_t>(y);
>
>
> we wouldn't re-optimize this code.
I am afraid that ValueTracking doesn't work this way. It doesn't take into account the point where we analyze a value. So, unfortunately, it cannot yield different results on different if-branches for the same values.
In your example, if both branches may be taken, than (x|y) is neither known-long nor known-short. ValueTracking can determine that (x|y) is known-long only when the else-branch of the if-statement is statically known to be dead.
https://reviews.llvm.org/D29897
More information about the llvm-commits
mailing list