[all-commits] [llvm/llvm-project] 5954e9: [MLIR][Target/Cpp] Fix variable naming conflict fo...

Niklas Degener via All-commits all-commits at lists.llvm.org
Thu Jul 10 07:10:12 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5954e9c1a56fc313394b9dcc21f20c20c058f83d
      https://github.com/llvm/llvm-project/commit/5954e9c1a56fc313394b9dcc21f20c20c058f83d
  Author: Niklas Degener <niklas.degener at amd.com>
  Date:   2025-07-10 (Thu, 10 Jul 2025)

  Changed paths:
    M mlir/lib/Target/Cpp/TranslateToCpp.cpp
    M mlir/test/Target/Cpp/declare_func.mlir

  Log Message:
  -----------
  [MLIR][Target/Cpp] Fix variable naming conflict for function declarations (#147927)

This is a fix for https://github.com/llvm/llvm-project/pull/136102. It
missed scoping for `DeclareFuncOps`.
In scenarios with multiple function declarations, the `valueMapper`
wasn't updated and later uses of values in other functions still used
the assigned names in prior functions.

This is visible in the reproducer here
https://github.com/iree-org/iree/issues/21303: Although the counter for
variable enumeration was reset, as it is visible for the local vars, the
function arguments were mapped to old names. Due to this mapping, the
counter was never increased, and the local variables conflicted with the
arguments.

This fix adds proper scoping for declarations and a test-case to cover
the scenario with multiple `DeclareFuncOps`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list