[all-commits] [llvm/llvm-project] 7a67e4: [mlir][LLVM] Fix incorrect GEP fold with struct co...

zero9178 via All-commits all-commits at lists.llvm.org
Wed Jul 27 05:42:50 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7a67e41be2a56df8629cdb3f6b529855ecce3ed4
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/test/Dialect/LLVMIR/canonicalize.mlir

  Log Message:
  [mlir][LLVM] Fix incorrect GEP fold with struct constants

The fold in it's current state only checks whether the amount of dynamic indices is 1. This does however not check for the presence of any struct indices, leading to an incorrect fold.

This patch fixes that issue by checking that struct indices are 1, which in addition to the pre-existing check that dynamic indices are 1, guarantees that the single index is a dynamic one.

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

More information about the All-commits mailing list