[llvm-commits] [llvm] r120932 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/select.ll

Chris Lattner clattner at apple.com
Sun Dec 5 20:39:12 PST 2010


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.

-Chris



More information about the llvm-commits mailing list