[all-commits] [llvm/llvm-project] 5dedf9: [AsmParser] Rework logic around "region argument p...

Chris Lattner via All-commits all-commits at lists.llvm.org
Thu Apr 28 11:20:54 PDT 2022


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

  Changed paths:
    M flang/lib/Optimizer/Dialect/FIROps.cpp
    M mlir/include/mlir/IR/OpImplementation.h
    M mlir/lib/Dialect/Affine/IR/AffineOps.cpp
    M mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp
    M mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/Dialect/OpenACC/IR/OpenACC.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/Vector/IR/VectorOps.cpp
    M mlir/lib/IR/FunctionImplementation.cpp
    M mlir/lib/Parser/Parser.cpp
    M mlir/test/Dialect/Affine/invalid.mlir
    M mlir/test/lib/Dialect/Test/TestDialect.cpp

  Log Message:
  -----------
  [AsmParser] Rework logic around "region argument parsing"

The asm parser had a notional distinction between parsing an
operand (like "%foo" or "%4#3") and parsing a region argument
(which isn't supposed to allow a result number like #3).

Unfortunately the implementation has two problems:

1) It didn't actually check for the result number and reject
   it.  parseRegionArgument and parseOperand were identical.
2) It had a lot of machinery built up around it that paralleled
   operand parsing.  This also was functionally identical, but
   also had some subtle differences (e.g. the parseOptional
   stuff had a different result type).

I thought about just removing all of this, but decided that the
missing error checking was important, so I reimplemented it with
a `allowResultNumber` flag on parseOperand.  This keeps the
codepaths unified and adds the missing error checks.

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




More information about the All-commits mailing list