-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Closed
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization
Description
Consider the following:
#include <cmath>
double f1(double x)
{
return pow(x, 2) / pow(x, 1);
}
double f2(double x)
{
return pow(x, 3) / pow(x, 1);
}
https://godbolt.org/z/jjKE5n8o1
If -Ofast
is specified, GCC just calculates x * x
for f2
, but Clang performs floating-point division.
When I lower the version to Clang 14.0.0, it behaves as expected, has anything changed?
Metadata
Metadata
Assignees
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization