[PATCH] Constant fold llvm.expect(c, ...) -> c
peter_cooper at apple.com
Mon Jan 26 10:29:18 PST 2015
> On Jan 26, 2015, at 10:24 AM, Chandler Carruth <chandlerc at google.com> wrote:
> On Sun, Jan 25, 2015 at 9:37 PM, Pete Cooper <peter_cooper at apple.com <mailto:peter_cooper at apple.com>> wrote:
> Hi hfinkel,
> This teaches the constant folder that an llvm.expect intrinsic with a constant as the first operand will return that constant.
> This reduces the size of an LTO'd llc by over 1% due to branches which can be removed once the constant is propagated.
> I really don't understand this.
> The design llvm.expect was specifically for LowerExpect to remove *all* of these intrinsics from the IR? Why isn't that working?
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.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits