[all-commits] [llvm/llvm-project] 128364: [ConstantRange] Fix off by 1 bugs in UIToFP and SI...

Craig Topper via All-commits all-commits at lists.llvm.org
Thu Mar 21 09:25:35 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 12836467b76c56872b4c22a6fd44bcda696ea720
      https://github.com/llvm/llvm-project/commit/12836467b76c56872b4c22a6fd44bcda696ea720
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2024-03-21 (Thu, 21 Mar 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.



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