[PATCH] Jump thread llvm.expect

Chandler Carruth chandlerc at google.com
Mon Jan 26 10:25:18 PST 2015

On Sun, Jan 25, 2015 at 9:49 PM, Pete Cooper <peter_cooper at apple.com> wrote:

> Hi hfinkel,
> When jump threading this code
> %B = phi i32 [%v1, %T1], [12, %F1]
> %A = icmp ne i32 %B, 42
> in asserts builds its common to have an expect in between:
> %B = phi i64 [%v1, %T1], [12, %F1]
> %expect = call i64 @llvm.expect.i64(i64 %B, i64 42)
> %A = icmp ne i64 %expect, 42
> This patch teaches JumpThreading about this case so that when we fail to
> find a PHI, we look through an llvm.expect to see if a PHI is its first
> source.
> Reduces the size of an LTO'd llc by almost 2.5%.

As with the other patch, how is this happening? The design of expect was
specifically to have it completely removed in an early pass to avoid having
to teach the rest of the optimizer about it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150126/e7b93c3d/attachment.html>

More information about the llvm-commits mailing list