[PATCH] D141575: [WIP][3/N][Clang][RISCV][NFC] Clarify edge cases of RVVIntrinsic::getSupportedMaskedPolicies for clarity

Yueh-Ting (eop) Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 12 03:14:23 PST 2023


eopXD updated this revision to Diff 488580.
eopXD added a comment.

Bump CI


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141575

Files:
  clang/lib/Support/RISCVVIntrinsicUtils.cpp


Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===================================================================
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -13,6 +13,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
 #include <numeric>
 #include <optional>
@@ -998,16 +999,18 @@
                    Policy::PolicyType::Undisturbed), // TUMU
             Policy(Policy::PolicyType::Agnostic,
                    Policy::PolicyType::Undisturbed)}; // TAMU
-
-  if (HasTailPolicy)
+  if (HasTailPolicy && !HasMaskPolicy)
     return {Policy(Policy::PolicyType::Undisturbed,
                    Policy::PolicyType::Agnostic, true), // TUM
             Policy(Policy::PolicyType::Agnostic, Policy::PolicyType::Agnostic,
                    true)}; // TAM
-
-  return {
-      Policy(Policy::PolicyType::Omit, Policy::PolicyType::Agnostic),     // MA
-      Policy(Policy::PolicyType::Omit, Policy::PolicyType::Undisturbed)}; // MU
+  if (!HasTailPolicy && HasMaskPolicy)
+    return {
+        Policy(Policy::PolicyType::Omit, Policy::PolicyType::Agnostic), // MA
+        Policy(Policy::PolicyType::Omit,
+               Policy::PolicyType::Undisturbed)}; // MU
+  llvm_unreachable("An RVV instruction should not be without both tail policy "
+                   "and mask policy");
 }
 
 void RVVIntrinsic::updateNamesAndPolicy(bool IsMasked, bool HasPolicy,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141575.488580.patch
Type: text/x-patch
Size: 1545 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230112/fef7e6f4/attachment-0001.bin>


More information about the cfe-commits mailing list