[PATCH] D59978: [Attributor] Deduce the "no-return" attribute for functions

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 09:48:28 PDT 2019


Meinersbur added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2022
+
+    std::function<bool(Value &)> Pred = [](Value &) {
+      // Any potential return value means the function might return, thus it
----------------
Generally, lambdas should not be a given a type since each lambda has its own, compiler-private type.  In this case, a `std::function` is needed anyway to be passed as an argument of `checkForallReturnedValues`.

Have you considered changing `checkForallReturnedValues` to accept an `llvm::function_ref` such that the `std::function` overhead is not required?


================
Comment at: llvm/test/Transforms/FunctionAttrs/arg_nocapture.ll:2
 ; RUN: opt -functionattrs -attributor -attributor-disable=false -S < %s | FileCheck %s
-; RUN: opt -functionattrs -attributor -attributor-disable=false -attributor-verify=true -S < %s | FileCheck %s
 ;
----------------
Unrelated change?


================
Comment at: llvm/test/Transforms/FunctionAttrs/fn_noreturn.ll:37
 entry:
   %call = call i32 @srec16(i32 %a)
   %call1 = call i32 @srec16(i32 %call)
----------------
Out of curiosity, where/how does the Attributor determine this is an infinite recursion? Wouldn't a single recursive call be enough?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59978





More information about the llvm-commits mailing list