[PATCH] D141796: [15/15][Clang][RISCV][NFC] Set data member under Policy as constants

Yueh-Ting (eop) Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 19 01:15:50 PST 2023


eopXD updated this revision to Diff 490407.
eopXD marked an inline comment as done.
eopXD added a comment.

Bump CI.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141796

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
@@ -1011,7 +1011,6 @@
   };
 
   if (PolicyAttrs.isUnspecified()) {
-    PolicyAttrs.IsUnspecified = false;
     if (IsMasked) {
       Name += "_m";
       if (HasPolicy)
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===================================================================
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -92,14 +92,21 @@
   LLVM_MARK_AS_BITMASK_ENUM(LMUL1),
 };
 
-struct Policy {
-  bool IsUnspecified = false;
+class Policy {
+public:
   enum PolicyType {
     Undisturbed,
     Agnostic,
   };
-  PolicyType TailPolicy = Agnostic;
-  PolicyType MaskPolicy = Agnostic;
+
+private:
+  const bool IsUnspecified = false;
+  // The default assumption for an RVV instruction is TAMA, as an undisturbed
+  // policy generally will affect the performance of an out-of-order core.
+  const PolicyType TailPolicy = Agnostic;
+  const PolicyType MaskPolicy = Agnostic;
+
+public:
   Policy() : IsUnspecified(true) {}
   Policy(PolicyType TailPolicy) : TailPolicy(TailPolicy) {}
   Policy(PolicyType TailPolicy, PolicyType MaskPolicy)
@@ -419,7 +426,6 @@
     return IntrinsicTypes;
   }
   Policy getPolicyAttrs() const {
-    assert(PolicyAttrs.IsUnspecified == false);
     return PolicyAttrs;
   }
   unsigned getPolicyAttrsBits() const {
@@ -430,8 +436,6 @@
     // constexpr unsigned RVV_VMA = 0x2;
     // int PolicyAttrs = 0;
 
-    assert(PolicyAttrs.IsUnspecified == false);
-
     if (PolicyAttrs.isTUMAPolicy())
       return 2;
     if (PolicyAttrs.isTAMAPolicy())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141796.490407.patch
Type: text/x-patch
Size: 1788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230119/3dcbf28f/attachment.bin>


More information about the cfe-commits mailing list