[llvm-commits] [llvm] r120932 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/select.ll
Bob Wilson
bob.wilson at apple.com
Mon Dec 6 09:29:29 PST 2010
On Dec 5, 2010, at 8:39 PM, Chris Lattner wrote:
>
> On Dec 5, 2010, at 8:25 PM, Evan Cheng wrote:
>>>> Right, they don't handle the integer overflow case. In this particular example, what we really want is a way to say that the select is heavily biased, so that we get a jump instead of cmov (or cmov equivalent). We really want:
>>>>
>>>> mulq <reg>
>>>> jo Lfoo
>>>> jmp __Znam
>>>> Lfoo:
>>>> mov rdi, -1
>>>> jmp __Znam
>>>
>>> Along these lines, I wonder if it would be enough to just mark IR select/condbr instructions with an instruction MDNode like !highlybiased (optionally with a direction). This could be preserved down to codegen level and used for expansion there. This would also be a straight-forward way to model __builtin_expect.
>>
>> Do we want to make it a more generic MDNode so we can use it to encode branch probability?
>
> Yes, making it more general than just "biased" makes sense.
I've been thinking about and talking with a few people about doing exactly that for recording profile information as well. I don't yet have enough details to make a real proposal, but if you're planning to do anything like that soon, I'd be interested.
More information about the llvm-commits
mailing list