[all-commits] [llvm/llvm-project] c10f8b: [mlir][LLVM] Add `SplitGEP` type-consistency pattern

Markus Böck via All-commits all-commits at lists.llvm.org
Mon Jul 10 01:51:38 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c10f8bd6c3ec30b68900b6fac2f0813c338d99e6
  Author: Markus Böck <markus.bock+llvm at nextsilicon.com>
  Date:   2023-07-10 (Mon, 10 Jul 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/Transforms/TypeConsistency.h
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp
    M mlir/lib/Dialect/LLVMIR/Transforms/TypeConsistency.cpp
    M mlir/test/Dialect/LLVMIR/type-consistency.mlir

  Log Message:
  [mlir][LLVM] Add `SplitGEP` type-consistency pattern

The goal of this pattern is to eliminate all GEPs that have more than two indices by splitting it into multiple GEPs.
The advantage of this change is that the resulting GEPs only ever index into one aggregate at the time. This enables handling sub-aggregates in other patterns and also creates IR with easier to deduce pointer element types.

As a minor note, `getResultPtrElementType` for `GEPOp` was rewritten since it did not properly handle dynamic indices. The way GEPOp is specified, the resulting pointer element type can *always* be deduced from its base type and indices.

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

More information about the All-commits mailing list