[all-commits] [llvm/llvm-project] 81c669: [flang] Prevent any non constant result extent to ...

jeanPerier via All-commits all-commits at lists.llvm.org
Wed Jan 19 10:16:29 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 81c66933292b8f7ea105122f39e0a06038744a88
      https://github.com/llvm/llvm-project/commit/81c66933292b8f7ea105122f39e0a06038744a88
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2022-01-19 (Wed, 19 Jan 2022)

  Changed paths:
    M flang/lib/Evaluate/shape.cpp
    M flang/test/Evaluate/rewrite01.f90

  Log Message:
  -----------
  [flang] Prevent any non constant result extent to be inlined on caller side

UBOUND, SIZE, and SHAPE folding was still creating expressions that are
invalid on the caller side without the call expression context.
A previous patch intended to deal with this situation (https://reviews.llvm.org/D116933)
but it assumed the return expression would be a descriptor inquiry to
the result symbol, which is not the case if the extent expression is
"scope invariant" inside the called subroutine (e.g., referring to
intent(in) dummy arguments). Simply prevent folding from inlining non
constant extent expression on the caller side.

Folding could be later improved by having ad-hoc folding for UBOUND, SIZE, and
SHAPE on function references where it could try replacing the dummy symbols
by the actual expression, but this is left as a possible later improvement.

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




More information about the All-commits mailing list