[llvm] 6d160a4 - [AMDGPU][TableGen][NFC] Combine predicates without using classes. (#82346)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 21 03:45:40 PST 2024
Author: Ivan Kosarev
Date: 2024-02-21T11:45:36Z
New Revision: 6d160a49c2e7f36367de3f61f0460e28921450d5
URL: https://github.com/llvm/llvm-project/commit/6d160a49c2e7f36367de3f61f0460e28921450d5
DIFF: https://github.com/llvm/llvm-project/commit/6d160a49c2e7f36367de3f61f0460e28921450d5.diff
LOG: [AMDGPU][TableGen][NFC] Combine predicates without using classes. (#82346)
Saves generating ~1200 instances of the PredConcat TableGen class.
Also removes the default predicates from resulting predicate lists.
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUPredicateControl.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPredicateControl.td b/llvm/lib/Target/AMDGPU/AMDGPUPredicateControl.td
index 6c7c91ef464dfd..7c990aa6b2eb60 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUPredicateControl.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPUPredicateControl.td
@@ -11,11 +11,6 @@ def TruePredicate : Predicate<"">;
// FIXME: Tablegen should specially supports this
def FalsePredicate : Predicate<"false">;
-// Add a predicate to the list if does not already exist to deduplicate it.
-class PredConcat<Predicate pred, list<Predicate> lst> {
- list<Predicate> ret = !listconcat(lst, !listremove([pred], lst));
-}
-
// Prevent using other kinds of predicates where True16 predicates are
// expected by giving them their own class.
class True16PredicateClass<string cond> : Predicate<cond>;
@@ -28,9 +23,8 @@ class PredicateControl {
True16PredicateClass True16Predicate = NoTrue16Predicate;
list<Predicate> OtherPredicates = [];
list<Predicate> Predicates =
- PredConcat<SubtargetPredicate,
- PredConcat<AssemblerPredicate,
- PredConcat<WaveSizePredicate,
- PredConcat<True16Predicate,
- OtherPredicates>.ret>.ret>.ret>.ret;
+ !foldl(OtherPredicates, [SubtargetPredicate, AssemblerPredicate,
+ WaveSizePredicate, True16Predicate],
+ preds, p,
+ preds # !listremove([p], [TruePredicate, NoTrue16Predicate] # preds));
}
More information about the llvm-commits
mailing list