Nikita Popov c23b4fbdbb
[IR] Remove size argument from lifetime intrinsics (#150248)
Now that #149310 has restricted lifetime intrinsics to only work on
allocas, we can also drop the explicit size argument. Instead, the size
is implied by the alloca.

This removes the ability to only mark a prefix of an alloca alive/dead.
We never used that capability, so we should remove the need to handle
that possibility everywhere (though many key places, including stack
coloring, did not actually respect this).
2025-08-08 11:09:34 +02:00

35 lines
722 B
LLVM

; RUN: opt < %s -passes=instcombine -S | grep "ret i32 %A"
; RUN: opt < %s -passes=dce -S | not grep call.*llvm
define i32 @test(i32 %A) {
%X = or i1 false, false
br i1 %X, label %T, label %C
T: ; preds = %0
%B = add i32 %A, 1
br label %C
C: ; preds = %T, %0
%C.upgrd.1 = phi i32 [ %B, %T ], [ %A, %0 ]
ret i32 %C.upgrd.1
}
define ptr @test2(i32 %width) {
%tmp = call ptr @llvm.stacksave( )
%tmp14 = alloca i32, i32 %width
ret ptr %tmp14
}
declare ptr @llvm.stacksave()
declare void @llvm.lifetime.start.p0(ptr)
declare void @llvm.lifetime.end.p0(ptr)
define void @test3() {
%a = alloca i32
call void @llvm.lifetime.start.p0(ptr %a)
call void @llvm.lifetime.end.p0(ptr %a)
ret void
}