[flang-commits] [flang] [flang] Add hlfir.index op to represent index intrinsic function (PR #157575)

via flang-commits flang-commits at lists.llvm.org
Tue Sep 9 02:17:10 PDT 2025


https://github.com/jeanPerier commented:

Thanks, this looks great! A few comments inline.

>   is much more efficient in a case of presence of the 'kind' intrinsic parameter.

Indeed, the INDEX lowering code in IntrinsicCall.cpp is needlessly complex when KIND is present while KIND does not matter at all as far as lowering is concerned (semantics did the work). INDEX seems to be one of the first "non trivial" intrinsic that was implemented...

While an hlfir.index was not needed just to fix this (just always using fir::runtime::genIndex would have work), I like adding an hlfir.index operation given there are other INDEX related optimizations that will be a lot easier to do at that level.

https://github.com/llvm/llvm-project/pull/157575


More information about the flang-commits mailing list