llvm-project
5a389d38 - [ValueTracking] Treat fmul NaN sign bit as unknown to prevent incorrect fabs folding (#180339)

Commit
4 days ago
[ValueTracking] Treat fmul NaN sign bit as unknown to prevent incorrect fabs folding (#180339) ### Summary ValueTracking currently allows InstSimplify to reason about the sign bit of an `fmul` result based on the sign information of its operands. This can lead to removing a subsequent `llvm.fabs` under the assumption that the multiplication result is already non-negative. However, `fmul` may produce NaNs whose sign bit is non-deterministic. Since `llvm.fabs` canonicalizes the sign bit of NaNs, eliminating llvm.fabs` in these cases can change observable behaviour. ### Change Update ValueTracking to treat the sign bit of `fmul` as unknown when NaNs are possible, preventing InstSimplify from incorrectly removing llvm.fabs ` after `fmul`. Fixes #179613
Parents
Loading