[all-commits] [llvm/llvm-project] bab3d3: [mlir][LLVM] Fix crash when using opaque pointers ...

zero9178 via All-commits all-commits at lists.llvm.org
Fri Apr 22 15:12:42 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bab3d3778de17c0a62cc7fb8757ce942ce332fc2
      https://github.com/llvm/llvm-project/commit/bab3d3778de17c0a62cc7fb8757ce942ce332fc2
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2022-04-23 (Sat, 23 Apr 2022)

  Changed paths:
    M mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
    M mlir/test/Conversion/FuncToLLVM/convert-types.mlir

  Log Message:
  -----------
  [mlir][LLVM] Fix crash when using opaque pointers in function signatures

Using opaque pointers in function signatures leads to an attempt to recursively convert all types, including sub types in LLVM types. In the case of LLVM pointers, it may not have a subtype aka element type if it is opaque which would then lead to a null pointer dereference.

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


  Commit: 8ed2bd1e746567ab82e138896db340a6a6781511
      https://github.com/llvm/llvm-project/commit/8ed2bd1e746567ab82e138896db340a6a6781511
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2022-04-23 (Sat, 23 Apr 2022)

  Changed paths:
    M mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
    M mlir/test/Dialect/LLVMIR/layout.mlir

  Log Message:
  -----------
  [mlir][LLVM] Fix `DataLayoutTypeInterface` for opqaue pointers with non-default address space

As a fallback mechanism, if no entry was supplied for a given address space, the size or alignment for a pointer type with the default address space is returned instead.
This code currently crashes with opaque pointers, as it tries to construct a typed pointer type from the opaque pointer type, leading to a null pointer dereference when fetching the element type.

This patch fixes the issue by handling the opaque pointer cases explicitly.

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


Compare: https://github.com/llvm/llvm-project/compare/20a9fb953e46...8ed2bd1e7465


More information about the All-commits mailing list