[all-commits] [llvm/llvm-project] 9f3565: [flang] Lower Fortran math intrinsic operations in...

Slava Zakharin via All-commits all-commits at lists.llvm.org
Tue Jun 28 13:38:07 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9f35657983c5f8370f276156f0351f98ae5296bf
      https://github.com/llvm/llvm-project/commit/9f35657983c5f8370f276156f0351f98ae5296bf
  Author: Slava Zakharin <szakharin at nvidia.com>
  Date:   2022-06-28 (Tue, 28 Jun 2022)

  Changed paths:
    M flang/include/flang/Optimizer/Support/InitFIR.h
    M flang/lib/Lower/IntrinsicCall.cpp
    M flang/lib/Optimizer/CodeGen/CMakeLists.txt
    M flang/lib/Optimizer/CodeGen/CodeGen.cpp
    A flang/test/Intrinsics/late-math-codegen.fir
    M flang/test/Lower/Intrinsics/exp.f90
    M flang/test/Lower/Intrinsics/log.f90
    M flang/test/Lower/Intrinsics/math-runtime-options.f90
    M flang/test/Lower/array-expression-slice-1.f90
    A flang/test/Lower/late-math-lowering.f90
    M flang/test/Lower/llvm-math.f90
    M flang/test/Lower/sqrt.f90
    M flang/test/Lower/trigonometric-intrinsics.f90

  Log Message:
  -----------
  [flang] Lower Fortran math intrinsic operations into MLIR ops or libm calls.

Added new -lower-math-early option that defaults to 'true' that matches
the current math lowering scheme. If set to 'false', the intrinsic math
operations will be lowered to MLIR operations, which should potentially
enable more MLIR optimizations, or libm calls, if there is no corresponding
MLIR operation exists or if "precise" mode is requested.
The generated math MLIR operations are then converted to LLVM dialect
during codegen phase.

The -lower-math-early option is not exposed to users currently. I plan to
get rid of the "early" lowering completely, when "late" lowering
is robust enough to support all math intrinsics that are currently
supported via pgmath. So "late" mode will become default and -lower-math-early
option will not be needed. This will effectively eliminate the mandatory
dependency on pgmath in Fortran lowering, but this is WIP.

Differential Revision: https://reviews.llvm.org/D128385




More information about the All-commits mailing list