[PATCH] D66645: [Attributor] Add helper class to compose two structured deduction.

Hideto Ueno via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 05:32:56 PDT 2019


uenoku created this revision.
uenoku added reviewers: jdoerfert, sstefan1.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

This patch introduces a generic way to compose two structured deductions.  This will be used for composing generic deduction with `MustBeExecutedExplorer` and other existing generic deduction.


https://reviews.llvm.org/D66645

Files:
  llvm/lib/Transforms/IPO/Attributor.cpp


Index: llvm/lib/Transforms/IPO/Attributor.cpp
===================================================================
--- llvm/lib/Transforms/IPO/Attributor.cpp
+++ llvm/lib/Transforms/IPO/Attributor.cpp
@@ -700,6 +700,21 @@
   DenseSet<const StateType *> InterestingAbstractState;
 };
 
+/// Helper class to compose two generic deduction
+template <typename AAType, typename Base, typename StateType,
+          template <typename...> class F, template <typename...> class G>
+struct AAComposeTwoGenericDeduction
+    : public F<AAType, G<AAType, Base, StateType>, StateType> {
+  AAComposeTwoGenericDeduction(const IRPosition &IRP)
+      : F<AAType, G<AAType, Base, StateType>, StateType>(IRP) {}
+
+  /// See AbstractAttribute::updateImpl(...).
+  ChangeStatus updateImpl(Attributor &A) override {
+    return F<AAType, G<AAType, Base, StateType>, StateType>::updateImpl(A) |
+           G<AAType, Base, StateType>::updateImpl(A);
+  }
+};
+
 /// Helper class for generic replication: function returned -> cs returned.
 template <typename AAType, typename Base>
 struct AACallSiteReturnedFromReturned : public Base {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66645.216814.patch
Type: text/x-patch
Size: 1117 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190823/ecb5cb3f/attachment.bin>


More information about the llvm-commits mailing list