[all-commits] [llvm/llvm-project] 59f407: [MLIR] Fix printing of switch case for negative va...

Robert Konicar via All-commits all-commits at lists.llvm.org
Mon Mar 3 01:14:54 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 59f407020ea60d46af974563e4b87b8d9f188802
      https://github.com/llvm/llvm-project/commit/59f407020ea60d46af974563e4b87b8d9f188802
  Author: Robert Konicar <xkonicar at fi.muni.cz>
  Date:   2025-03-03 (Mon, 03 Mar 2025)

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

  Log Message:
  -----------
  [MLIR] Fix printing of switch case for negative value (#129266)

This patch fixes the printer for the `llvm.switch` operation with
negative values in a case.

The previous behaviour printed the value as an unsigned integer, as the
`getLimitedValue()` returns unsigned value. This caused the roundtrip to
fail (assertion in `APInt`), as the printed unsigned integer could not
be parsed into the same amount of bits in a signed integer.
I don't see a good reason for keeping any restriction on the printed
value, as LLVMIR `switch` afaik does not have a limit on the bitwidth of
the values and `APInt` handles printing just fine.



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