[Attributor] AAValueConstantRange: Value range analysis using constant range
authorHideto Ueno <uenoku.tokotoko@gmail.com>
Wed, 1 Jan 2020 06:25:19 +0000 (15:25 +0900)
committerHideto Ueno <uenoku.tokotoko@gmail.com>
Wed, 1 Jan 2020 06:35:56 +0000 (15:35 +0900)
commite9963034314edf49a12ea5e29f694d8f9f52734a
treebb579de469bd1436bc54cfb94da6780f45db441d
parent86f48999f46f41687f152e0854bdd352250b117c
[Attributor] AAValueConstantRange: Value range analysis using constant range

This patch introduces `AAValueConstantRange`, which answers a possible range for integer value in a specific program point.
One of the motivations is propagating existing `range` metadata. (I think we need to change the situation that `range` metadata cannot be put to Argument).

The state is a tuple of `ConstantRange` and it is initialized to (known, assumed) = ([-∞, +∞], empty).

Currently, AAValueConstantRange is created when AAValueSimplify cannot
simplify the value.

Supported
 - BinaryOperator(add, sub, ...)
 - CmpInst(icmp eq, ...)
 - !range metadata

`AAValueConstantRange` is not intended to extend to polyhedral range value analysis.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D71620
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/test/Transforms/Attributor/IPConstantProp/return-constant.ll
llvm/test/Transforms/Attributor/IPConstantProp/solve-after-each-resolving-undefs-for-function.ll
llvm/test/Transforms/Attributor/dereferenceable-1.ll
llvm/test/Transforms/Attributor/lvi-after-jumpthreading.ll [new file with mode: 0644]
llvm/test/Transforms/Attributor/lvi-for-ashr.ll [new file with mode: 0644]
llvm/test/Transforms/Attributor/range.ll [new file with mode: 0644]
llvm/test/Transforms/Attributor/value-simplify.ll