[all-commits] [llvm/llvm-project] 74438e: [mlir] Use thread_local stack in LLVM dialect type...

ftynse via All-commits all-commits at lists.llvm.org
Wed Jan 6 03:10:22 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 74438eff511e71dc33841546d89cb34206551d55
      https://github.com/llvm/llvm-project/commit/74438eff511e71dc33841546d89cb34206551d55
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2021-01-06 (Wed, 06 Jan 2021)

  Changed paths:
    M mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp
    M mlir/test/Dialect/LLVMIR/types-invalid.mlir
    M mlir/test/Dialect/LLVMIR/types.mlir

  Log Message:
  -----------
  [mlir] Use thread_local stack in LLVM dialect type parsing and printing

LLVM dialect type parsing and printing have been using a local stack object
forwarded between recursive functions responsible for parsing or printing
specific types. This stack is necessary to intercept (mutually) recursive
structure types and avoid inifinite recursion. This approach works only thanks
to the closedness of the LLVM dialect type system: types that don't belong to
the dialect are not allowed. Switch the approach to using a `thread_local`
stack inside the functions parsing the structure types. This makes the code
slightly cleaner by avoiding the need to pass the stack object around and, more
importantly, makes it possible to reconsider the closedness of the LLVM dialect
type system. As a nice side effect of this change, container LLVM dialect types
now support type aliases in their body (although it is currently impossible to
also use the alises when printing).

Depends On D93713

Reviewed By: mehdi_amini

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




More information about the All-commits mailing list