<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 26, 2015, at 10:24 AM, Chandler Carruth <<a href="mailto:chandlerc@google.com" class="">chandlerc@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Jan 25, 2015 at 9:37 PM, Pete Cooper <span dir="ltr" class=""><<a href="mailto:peter_cooper@apple.com" target="_blank" class="">peter_cooper@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":cfx" class="a3s" style="overflow:hidden">Hi hfinkel,<br class="">
<br class="">
This teaches the constant folder that an llvm.expect intrinsic with a constant as the first operand will return that constant.<br class="">
<br class="">
This reduces the size of an LTO'd llc by over 1% due to branches which can be removed once the constant is propagated.</div></blockquote></div><br class=""></div><div class="gmail_extra">I really don't understand this.</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">The design llvm.expect was specifically for LowerExpect to remove *all* of these intrinsics from the IR? Why isn't that working?</div></div>
</div></blockquote>Looks like LowerExpect is only added in populateFunctionPassManager, which is only called by clang, opt, and bug point.  There’s no call to this in llvm-lto.</div><div><br class=""></div><div>I still think its worthwhile to constant fold expect as soon as possible as this patch does, but it looks like we also need that pass in the LTO pipeline.</div><div><br class=""></div><div>Pete</div><br class=""></body></html>