[PATCH] D78220: IR/ConstantRange: Add support for FP ranges

Jan Vesely via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 11:30:32 PDT 2020


jvesely created this revision.
jvesely added reviewers: nikic, spatel, lebedev.ri.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
jvesely added a parent revision: D78222: Transform/Float2Int: Don't rely on hack support for floating point type in ConstantRange.
nikic added a comment.
jvesely added a child revision: D78224: ValueLattice, LVI, SCCP: Use floating point constant  ranges.

I would strongly recommend to implement this as a separate type (FloatRange for example), rather than combining it into ConstantRange. There's a couple reasons for that, the main ones would be a) float ranges have significantly different semantics, in particular the fact that they are inclusive and b) ConstantRange is a size critical structure, because it is used in value lattice elements. As implement, this change is going to skyrocket memory consumption during SCCP.

It would also be nice to have some general context on where you plan to use this.


The FP Range follows the same pattern as integer range, with two major differences.

1. It's inclusive
2. NaNs are tracked separately from the range.

This patch implements; construction, printing, fadd, fsub, fmul, fdiv, minimum, maximum, cast, makeAllowedRegion, makeSatisfyingRegion.
Rounding of operations is conservative and returns a potentially larger region.

      

Floating point vectors are still tracked as integer ranges.

Includes exhaustive testing for all supported operations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78220

Files:
  llvm/include/llvm/IR/ConstantRange.h
  llvm/lib/IR/ConstantRange.cpp
  llvm/unittests/IR/ConstantRangeTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78220.257765.patch
Type: text/x-patch
Size: 99262 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/dd74cde4/attachment-0001.bin>


More information about the llvm-commits mailing list