[llvm] [SROA] Canonicalize homogeneous structs into fixed vectors (PR #165159)

Yonah Goldberg via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 14 09:35:56 PST 2026


================
@@ -546,6 +546,13 @@ class TargetTransformInfo {
   /// optimize away.
   LLVM_ABI unsigned getFlatAddressSpace() const;
 
+  /// Return the maximum size in bytes of a homogeneous struct that SROA should
+  /// canonicalize to a vector type. This enables better optimization of
+  /// tightly-packed structs on targets where scratch memory is expensive.
+  ///
+  /// \returns 0 to disable the transformation, or the maximum struct size.
----------------
YonahGoldberg wrote:

for next steps while waiting for one of the others to review, I'd recommend setting max-struct-to-vector=int max and running https://github.com/dtcxzyw/llvm-opt-benchmark to see if it regresses anything. There were no diffs when running it with 16. I'd be relatively confident we can remove the size limit if there are no regressions in llvm-opt-benchmark.

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


More information about the llvm-commits mailing list