[llvm-branch-commits] [clang] 46d945d - [15/15][Clang][RISCV][NFC] Set data member under Policy as constants

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Feb 5 12:11:31 PST 2023


Author: eopXD
Date: 2023-02-05T21:10:40+01:00
New Revision: 46d945d6f18263df7dae8cbd2ed4729093055f8a

URL: https://github.com/llvm/llvm-project/commit/46d945d6f18263df7dae8cbd2ed4729093055f8a
DIFF: https://github.com/llvm/llvm-project/commit/46d945d6f18263df7dae8cbd2ed4729093055f8a.diff

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

The object is now correct by construction.

This is the 15th commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.

Please refer to the cover letter in the 1st commit (D141573) for an
overview.

Depends on D141793.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D141796

Added: 
    

Modified: 
    clang/include/clang/Support/RISCVVIntrinsicUtils.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Support/RISCVVIntrinsicUtils.h b/clang/include/clang/Support/RISCVVIntrinsicUtils.h
index fc53d70019c55..415179a6f441a 100644
--- a/clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ b/clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -92,15 +92,22 @@ enum class TypeModifier : uint8_t {
   LLVM_MARK_AS_BITMASK_ENUM(LMUL1),
 };
 
-struct Policy {
-  bool IsUnspecified = false;
+class Policy {
+public:
   enum PolicyType {
     Undisturbed,
     Agnostic,
   };
-  PolicyType TailPolicy = Agnostic;
-  PolicyType MaskPolicy = Agnostic;
+  bool IsUnspecified = false;
+
+private:
+  // 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;
   bool HasTailPolicy, HasMaskPolicy;
+
+public:
   Policy(bool HasTailPolicy, bool HasMaskPolicy)
       : IsUnspecified(true), HasTailPolicy(HasTailPolicy),
         HasMaskPolicy(HasMaskPolicy) {}


        


More information about the llvm-branch-commits mailing list