[PATCH] D94633: [FunctionAttrs] Infer willreturn for functions without loops

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 14 14:57:39 PST 2021


nikic added a comment.

In D94633#2499465 <https://reviews.llvm.org/D94633#2499465>, @jdoerfert wrote:

>>>>> The logic seems sound, could be improved since this does initialize the fixpoint computation with a pessimistic starting value. One comment below, the rest is OK for merging.
>>>>
>>>> I thought about this, but I don't think that we can use an optimistic fixpoint here without some much more sophisticated analysis. Just naively assuming "willreturn until proven otherwise" will incorrectly mark infinite recursion as willreturn:
>>>>
>>>>   ; Not willreturn.
>>>>   define void @willreturn_recursion() {
>>>>     tail call void @willreturn_recursion()
>>>>     ret void
>>>>   }
>>>
>>> So, I run this through the Attributor: https://opt.godbolt.org/z/TqsK86
>>> Not what we were looking for, so here is the non-trivial version: https://opt.godbolt.org/z/rbeedM
>>
>> Just to make sure we're on the same page, both of those would be bugs in attributor right? The first one shouldn't be unreachable, and the second one shouldn't be willreturn, at least not without more information than is contained in that IR.
>
> I agree for the first one. Mustprogress is missing for unreachable to correct. The second one is correct, or am I missing something?

Nope, the second one is indeed correct, I misread the output. Sorry for the noise!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94633/new/

https://reviews.llvm.org/D94633



More information about the llvm-commits mailing list