[llvm-dev] Structurizing multi-exit regions

Matt Arsenault via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 2 13:30:32 PST 2017


On 03/02/2017 08:08 AM, Christian König wrote:
> Hi Matt,
>
> one prerequisite for the algorithm is that each function has exactly 
> one entry and one exit node.
>
> If I remember correctly there was a LLVM pass called mergereturn or 
> something like that which made sure that you have at most one ret 
> instruction for each function.
>
> Using that used to be a prerequisite for running the transformation, 
> but that obviously won't work for unreachable instructions.
>
> The only doable approach I can see is to make the annotator able to 
> handle those. Otherwise you could also have a BB existing a function 
> using ret and another one running into an unreachable.
>
> Regards,
> Christian. 
Thanks, I didn't know about mergereturn. Running that first seems to 
practically solve the problem. It does also merge unreachables, so 
that's OK too. If one branch is unreachable, and the other is return I 
still see the same problem like you mentioned.

-Matt


More information about the llvm-dev mailing list