[all-commits] [llvm/llvm-project] 52cc9d: [flang] Improve constant folding for type paramete...

Pete Steinfeld via All-commits all-commits at lists.llvm.org
Tue Apr 6 16:02:34 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 52cc9df1c14cf34dbfe491cf2b4079c920a2190e
      https://github.com/llvm/llvm-project/commit/52cc9df1c14cf34dbfe491cf2b4079c920a2190e
  Author: Peter Steinfeld <psteinfeld at nvidia.com>
  Date:   2021-04-06 (Tue, 06 Apr 2021)

  Changed paths:
    M flang/lib/Evaluate/fold-integer.cpp
    M flang/lib/Evaluate/formatting.cpp
    M flang/lib/Semantics/type.cpp
    M flang/test/Semantics/assign04.f90
    A flang/test/Semantics/resolve104.f90
    M flang/test/Semantics/resolve89.f90

  Log Message:
  -----------
  [flang] Improve constant folding for type parameter inquiries

We were not folding type parameter inquiries for the form 'var%typeParam'
where 'typeParam' was a KIND or LEN type parameter of a derived type and 'var'
was a designator of the derived type.  I fixed this by adding code to the
function 'FoldOperation()' for 'TypeParamInquiry's to handle this case.  I also
cleaned up the code for the case where there is no designator.

In order to make the error messages correctly refer to both the points of
declaration and instantiation, I needed to add an argument to the function
'InstantiateIntrinsicType()' for the location of the instantiation.

I also changed the formatting of 'TypeParamInquiry' to correctly format this
case.  I also added tests for both KIND and LEN type parameter inquiries in
resolve104.f90.

Making these changes revealed an error in resolve89.f90 and caused one of the
error messages in assign04.f90 to be different.

Reviewed By: klausler

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




More information about the All-commits mailing list