[flang-dev] MLIR LLVM-IR dialect -- status and lowering questions

Doerfert, Johannes via flang-dev flang-dev at lists.llvm.org
Mon Nov 25 16:20:02 PST 2019


(I BCC'ed flang-dev as they might be interested in this as well.)

Last week at SC we were discussing what the fastest and safest way to
get a working (=stable) F18 compiler is. Designing FIR and two (or
three) lowerings (AST -(1)-> FIR -(2)-> (MLIR LLVM-IR -(3)->) LLVM-IR)
seems to be something we want to end up eventually but it might not be
the fastest solution.

The options I'm currently evaluating wrt. complexity to stable solution,
and which I will discuss in more detail on the flang-dev list, are:
  1) AST -> LLVM-IR
  2) AST -> MLIR LLVM-IR -> LLVM-IR
  3) AST -> FIR -> MLIR LLVM-IR -> LLVM-IR

My questions/statements here are concerning the MLIR LLVM-IR dialect and
the lowerings to/from it, as well as the interplay of MLIR dialects and
LLVM-IR. I formulated some parts as statements and I would appreciate it
if you could comment on my understanding. If I missed the appropriate
documentation page, please forgive me.

1) Can I lower different dialects into LLVM-IR at the same time or do I
   need to lower to MLIR LLVM-IR first? When I ask if "I can do that" I
   mean if it is a use case that should conceptually work and also if it
   is already done by someone, thus actually working right now.
2) I browsed the LLVM-IR MLIR dialect and it looks like the
   instructions, attributes, etc. are hard coded, correct? (I mean we
   need to add them one by one to match LLVM-IR and keep them in-sync).
3) As far as I can tell,
   a) various instructions are present already (in their basic form,
      e.g., no nsw/nuw, inbounds, ...) but there seems to be some
      missing (switch was one I didn't find immediatly). Is there a
      list?
   c) I also did only find a handful of attributes (noalias & nosideeffect).
   d) Global symbols seems to be very restricted right now e.g.,
      variables are internal only, functions external, right?

I might have more questions but this seems to be a good starting point.

Thanks in advance,
  Johannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-dev/attachments/20191126/36e30ab8/attachment.sig>


More information about the flang-dev mailing list