[all-commits] [llvm/llvm-project] ca3795: [flang] Fix printing of constc and parsing of #fi...

Diana via All-commits all-commits at lists.llvm.org
Fri Nov 19 01:30:17 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ca3795541f49d96371f75a307363baef59478786
      https://github.com/llvm/llvm-project/commit/ca3795541f49d96371f75a307363baef59478786
  Author: Diana Picus <diana.picus at linaro.org>
  Date:   2021-11-19 (Fri, 19 Nov 2021)

  Changed paths:
    M flang/lib/Optimizer/Dialect/FIRAttr.cpp
    M flang/lib/Optimizer/Dialect/FIROps.cpp
    M flang/test/Fir/fir-ops.fir

  Log Message:
  -----------
  [flang] Fix printing of constc and parsing of  #fir.real

Printing and parsing of constc didn't agree with each other. This patch
treats the parsing of constc as the final word and fixes the printing
accordingly.

More concretely, this patch prints the RealAttrs that make up the
ConstcOp directly instead of casting to mlir::FloatAttr (which blows
up). It also fixes parseFirRealAttr to invoke APFloat's method for
getting the size of a floating point type instead of computing it as
8 * kind (which blows up for BFloat, with kind == 3 and size == 16).

Kudos to Kiran Chandramohan <kiran.chandramohan at arm.com> for noticing
that we were missing tests for constc in fir-ops.fir.

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




More information about the All-commits mailing list