[PATCH] Constant fold llvm.expect(c, ...) -> c
Chandler Carruth
chandlerc at google.com
Mon Jan 26 11:32:46 PST 2015
On Mon, Jan 26, 2015 at 11:29 AM, Pete Cooper <peter_cooper at apple.com>
wrote:
> That would be nice. I expect (ha!) that we’d do this in IRGen. I might
> look in to this, although i’m not too familiar with clang.
>
> If you’re interested, i’ve worked out why I see this benefit at all in
> this patch. I LTO my Debug LLVM. This results in -O0 on the bitcode
> produced by LLVM, but then the linker LTO’s with optimizations enabled.
> And because LTO doesn’t have LowerExpect in its pipeline, I see many cases
> of 'call i64 @llvm.expect.i64(i64 1, i64 1)’ in my IR.
>
> So, getting the front-end to generate metadata would certainly fix this.
> As would calling LowerExpect in libLTO or in populateFunctionPassManager
> even when on -O0. Or we could just say that a Debug LTO build should live
> with this issue, although I’d prefer one of the other options to this one.
>
First problem: why are we generating these at -O0 at all? We should just
turn that part of Clang off.
Second problem: ... nope, no second problem. ;]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150126/8738b32a/attachment.html>
More information about the llvm-commits
mailing list