[llvm] [ASan] Prevent assert from scalable vectors in FunctionStackPoisoner. (PR #155357)

Thurston Dang via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 27 04:00:33 PDT 2025


================
@@ -1219,7 +1219,8 @@ struct FunctionStackPoisoner : public InstVisitor<FunctionStackPoisoner> {
 
     std::optional<TypeSize> Size = AI->getAllocationSize(AI->getDataLayout());
     // Check that size is known and can be stored in IntptrTy.
-    if (!Size || !ConstantInt::isValueValidForType(IntptrTy, *Size))
+    if (!Size || Size->isScalable() ||
----------------
thurstond wrote:

The regression is specifically for lifetime intrinsics (e.g., as seen in the new test case) - the crash started happening after "[IR] Remove size argument from lifetime intrinsics" (https://github.com/llvm/llvm-project/pull/150248), because now ASan doesn't know the size of the alloca for:
```
  %ctx_pg = alloca <vscale x 16 x i1>, align 2
  call void @llvm.lifetime.start.p0(ptr %ctx_pg)
```
In the past, it could have used the size argument instead of trying to compute it.

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


More information about the llvm-commits mailing list