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

Shilei Tian via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 12 21:36: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);
----------------
shiltian wrote:

The logic here might look weird, but it preserves the current behavior prior to this PR.

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


More information about the cfe-commits mailing list