[PATCH] D94502: [FunctionAttrs] Derive willreturn for fns with readonly` & `mustprogress`.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 12 08:58:38 PST 2021


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/FunctionAttrs.cpp:1436
+    F->addFnAttr(Attribute::WillReturn);
+    F->removeFnAttr(Attribute::NoReturn);
+  }
----------------
fhahn wrote:
> jdoerfert wrote:
> > `Changed = true;` ;)
> > Changed = true; ;)
>  
> yeah.
> 
> 
> 
> I guess a comment here might be helpful as well. It is possible that the function has been marked as `noreturn` earlier, e.g. because it does not have any returns. In such cases, `will return` seems a better choice, if possible.
Is it possible to keep both, or does that cause verifier errors? A function that always unwinds should be able to be both noreturn and willreturn without invoking UB.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94502



More information about the llvm-commits mailing list