[all-commits] [llvm/llvm-project] e9e016: [flang][HLFIR] Relax verifiers of intrinsic operat...

Tom Eccles via All-commits all-commits at lists.llvm.org
Thu Feb 1 02:23:36 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e9e01675a31969d5ae7c250caa6efcc8dcdb80bc
      https://github.com/llvm/llvm-project/commit/e9e01675a31969d5ae7c250caa6efcc8dcdb80bc
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2024-02-01 (Thu, 01 Feb 2024)

  Changed paths:
    M flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
    M flang/test/HLFIR/invalid.fir
    M flang/test/Lower/HLFIR/minval.f90

  Log Message:
  -----------
  [flang][HLFIR] Relax verifiers of intrinsic operations (#80132)

The verifiers are currently very strict: requiring intrinsic operations
to be used only in cases where the Fortran standard permits the
intrinsic to be used.

There have now been a lot of cases where these verifiers have caused
bugs in corner cases. In a recent ticket, @jeanPerier pointed out that
it could be useful for future optimizations if somewhat invalid uses of
these operations could be allowed in dead code. See this comment:
https://github.com/llvm/llvm-project/issues/79995#issuecomment-1918118234

In response to all of this, I have decided to relax the intrinsic
operation verifiers. The intention is now to only disallow operation
uses that are likely to crash the compiler. Other checks are still
available under `-strict-intrinsic-verifier`.

The disadvantage of this approach is that IR can now represent intrinsic
invocations which are incorrect. The lowering and implementation of
these intrinsic functions is unlikely to do the right thing in all of
these cases, and as they should mostly be impossible to generate using
normal Fortran code, these edge cases will see very little testing,
before some new optimization causes them to become more common.

Fixes #79995




More information about the All-commits mailing list