[llvm-dev] LLVM Block is not the basic block

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Tue May 29 06:20:39 PDT 2018


On 5/29/2018 7:59 AM, Muhui Jiang via llvm-dev wrote:
> So the reason why basic blocks can contain function calls is because of 
> code inlining?

Not really. Basic blocks are units of code in a context of a specific 
function. When execution reaches a function call, it will go outside of 
the current function for some time, but then it will return back to the 
instruction following the call. From the perspective of the function 
containing the call, the call is simply another (potentially complicated 
and long-running) instruction.
Generally speaking, a basic block ends at instruction A, if the 
instruction following A is not guaranteed to execute after A has 
executed. From the point of view of a given function, a call to another 
function will return back to the caller, so logically there is no reason 
to terminate the basic block at a call. There are of course 
complications, like calls that can throw exceptions, or calls that don't 
return, but the general idea is that calls do return.

-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