<div dir="ltr">Hi folks,<div><br></div><div>I'm new to LLVM and non-expert in hardware architecture, so my question might be dumb.</div><div><br></div><div>I'm looking for the possibility to define/call a function with multi return path, it might look like this:<br><br>```<div>; Define a function with 1 alternate return path</div><div>define i32 @f(i1 %i) fork 1 {</div><div>  br i1 %i, label %noraml, label %alternate</div><div>noraml:</div><div>  ...</div><div>  setpath ret i32 42 ; take normal return path</div><div>  br %cleanup</div><div>alternate:</div><div>  ...</div><div>  setpath fork 0 ; take the alternate return path</div><div>  br %cleanup</div><div>cleanup: ; preds = %noraml, %alternate</div><div>  ...</div><div>  unwind ; return to the caller</div><div>}</div>```</div><div><br></div>And at the call side:<br>```<br><div>  %ret = call @f(i1 %i) fork [%otherwise]</div><div>  ...</div><div>otherwise:</div><div>  ...</div>```<div><br></div><div>Ideally, the callee sets the return address so it returns directly to the desired location in the caller w/o the caller taking extra switch.</div><div><br></div><div>The idea is to implement some non-local control flow w/o extra overhead at each call side.</div><div><br></div><div>I know LLVM doesn't have something like this currently, but is it possible to implement?</div></div>