<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Worth noting is that your "small addition to JumpThreading" is going
    to be a general maintenance burden imposed by your approach.  We'll
    have to make other such "small additions" throughout the optimizer
    when recognizing control flow patterns.  <br>
    <br>
    We should probably think about some form of placement
    canonicalization for them to reduce this burden. <br>
    <br>
    Philip <br>
    <br>
    <div class="moz-cite-prefix">On 07/14/2014 11:46 PM, <a class="moz-txt-link-abbreviated" href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>
      wrote:<br>
    </div>
    <blockquote
cite="mid:differential-rev-PHID-DREV-jepcclb56nmyy2yfa64u-req@reviews.llvm.org"
      type="cite">
      <pre wrap="">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;
}

<a class="moz-txt-link-freetext" href="http://reviews.llvm.org/D4511">http://reviews.llvm.org/D4511</a>

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
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
llvm-commits mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>