-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Open
Labels
constant-foldingProblems related to constant folding in the optimizerProblems related to constant folding in the optimizerfloating-pointFloating-point mathFloating-point math
Description
The LLVM constant folder evaluates llvm.powi.f64(double fC, i32 iC) as if it were pow(double fC, double fC2). This leads to a deviation from the value that would be returned if the expression were not constant folded.
I reproduced it here using C: https://godbolt.org/z/vT4YMYKne
For C maybe you can argue that this doesn't matter because the definition of __builtin_powi says that it makes no guarantees about precision (though I think users expect at least consistency). However, we can't assume that the intrinsic came from the C builtin, so I think this is a problem.
Metadata
Metadata
Assignees
Labels
constant-foldingProblems related to constant folding in the optimizerProblems related to constant folding in the optimizerfloating-pointFloating-point mathFloating-point math