[llvm] Patch tryCanonicalizeStructToVector to handle split slice tails (PR #201434)
Yaxun Liu via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 8 07:06:04 PDT 2026
================
@@ -5131,20 +5131,27 @@ static FixedVectorType *tryCanonicalizeStructToVector(StructType *STy,
if (StructSize != VectorSize)
return nullptr;
- for (const Slice &S : P) {
+ auto IsMemIntrinsicOnlySlice = [](const Slice &S) {
if (S.isDead())
- continue;
+ return true;
auto *U = S.getUse();
if (!U)
- continue;
+ return true;
User *Usr = U->getUser();
if (isa<LifetimeIntrinsic>(Usr) || isa<DbgInfoIntrinsic>(Usr))
- continue;
+ return true;
- if (!isa<MemIntrinsic>(Usr))
+ return isa<MemIntrinsic>(Usr);
+ };
+
+ for (const Slice &S : P)
+ if (!IsMemIntrinsicOnlySlice(S))
+ return nullptr;
+
----------------
yxsamliu wrote:
The comment above says "all users of the alloca", but this check is partition-local: it accepts the conversion when all users overlapping this partition are mem/lifetime/debug-like. Maybe clarify that wording now that split tails are part of the check.
https://github.com/llvm/llvm-project/pull/201434
More information about the llvm-commits
mailing list