[PATCH] D63045: Do not derive no-recurse attribute if function does not have exact definition.

Vivek Pandya via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 9 21:15:47 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG11cb15f8ed37: Do not derive no-recurse attribute if function does not have exact definition. (authored by vivekvpandya).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63045

Files:
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/test/Transforms/FunctionAttrs/arg_returned.ll


Index: llvm/test/Transforms/FunctionAttrs/arg_returned.ll
===================================================================
--- llvm/test/Transforms/FunctionAttrs/arg_returned.ll
+++ llvm/test/Transforms/FunctionAttrs/arg_returned.ll
@@ -308,17 +308,11 @@
 ;
 ; Verify the maybe-redefined function is not annotated:
 ;
-; CHECK: Function Attrs: noinline norecurse nounwind uwtable
+; CHECK: Function Attrs: noinline nounwind uwtable
 ; CHECK: define linkonce_odr i32* @maybe_redefined_fn(i32* %r)
-; FIXME: We should not derive norecurse for potentially redefined functions!
-;        Function Attrs: noinline nounwind uwtable
-;        define linkonce_odr i32* @maybe_redefined_fn(i32* %r)
 ;
-; CHECK: Function Attrs: noinline norecurse nounwind uwtable
+; CHECK: Function Attrs: noinline nounwind uwtable
 ; CHECK: define i32* @calls_maybe_redefined_fn(i32* returned %r)
-; FIXME: We should not derive norecurse for potentially redefined functions!
-;        Function Attrs: noinline nounwind uwtable
-;        define i32* @calls_maybe_redefined_fn(i32* returned %r)
 define linkonce_odr i32* @maybe_redefined_fn(i32* %r) #0 {
 entry:
   ret i32* %r
@@ -586,5 +580,4 @@
 ; CHECK-DAG: attributes #{{[0-9]*}} = { noinline nounwind readnone uwtable }
 ; CHECK-DAG: attributes #{{[0-9]*}} = { noinline nounwind readonly uwtable }
 ; CHECK-DAG: attributes #{{[0-9]*}} = { noinline nounwind uwtable }
-; CHECK-DAG: attributes #{{[0-9]*}} = { noinline norecurse nounwind uwtable }
 ; CHECK-NOT: attributes #
Index: llvm/lib/Transforms/IPO/FunctionAttrs.cpp
===================================================================
--- llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -1300,7 +1300,7 @@
     return false;
 
   Function *F = *SCCNodes.begin();
-  if (!F || F->isDeclaration() || F->doesNotRecurse())
+  if (!F || !F->hasExactDefinition() || F->doesNotRecurse())
     return false;
 
   // If all of the calls in F are identifiable and are to norecurse functions, F


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63045.203764.patch
Type: text/x-patch
Size: 2015 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190610/788820e7/attachment.bin>


More information about the llvm-commits mailing list