[llvm] [MemoryLocation] Compute lifetime size from alloca size (PR #151982)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 4 10:38:23 PDT 2025
================
@@ -1104,29 +1105,23 @@ TEST_F(MemorySSATest, LifetimeMarkersAreClobbers) {
// it.
IRBuilder<> B(C);
- F = Function::Create(FunctionType::get(B.getVoidTy(), {B.getPtrTy()}, false),
+ F = Function::Create(FunctionType::get(B.getVoidTy(), {}, false),
GlobalValue::ExternalLinkage, "F", &M);
// Make blocks
BasicBlock *Entry = BasicBlock::Create(C, "entry", F);
B.SetInsertPoint(Entry);
- Value *Foo = &*F->arg_begin();
+ Value *Foo = B.CreateAlloca(B.getInt32Ty());
Value *Bar = B.CreatePtrAdd(Foo, B.getInt64(1), "bar");
Value *Baz = B.CreatePtrAdd(Foo, B.getInt64(2), "baz");
B.CreateStore(B.getInt8(0), Foo);
B.CreateStore(B.getInt8(0), Bar);
- auto GetLifetimeIntrinsic = [&](Intrinsic::ID ID) {
- return Intrinsic::getOrInsertDeclaration(&M, ID, {Foo->getType()});
- };
-
- B.CreateCall(GetLifetimeIntrinsic(Intrinsic::lifetime_end),
- {B.getInt64(3), Foo});
- Instruction *LifetimeStart = B.CreateCall(
- GetLifetimeIntrinsic(Intrinsic::lifetime_start), {B.getInt64(3), Foo});
+ B.CreateLifetimeEnd(Foo, B.getInt64(3));
----------------
dtcxzyw wrote:
The size argument is removed in https://github.com/llvm/llvm-project/pull/150248/files#diff-16948aeaf132f6b1a976b2d2f9cd58673b70ca216a46c4e846267813b16707e0.
https://github.com/llvm/llvm-project/pull/151982
More information about the llvm-commits
mailing list