[llvm] [InstCombine] Add log-pow simplification for FP exponent edge case. (PR #76641)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 20:37:58 PST 2024


================
@@ -12,6 +12,75 @@ define double @log_pow(double %x, double %y) {
   ret double %log
 }
 
+define double @log_powi_const(double %x) {
+; CHECK-LABEL: @log_powi_const(
+; CHECK-NEXT:    [[LOG1:%.*]] = call fast double @llvm.log.f64(double [[X:%.*]])
----------------
arsenm wrote:

The math library function and intrinsic situation is a bit of a mess, and we kind of try to solve the same issue in 2-3 different places. Clang both swaps out the intrinsic for the libcall based on -fno-math-errno, and codegen also tries to specially recognize libcall+readnone callsites as ignore-errno. 

Ideally here we could perform the transform from libcall->libcall and intrinsic->intrinsic, but should avoid mutating between the two 

https://github.com/llvm/llvm-project/pull/76641


More information about the llvm-commits mailing list