[clang] [Clang] Remove 3-element vector load and store special handling (PR #104661)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 15 17:39:53 PST 2024


================
@@ -1846,6 +1846,16 @@ class TargetInfo : public TransferrableTargetInfo,
     return std::make_pair(64, 64);
   }
 
+  /// Returns the optimal vector type elements based on the provided vector
+  /// type. For example, on some targets, a vector with 3 elements may be
+  /// treated as one with 4 elements to enhance performance.
+  virtual llvm::FixedVectorType *
+  getOptimalVectorType(llvm::FixedVectorType *T, const LangOptions &Opt) const {
+    if (!Opt.HLSL && T->getNumElements() == 3)
+      return llvm::FixedVectorType::get(T->getElementType(), 4);
----------------
arsenm wrote:

I think it would be better to keep this in a LangOptions field, regardless of whether we keep the flag or not.

https://github.com/llvm/llvm-project/pull/104661


More information about the cfe-commits mailing list