[llvm-dev] LLVM now assume functions may not return, unless they are marked as willreturn

Mehdi AMINI via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 25 16:21:07 PST 2021


Hi,

Should this doc be updated accordingly:
https://llvm.org/docs/Frontend/PerformanceTips.html ?

Thanks!

-- 
Mehdi


On Mon, Jan 25, 2021 at 2:23 AM Florian Hahn via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi,
>
> Just a quick heads up. Recently a few changes landed that updated code in
> LLVM that implicitly assumed some functions will return. Now, the code
> explicitly checks for the `willreturn` attribute. Please see the patches
> below
> https://reviews.llvm.org/rG292077072ec1
> https://reviews.llvm.org/rG5d12b976b004
>
> Among other things, this means LLVM now won’t remove function calls to
> readonly functions, unless they are willreturn. This fixes some
> longstanding issues for languages without C++-like forward-progress
> guarantees (see https://bugs.llvm.org/show_bug.cgi?id=965 )
>
>  For the simple example below, LLVM now won’t remove the call to loop(),
> if it is compiled as a C program.
>
> void loop() {
> while(1);
> }
> int main() {
> loop();
> return 1;
> }
>
>
> If your frontend provides C++-like forward progress guarantees, please
> make sure functions/loops are marked as `mustprogress` accordingly.
> Mustprogress helps with inferring `willlreturn`.
>
> If your frontend can guarantee a function will always return, consider
> adding the `willreturn` attribute to the generated functions.
>
> Please audit the intrinsics definitions for your target. They also need to
> be marked as willreturn, if possible.As an example, see the patch that
> updated AArch64 https://reviews.llvm.org/rG50ae6a3ac9bd . At the moment,
> the code still (wrongly) assumes that all intrinsics will return. Once
> people had time to update their backends, the plan is to remove this
> assumption.
>
> Cheers,
> Florian
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210125/11944336/attachment.html>


More information about the llvm-dev mailing list