[LLVMdev] If Conversion and predicated returns

Krzysztof Parzyszek kparzysz at codeaurora.org
Wed Apr 10 11:10:32 PDT 2013


On 4/10/2013 12:45 PM, Hal Finkel wrote:
>
> Should AnalyzeBranch be enhanced to somehow indicate conditional returns?

I don't think that returns can ever be analyzable (since LLVM's CFG does 
not have a designated exit block).


> Alternatively, the diamond conversion routine contains this:
>
>    // RemoveExtraEdges won't work if the block has an unanalyzable branch,
>    // which can happen here if TailBB is unanalyzable and is merged, so
>    // explicitly remove BBI1 and BBI2 as successors.
>    BBI.BB->removeSuccessor(BBI1->BB);
>    BBI.BB->removeSuccessor(BBI2->BB);
>    RemoveExtraEdges(BBI);
>
> should something similar be added prior to the calls to RemoveExtraEdges in the simple and triangle conversion routines?

Both of these cases know what scenario they are dealing with (i.e. 
whether there is a return instruction in the block or not), so they 
should be able to handle the edge updates (just like the diamond case). 
  The only special case would be when the CFG edges go to the same block 
(i.e. there is a conditional branch whose both paths end up in the same 
place), but I think that if-conversion would give up on that (or that 
the branch folder would take care of it).

My 2c.

-Krzysztof


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-dev mailing list