[all-commits] [llvm/llvm-project] cb472f: Update SimplifyIndVar.cpp (#69760)

Andy Kaylor via All-commits all-commits at lists.llvm.org
Fri Oct 20 15:23:58 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cb472fbd47b7e54796197ec272b8fc1f136466fc
      https://github.com/llvm/llvm-project/commit/cb472fbd47b7e54796197ec272b8fc1f136466fc
  Author: Andy Kaylor <andrew.kaylor at intel.com>
  Date:   2023-10-20 (Fri, 20 Oct 2023)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyIndVar.cpp

  Log Message:
  -----------
  Update SimplifyIndVar.cpp (#69760)

In SimplifyIndvar::replaceFloatIVWithIntegerIV() the return value of
getFPMantissaWidth() was being cast as an unsigned integer and then
compared with the number of bits needed to represent an integer that was
cast to and from a floating-point type. This is a problem because
getFPMantissaWidth() returns -1 if the type does not have a stable
mantissa.

Currently the only type that returns -1 is ppc_fp128, so you'd need a
pretty big induction variable to cause a problem. However, this problem
will be more likely to be exposed when we implement support for decimal
floating-point types.

Strictly speaking, what we want to know here is the size of the biggest
integer that can be represented exactly. We could get that information
even with an unstable mantissa width, but getFPMantissaWidth() won't do
it.




More information about the All-commits mailing list