[all-commits] [llvm/llvm-project] 938fe9: [mlir][Arith] Fix up integer range inference for t...

Krzysztof Drewniak via All-commits all-commits at lists.llvm.org
Mon Aug 1 12:30:07 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 938fe9f277c62289096a70fb1afb896552d4f661
  Author: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
  Date:   2022-08-01 (Mon, 01 Aug 2022)

  Changed paths:
    M mlir/lib/Dialect/Arithmetic/IR/InferIntRangeInterfaceImpls.cpp
    M mlir/test/Dialect/Arithmetic/int-range-interface.mlir

  Log Message:
  [mlir][Arith] Fix up integer range inference for truncation

Attempting to apply the range analysis to real code revealed that
trunci wasn't correctly handling the case where truncation would
create wider ranges - for example, if we truncate [255, 257] : i16 to
i8, the result can be 255, 0, or 1, which isn't a contiguous range of

The previous implementation would naively map this to [255, 1], which
would cause issues with unsigned ranges and unification.

Reviewed By: Mogball

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

More information about the All-commits mailing list