[llvm] [SROA] Do not canonicalize integer arrays to integers (PR #219416)

Yonah Goldberg via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 02:00:29 PDT 2026


https://github.com/YonahGoldberg created https://github.com/llvm/llvm-project/pull/219416

None

>From c4efa782e655f74f6f5a6d443cc5163cccbc0c7d Mon Sep 17 00:00:00 2001
From: Yonah Goldberg <ygoldberg at nvidia.com>
Date: Fri, 28 Aug 2026 08:55:05 +0000
Subject: [PATCH] [SROA] Do not canonicalize integer arrays to integers

---
 llvm/lib/Transforms/Scalar/SROA.cpp | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index e4770154e2998..bf082b3a01579 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -5458,13 +5458,6 @@ selectPartitionType(Partition &P, const DataLayout &DL, AllocaInst &AI,
   // type?
   if (Type *TypePartitionTy = getTypePartition(DL, AI.getAllocatedType(),
                                                P.beginOffset(), P.size())) {
-    // If the partition is an integer array that can be spanned by a legal
-    // integer type, prefer to represent it as a legal integer type because
-    // it's more likely to be promotable.
-    if (TypePartitionTy->isArrayTy() &&
-        TypePartitionTy->getArrayElementType()->isIntegerTy() &&
-        DL.isLegalInteger(P.size() * 8))
-      TypePartitionTy = Type::getIntNTy(C, P.size() * 8);
     // There was no common type used, so we prefer integer widening promotion.
     if (isIntegerWideningViable(P, TypePartitionTy, DL)) {
       LogSelection("type-partition-int-widen", TypePartitionTy, nullptr, true);



More information about the llvm-commits mailing list