[PATCH] Use invariants in LazyValueInfo

hfinkel at anl.gov hfinkel at anl.gov
Mon Jul 14 23:46:13 PDT 2014


Hi chandlerc,

This patch teaches LazyValueInfo to use the invariant intrinsic. Like with the known-bits patch, 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 invariant into that otherwise computed. There is also a small addition to JumpThreading so that it can have LVI use invariants 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;
}

http://reviews.llvm.org/D4511

Files:
  include/llvm/Analysis/LazyValueInfo.h
  lib/Analysis/LazyValueInfo.cpp
  lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
  lib/Transforms/Scalar/JumpThreading.cpp
  test/Transforms/JumpThreading/invariants.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4511.11420.patch
Type: text/x-patch
Size: 37668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140715/2be17c66/attachment.bin>


More information about the llvm-commits mailing list