[all-commits] [llvm/llvm-project] d41028: [mlir] Prevent SubElementInterface from going into...

Min-Yih Hsu via All-commits all-commits at lists.llvm.org
Wed Jun 29 13:58:49 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d41028610b5372669adcb9b7091fae5250f0a4a8
      https://github.com/llvm/llvm-project/commit/d41028610b5372669adcb9b7091fae5250f0a4a8
  Author: Min-Yih Hsu <minyihh at uci.edu>
  Date:   2022-06-29 (Wed, 29 Jun 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h
    M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVTypes.h
    M mlir/include/mlir/IR/Attributes.h
    M mlir/include/mlir/IR/StorageUniquerSupport.h
    M mlir/include/mlir/IR/Types.h
    M mlir/lib/IR/SubElementInterfaces.cpp
    M mlir/test/IR/recursive-type.mlir
    M mlir/test/lib/Dialect/Test/TestDialect.cpp
    M mlir/test/lib/Dialect/Test/TestTypes.h
    M mlir/unittests/Dialect/CMakeLists.txt
    A mlir/unittests/Dialect/LLVMIR/CMakeLists.txt
    A mlir/unittests/Dialect/LLVMIR/LLVMTestBase.h
    A mlir/unittests/Dialect/LLVMIR/LLVMTypeTest.cpp

  Log Message:
  -----------
  [mlir] Prevent SubElementInterface from going into infinite recursion

Since only mutable types and attributes can go into infinite recursion
inside SubElementInterface::walkSubElement, and there are only a few of
them (mutable types and attributes), we introduce new traits for Type
and Attribute: TypeTrait::IsMutable and AttributeTrait::IsMutable,
respectively. They indicate whether a type or attribute is mutable.
Such traits are required if the ImplType defines a `mutate` function.

Then, inside SubElementInterface, we use a set to record visited mutable
types and attributes that have been visited before.

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


  Commit: 9bad9248ed3038eaa0cd0aeebb19566233e0f3e6
      https://github.com/llvm/llvm-project/commit/9bad9248ed3038eaa0cd0aeebb19566233e0f3e6
  Author: Min-Yih Hsu <minyihh at uci.edu>
  Date:   2022-06-29 (Wed, 29 Jun 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMTypes.h
    M mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
    M mlir/unittests/Dialect/LLVMIR/LLVMTypeTest.cpp

  Log Message:
  -----------
  [mlir][LLVMIR] Apply SubElementTypeInterface on suitable types

This feature is tested by unit test since not many places in the codebase
use SubElementTypeInterface.

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


Compare: https://github.com/llvm/llvm-project/compare/bc5e7ced1c7e...9bad9248ed30


More information about the All-commits mailing list