A <= -1 constant on a compare can be converted to a < 0 operation, which is usually cheap. If we mark the constant as cheap, preventing hoisting, we allow that fold to happen even across different blocks.
Details
Details
Diff Detail
Diff Detail
Event Timeline
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp | ||
---|---|---|
385 | Can this be applied to any integer less than the maximum for the type (e.g. <= 6 to < 7) rather than just <= -1 to < 0? |
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp | ||
---|---|---|
385 | Yep! I originally had it that way, but unfortunately it led to more regressions. The combiner didn't always handle the constants better to actually produce smaller code. The 0/-1 case should be the most common, I believe, and is at least the motivating case I have. |
Can this be applied to any integer less than the maximum for the type (e.g. <= 6 to < 7) rather than just <= -1 to < 0?