[PATCH] D65860: [Attributor] Add LoopInfo to InformationCache and improve willreturn deduction

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 12:00:18 PDT 2019


jdoerfert added inline comments.


================
Comment at: llvm/include/llvm/Transforms/IPO/Attributor.h:374
+  /// A map from functions to their LoopInfo.
+  FuncLoopInfoMapTy FuncLoopInfoMap;
+
----------------
I think you cannot cache the loop info objects (if you do not create them yourself at least). See also below.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:1255
+                                const LoopInfo>(FuncRPOT, LI);
 }
 
----------------
Add this to the `AALoop` interface so we can query it easily and cache the results in there.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:1296
+    if (!LoopAA || !LoopAA->isAssumedNeverEndless(L))
+      return indicatePessimisticFixpoint();
+
----------------
`LoopInfo::begin/end` only traverses outermost loops.

Add a helper in the `Attributor`: `checkForAllLoops(...)`  that traverses the outermost loops and transitively their child loops. We can then also employ liveness transparently.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2430
 
+  InfoCache.FuncLoopInfoMap[&F] = &LoopInfoGetter(F);
+
----------------
I think you have to store the `LoopInfoGetter` in the `InfoCache` and query it each time. Thought, I might be wrong.


================
Comment at: llvm/test/Transforms/FunctionAttrs/read_write_returned_arguments_scc.ll:163
 ; CHECK-NOT: attributes #
 ; CHECK: attributes #{{.*}} = { nofree nosync nounwind }
+; CHECK: attributes #{{.*}} = { nofree norecurse nosync nounwind willreturn }
----------------
Can you add the `willreturn` to the `Function Attr:` check where it changed?


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

https://reviews.llvm.org/D65860





More information about the llvm-commits mailing list