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%.
Can the PHITranslation now fail with your change?