[all-commits] [llvm/llvm-project] 8a1ce2: [flang][codegen] Update FIR codegen to use mlir.ll...

jeanPerier via All-commits all-commits at lists.llvm.org
Wed Oct 25 00:42:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a1ce2d6c28fa04b446b9c78a6f4d9443aca4ef3
      https://github.com/llvm/llvm-project/commit/8a1ce2d6c28fa04b446b9c78a6f4d9443aca4ef3
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2023-10-25 (Wed, 25 Oct 2023)

  Changed paths:
    M flang/include/flang/Optimizer/CodeGen/TypeConverter.h
    M flang/lib/Optimizer/CodeGen/CodeGen.cpp
    M flang/lib/Optimizer/CodeGen/DescriptorModel.h
    M flang/lib/Optimizer/CodeGen/TypeConverter.cpp
    M flang/test/Fir/convert-to-llvm-openmp-and-fir.fir
    M flang/test/Fir/convert-to-llvm-target.fir
    M flang/test/Fir/convert-to-llvm.fir
    M flang/test/Fir/embox-char.fir
    M flang/test/Fir/embox-substring.fir
    M flang/test/Fir/external-mangling.fir
    M flang/test/Fir/omp-declare-target-data.fir
    M flang/test/Fir/rebox-susbtring.fir
    M flang/test/Fir/recursive-type.fir
    M flang/test/Fir/tbaa.fir
    M flang/test/Fir/types-to-llvm.fir
    M flang/test/Lower/OpenMP/FIR/flush.f90
    M flang/test/Lower/OpenMP/FIR/parallel-sections.f90
    M flang/test/Lower/OpenMP/FIR/parallel.f90

  Log Message:
  -----------
  [flang][codegen] Update FIR codegen to use mlir.llvm opaque pointers (#69692)

!llvm.ptr<T> typed pointers are depreciated in MLIR LLVM dialects. Flang
codegen still generated them and relied on mlir.llvm codegen to LLVM to
turn them into opaque pointers.

This patch update FIR codegen to directly emit and work with LLVM opaque
pointers.

Addresses https://github.com/llvm/llvm-project/issues/69303

- All places generating GEPs need to add an extra type argument with the
base type (the T that was previously in the llvm.ptr<T> of the base).

- llvm.alloca must also be provided the object type. In the process, I
doscovered that we were shamelessly copying all the attribute from
fir.alloca to the llvm.alloca, which makes no sense for the operand
segments. The updated code that cannot take an attribute dictionnary in
the llvm.alloca builder with opaque pointers only propagate the "pinned"
and "bindc_name" attributes to help debugging the generated IR.

- Updating all the places that rely on getting the llvm object type from
lowered llvm.ptr<T> arguments to get it from a type conversion of the
original fir types.

- Updating all the places that were generating llvm.ptr<T> types to
generate the opaque llvm.ptr type.

- Updating all the codegen tests checking generated MLIR llvm dialect.
Many tests are testing directly LLVM IR, and this change is a no-op for
those (which is expected).




More information about the All-commits mailing list