llvm-project
037a48aa - [InstCombine] fold fabs(uitofp(i16 a) - uitofp(i16 b)) < 1.0 to a == b (#191378)

Commit
46 days ago
[InstCombine] fold fabs(uitofp(i16 a) - uitofp(i16 b)) < 1.0 to a == b (#191378) Fixes: https://github.com/llvm/llvm-project/issues/187088 When a and b are types with bitwidth (16 bits) smaller than the mantissa for float32 (24 bits), they will be exact and their absolute difference would be integral ±1 or greater if a != b. On the corollary, if their difference is < 1.0, this implies that a = b. This patch exploits this fact to fold the expression to just a single icmp.
Author
Parents
Loading