Skip to content
Commit 224b1622 authored by Tobias Grosser's avatar Tobias Grosser
Browse files

Only convert power-of-two floor-division with non-negative denominator



floord(a,b) === a ashr log_2 (b) holds for positive and negative a's, but
shifting only makes sense for positive values of b. The previous patch did
not consider this as isl currently always produces postive b's. To avoid future
surprises, we check that b is positive and only then apply the optimization.

We also now correctly check the return value of the dyn-cast.

No additional test case, as isl currently does not produce negative
denominators.

Reported-by: default avatarDavid Majnemer <david.majnemer@gmail.com>
llvm-svn: 238927
parent aef6d17c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment