[all-commits] [llvm/llvm-project] 2c4a9e: [ValueTracking] Teach computeConstantRange that th...

David Green via All-commits all-commits at lists.llvm.org
Sat Oct 30 06:27:51 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2c4a9e830cbb3b91a57902f7ecd508c544701819
      https://github.com/llvm/llvm-project/commit/2c4a9e830cbb3b91a57902f7ecd508c544701819
  Author: David Green <david.green at arm.com>
  Date:   2021-10-30 (Sat, 30 Oct 2021)

  Changed paths:
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/test/CodeGen/Thumb2/mve-fpclamptosat_vec.ll
    M llvm/test/Transforms/InstSimplify/fptoi-range.ll

  Log Message:
  -----------
  [ValueTracking] Teach computeConstantRange that the maximum value of a half is 65504

The maximal value of a half is 0x7bff, which is 65504 when converted to
an integer. This patch teaches that to computeConstantRange to compute a
constant range with the correct maximum value.
https://alive2.llvm.org/ce/z/BV_Spb
https://alive2.llvm.org/ce/z/Nwuqvb

The maximum value for a float converted in the same way is 3.4e38, which
requires 129bits of data. I have not added that here as integer types so
larger are rare, compared to integers types larger than 17 bits require
for half floats.

The MVE tests change because instsimplify happens to be run as a part of
the backend, where it doesn't tend to for other backends.

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




More information about the All-commits mailing list