[all-commits] [llvm/llvm-project] 9e1395: [flang] Make a descriptor copy for fir.load fir.re...

jeanPerier via All-commits all-commits at lists.llvm.org
Tue Sep 13 23:57:05 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e1395ef14144a6cde5255f7dec9d72b6ca74e4b
      https://github.com/llvm/llvm-project/commit/9e1395ef14144a6cde5255f7dec9d72b6ca74e4b
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2022-09-14 (Wed, 14 Sep 2022)

  Changed paths:
    M flang/lib/Optimizer/CodeGen/CodeGen.cpp
    M flang/test/Fir/convert-to-llvm.fir

  Log Message:
  -----------
  [flang] Make a descriptor copy for fir.load fir.ref<fir.box>

`fir.box` and `fir.ref<fir.box>` are both lowered to LLVM as a
descriptor in memory. This is because fir.box of polymorphic and assumed
rank entities cannot be known at compile time, so fir.box cannot be
lowered to a struct value.

fir.load or fir.ref<fir.box> was previously lowered to a no-op,
propagating the operand descriptor storage as a result.
This is wrong because the operand descriptor storage may later be
modified, and these changes should not be visible in the loaded fir.box
that is an immutable SSA value.

Modify fir.load codegen for fir.box to make a copy into a new storage to
ensure the fir.box is immutable.

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




More information about the All-commits mailing list