[all-commits] [llvm/llvm-project] d85eb4: [AsmParser] Introduce a new "Argument" abstraction...

Chris Lattner via All-commits all-commits at lists.llvm.org
Fri Apr 29 12:22:33 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d85eb4e2d62e51645922ec17678a319b3c7d872c
      https://github.com/llvm/llvm-project/commit/d85eb4e2d62e51645922ec17678a319b3c7d872c
  Author: Chris Lattner <clattner at nondot.org>
  Date:   2022-04-29 (Fri, 29 Apr 2022)

  Changed paths:
    M flang/lib/Optimizer/Dialect/FIROps.cpp
    M mlir/include/mlir/IR/FunctionImplementation.h
    M mlir/include/mlir/IR/OpImplementation.h
    M mlir/lib/Dialect/Affine/IR/AffineOps.cpp
    M mlir/lib/Dialect/Async/IR/Async.cpp
    M mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
    M mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
    M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
    M mlir/lib/Dialect/PDLInterp/IR/PDLInterp.cpp
    M mlir/lib/Dialect/SCF/SCF.cpp
    M mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
    M mlir/lib/IR/FunctionImplementation.cpp
    M mlir/lib/Parser/AttributeParser.cpp
    M mlir/lib/Parser/Parser.cpp
    M mlir/test/Dialect/GPU/invalid.mlir
    M mlir/test/IR/locations.mlir
    M mlir/test/lib/Dialect/Test/TestDialect.cpp

  Log Message:
  -----------
  [AsmParser] Introduce a new "Argument" abstraction + supporting logic

MLIR has a common pattern for "arguments" that uses syntax
like `%x : i32 {attrs} loc("sourceloc")` which is implemented
in adhoc ways throughout the codebase.  The approach this uses
is verbose (because it is implemented with parallel arrays) and
inconsistent (e.g. lots of things drop source location info).

Solve this by introducing OpAsmParser::Argument and make addRegion
(which sets up BlockArguments for the region) take it.  Convert the
world to propagating this down.  This means that we correctly
capture and propagate source location information in a lot more
cases (e.g. see the affine.for testcase example), and it also
simplifies much code.

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




More information about the All-commits mailing list