Make use of @llvm.assume from LazyValueInfo
authorHal Finkel <hfinkel@anl.gov>
Sun, 7 Sep 2014 20:29:59 +0000 (20:29 +0000)
committerHal Finkel <hfinkel@anl.gov>
Sun, 7 Sep 2014 20:29:59 +0000 (20:29 +0000)
commit3ef1aae2b51af3074e0ae045b6d576068dacfc01
tree5d407dc4493122d1587423c16b2fd53c791d117d
parent1d6c2d717d74eccc866d9a62b1631a265ef795fc
Make use of @llvm.assume from LazyValueInfo

This change teaches LazyValueInfo to use the @llvm.assume intrinsic. Like with
the known-bits change (r217342), this requires feeding a "context" instruction
pointer through many functions. Aside from a little refactoring to reuse the
logic that turns predicates into constant ranges in LVI, the only new code is
that which can 'merge' the range from an assumption into that otherwise
computed. There is also a small addition to JumpThreading so that it can have
LVI use assumptions in the same block as the comparison feeding a conditional
branch.

With this patch, we can now simplify this as expected:
int foo(int a) {
  __builtin_assume(a > 5);
  if (a > 3) {
    bar();
    return 1;
  }
  return 0;
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217345 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/LazyValueInfo.h
lib/Analysis/LazyValueInfo.cpp
lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
lib/Transforms/Scalar/JumpThreading.cpp
test/Transforms/JumpThreading/assume.ll [new file with mode: 0644]