[PATCH] D141768: [WIP][11/N][Clang][RISCV][NFC] Remove Policy::PolicyType::Omit

Yueh-Ting (eop) Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 14 08:09:56 PST 2023


eopXD created this revision.
Herald added subscribers: sunshaoce, VincentWu, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, arichardson.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.

The attribute can be removed now as preceeding patches have removed its
users.

Depends on D141767 <https://reviews.llvm.org/D141767>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141768

Files:
  clang/include/clang/Support/RISCVVIntrinsicUtils.h
  clang/lib/Support/RISCVVIntrinsicUtils.cpp


Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===================================================================
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -975,9 +975,8 @@
 }
 
 llvm::SmallVector<Policy> RVVIntrinsic::getSupportedUnMaskedPolicies() {
-  return {
-      Policy(Policy::PolicyType::Undisturbed, Policy::PolicyType::Omit), // TU
-      Policy(Policy::PolicyType::Agnostic, Policy::PolicyType::Omit)};   // TA
+  return {Policy(Policy::PolicyType::Undisturbed), // TU
+          Policy(Policy::PolicyType::Agnostic)};   // TA
 }
 
 llvm::SmallVector<Policy>
@@ -1035,28 +1034,33 @@
         BuiltinName += "_ta";
     }
   } else {
-    if (PolicyAttrs.isTUMAPolicy() && !HasMaskPolicy)
-      appendPolicySuffix("_tum");
-    else if (PolicyAttrs.isTAMAPolicy() && !HasMaskPolicy)
-      appendPolicySuffix("_tam");
-    else if (PolicyAttrs.isMUPolicy() && !HasTailPolicy)
-      appendPolicySuffix("_mu");
-    else if (PolicyAttrs.isMAPolicy() && !HasTailPolicy)
-      appendPolicySuffix("_ma");
-    else if (PolicyAttrs.isTUMUPolicy())
-      appendPolicySuffix("_tumu");
-    else if (PolicyAttrs.isTAMUPolicy())
-      appendPolicySuffix("_tamu");
-    else if (PolicyAttrs.isTUMAPolicy())
-      appendPolicySuffix("_tuma");
-    else if (PolicyAttrs.isTAMAPolicy())
-      appendPolicySuffix("_tama");
-    else if (PolicyAttrs.isTUPolicy() && !IsMasked)
-      appendPolicySuffix("_tu");
-    else if (PolicyAttrs.isTAPolicy() && !IsMasked)
-      appendPolicySuffix("_ta");
-    else
-      llvm_unreachable("Unhandled policy condition");
+    if (IsMasked) {
+      if (PolicyAttrs.isTUMAPolicy() && !HasMaskPolicy)
+        appendPolicySuffix("_tum");
+      else if (PolicyAttrs.isTAMAPolicy() && !HasMaskPolicy)
+        appendPolicySuffix("_tam");
+      else if (PolicyAttrs.isMUPolicy() && !HasTailPolicy)
+        appendPolicySuffix("_mu");
+      else if (PolicyAttrs.isMAPolicy() && !HasTailPolicy)
+        appendPolicySuffix("_ma");
+      else if (PolicyAttrs.isTUMUPolicy())
+        appendPolicySuffix("_tumu");
+      else if (PolicyAttrs.isTAMUPolicy())
+        appendPolicySuffix("_tamu");
+      else if (PolicyAttrs.isTUMAPolicy())
+        appendPolicySuffix("_tuma");
+      else if (PolicyAttrs.isTAMAPolicy())
+        appendPolicySuffix("_tama");
+      else
+        llvm_unreachable("Unhandled policy condition");
+    } else {
+      if (PolicyAttrs.isTUPolicy())
+        appendPolicySuffix("_tu");
+      else if (PolicyAttrs.isTAPolicy())
+        appendPolicySuffix("_ta");
+      else
+        llvm_unreachable("Unhandled policy condition");
+    }
   }
 }
 
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===================================================================
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -97,13 +97,13 @@
   enum PolicyType {
     Undisturbed,
     Agnostic,
-    Omit, // No policy required.
   };
   PolicyType TailPolicy = Agnostic;
   PolicyType MaskPolicy = Undisturbed;
   Policy() : IsUnspecified(true) {}
-  Policy(PolicyType _TailPolicy, PolicyType _MaskPolicy)
-      : TailPolicy(_TailPolicy), MaskPolicy(_MaskPolicy) {}
+  Policy(PolicyType TailPolicy) : TailPolicy(TailPolicy) {}
+  Policy(PolicyType TailPolicy, PolicyType MaskPolicy)
+      : TailPolicy(TailPolicy), MaskPolicy(MaskPolicy) {}
 
   bool isTAMAPolicy() const {
     return TailPolicy == Agnostic && MaskPolicy == Agnostic;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141768.489258.patch
Type: text/x-patch
Size: 3533 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230114/e426aac2/attachment-0001.bin>


More information about the cfe-commits mailing list