From 053cf9f5940a0472ede8b5a640d7d81800260c21 Mon Sep 17 00:00:00 2001 From: Hideto Ueno Date: Tue, 8 Oct 2019 15:20:19 +0000 Subject: [PATCH] [Attributor] Add helper class to compose two structured deduction. Summary: 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. Reviewers: jdoerfert, sstefan1 Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66645 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374060 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/Attributor.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/Transforms/IPO/Attributor.cpp b/lib/Transforms/IPO/Attributor.cpp index 629be921fb4..3a1562252f5 100644 --- a/lib/Transforms/IPO/Attributor.cpp +++ b/lib/Transforms/IPO/Attributor.cpp @@ -560,6 +560,21 @@ static void clampReturnedValueStates(Attributor &A, const AAType &QueryingAA, S ^= *T; } +/// Helper class to compose two generic deduction +template class F, template class G> +struct AAComposeTwoGenericDeduction + : public F, StateType> { + AAComposeTwoGenericDeduction(const IRPosition &IRP) + : F, StateType>(IRP) {} + + /// See AbstractAttribute::updateImpl(...). + ChangeStatus updateImpl(Attributor &A) override { + return F, StateType>::updateImpl(A) | + G::updateImpl(A); + } +}; + /// Helper class for generic deduction: return value -> returned position. template -- 2.40.0