[LLVMdev] Flag output used by two other nodes in DAG
Edmund Grimley-Evans
Edmund.Grimley-Evans at arm.com
Fri Oct 8 05:29:02 PDT 2010
Anton Korobeynikov:
> > Is it, or should it be legal for a Flag output to be used as input by
> > more than one other node?
> It's illegal. Multiple uses of the flag output do not make any sense,
> this breaks the semantics of flag operands.
All right. Then what should the Selection DAG look like in a case where the
flag value generated by one instruction is to be used as input to two other
instructions?
For a concrete example, consider:
int f(int x)
{
return x < 0 ? 11 : x == 0 ? 22 : 33;
}
I'd like this to turn into something like what I've seen from other compilers:
cmp r0, #0
movlt r0, #11
bxlt lr
movne r0, #33
moveq r0, #22
bx lr
--
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
More information about the llvm-dev
mailing list