[all-commits] [llvm/llvm-project] e4259b: [Float2Int] Pre-commit test for SIToFP/UIToFP Cons...

Craig Topper via All-commits all-commits at lists.llvm.org
Wed Apr 10 14:58:00 PDT 2024


  Branch: refs/heads/release/18.x
  Home:   https://github.com/llvm/llvm-project
  Commit: e4259b583c92244e2c49c664fad0fbc1bdaa800b
      https://github.com/llvm/llvm-project/commit/e4259b583c92244e2c49c664fad0fbc1bdaa800b
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2024-04-10 (Wed, 10 Apr 2024)

  Changed paths:
    A llvm/test/Transforms/Float2Int/pr79158.ll

  Log Message:
  -----------
  [Float2Int] Pre-commit test for SIToFP/UIToFP ConstantRange bug. NFC

The range for these operations is being constructed without the
maximum value for the range due to an incorrect usage of the
ConstantRange constructor.

This causes Float2Int to think the range for 'uitofp i1' only
contains 0 instead of 0 and 1.

(cherry picked from commit 6295e677220bb6ec1fa8abe2f4a94b513b91b786)


  Commit: feba8727f80566074518c9dbb5e90c8f2371c08d
      https://github.com/llvm/llvm-project/commit/feba8727f80566074518c9dbb5e90c8f2371c08d
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2024-04-10 (Wed, 10 Apr 2024)

  Changed paths:
    M llvm/lib/IR/ConstantRange.cpp
    M llvm/test/Transforms/Float2Int/pr79158.ll
    M llvm/unittests/IR/ConstantRangeTest.cpp

  Log Message:
  -----------
  [ConstantRange] Fix off by 1 bugs in UIToFP and SIToFP handling. (#86041)

We were passing the min and max values of the range to the ConstantRange
constructor, but the constructor expects the upper bound to 1 more than
the max value so we need to add 1.

We also need to use getNonEmpty so that passing 0, 0 to the constructor
creates a full range rather than an empty range. And passing smin,
smax+1 doesn't cause an assertion.

I believe this fixes at least some of the reason #79158 was reverted.

(cherry picked from commit 12836467b76c56872b4c22a6fd44bcda696ea720)


Compare: https://github.com/llvm/llvm-project/compare/daca56d8e162...feba8727f805

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