Unsigned shift of signed value during optimized signed divide that is only valid because of additional multiplication fails to simplify #4366
Labels
Component: Core
Issue needs changes to the core
Core: HLIL
Issue involves High Level IL
Effort: Low
Issue should take < 1 week
IL Optimization
Issue involving optimization of representation (not correctness)
Impact: Low
Issue is a papercut or has a good, supported workaround
Type: Enhancement
Issue is a small enhancement to existing functionality
Sometimes the compiler can emit a pattern for optimized modulus where the optimized division component of the modulus
is not valid on its own. It can use an unsigned shift by a small amount during a signed division, which normally would
cause the result to be incorrect, but it can be correct if that result is later multiplied by a value, causing all
values to produce the correct result.
Because Binary Ninja first simplifies the optimized divide, then simplifies the modulus, it cannot simplify the
expression at all.
Binary with examples:
unsigned_shift.zip
See 12, 24, 36, 48, and others.
The text was updated successfully, but these errors were encountered: