From e4b0531c526e7790c97c5de54859f2ad557e1e0c Mon Sep 17 00:00:00 2001 From: Dan Blackwell Date: Wed, 10 Dec 2025 16:05:15 +0000 Subject: [PATCH] [AArch64] Make StackTagging use alloca getAllocationSize rather than lifetime size This was causing zero sized setTags to be emitted when compiling with Swift with memtag-stack sanitization; this caused an assert in the backend 'N->getOpcode() != ISD::EntryToken && "EntryToken in CSEMap!"'. This patch does as the title says and replaces the use of the lifetime size argument with AllocaInst.getAllocationSize. rdar://164400893 --- llvm/lib/Target/AArch64/AArch64StackTagging.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp index 75c7dd944b467..35a0aa0ef7df3 100644 --- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp +++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp @@ -586,8 +586,7 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) { ClMaxLifetimes); if (StandardLifetime) { IntrinsicInst *Start = Info.LifetimeStart[0]; - uint64_t Size = - cast(Start->getArgOperand(0))->getZExtValue(); + uint64_t Size = *Info.AI->getAllocationSize(*DL); Size = alignTo(Size, kTagGranuleSize); tagAlloca(AI, Start->getNextNode(), TagPCall, Size);