On Mon, Apr 14, 2008 at 5:11 PM, Chris Lattner <sabre at nondot.org> wrote:> Why not something like: > %x = llvm.myintrinsic() > br i1 %x, label %T, label %FRight. That's exactly what I meant in the last paragraph of the original message. The reason for not wanting this is that %x actually always turns out to be 1 (on architectures that support it), so %T is always taken. But this unnecessarily adds overheads with the branch check. However, I do want the semantics of the code to be a conditional branch, so that optimization passes still know about the data flow going into %F. But it wouldn't be the end of the world if I went with this approach. :) Ed
On Mon, Apr 14, 2008 at 5:37 PM, Chris Lattner <sabre at nondot.org> wrote:> The code generator does CFG simplification to handle cases where blocks > become dead during lowering.Oh... is there a way to prevent that from happening? While %x is always 1 and %T is always taken, %F isn't actually dead. There would be a way (with another intrinsic) for control to flow into %F at the point of.. br i1 %x, label %T, label %F That's why I wanted the rest of the compiler to still know about the potential flow into %F. Ed
On Mon, 14 Apr 2008, Edward Lee wrote:> On Mon, Apr 14, 2008 at 5:11 PM, Chris Lattner <sabre at nondot.org> wrote: >> Why not something like: >> %x = llvm.myintrinsic() >> br i1 %x, label %T, label %F > Right. That's exactly what I meant in the last paragraph of the > original message. > > The reason for not wanting this is that %x actually always turns out > to be 1 (on architectures that support it), so %T is always taken. But > this unnecessarily adds overheads with the branch check. However, I do > want the semantics of the code to be a conditional branch, so that > optimization passes still know about the data flow going into %F. > > But it wouldn't be the end of the world if I went with this approach. :)The code generator does CFG simplification to handle cases where blocks become dead during lowering. -Chris -- http://nondot.org/sabre/ http://llvm.org/