[all-commits] [llvm/llvm-project] d23516: [mlir] fix dereferencing of optional sym_name attr...

Ashay Rane via All-commits all-commits at lists.llvm.org
Tue Jan 17 10:56:49 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d23516e9ad477527a9db4d06b1fa9566680ac67c
      https://github.com/llvm/llvm-project/commit/d23516e9ad477527a9db4d06b1fa9566680ac67c
  Author: Ashay Rane <ashay at users.noreply.github.com>
  Date:   2023-01-17 (Tue, 17 Jan 2023)

  Changed paths:
    M mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
    M mlir/test/Conversion/SPIRVToLLVM/lower-host-to-llvm-calls.mlir

  Log Message:
  -----------
  [mlir] fix dereferencing of optional sym_name attribute

`sym_name` is an optional attribute of `ModuleOp`, so it is unsafe to
fetch the underlying value without checking whether it is non-empty.
Such unsafe dereferencing causes the lower-host-to-llvm-calls_fail.mlir
test to segfault.  Although this bug existed for four months, it wasn't
triggered, since previous tests executed a code path that used a default
value instead of one fetched from the module attribute.

This patch makes the code use a default value if the optional attribute
does not have a value.

Reviewed By: stella.stamenova

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




More information about the All-commits mailing list