LLVM has a SelectInst that is used to represent expressions like something = cond ? true-part : false-part.
What is the benefit of this instruction in the IR, as ?: could also always be lowered to a BranchInst by the compiler? Are there CPUs that support such instructions? Or is select lowered to jumps by the CodeGenerator anyway?
I reckon there may be benefits for analysis passes as the select guarantees two "branches" of the implicit if. But on the other hand, compilers are not required to use the instruction at all, so these passes must be able to deal with brs anyway.
Yes, you can use always use a conditional branch instead of a select instruction, but a select has several advantages:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With