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

30 lines
641 B
LLVM

; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
; Test that a lifetime intrinsic isn't removed because that would change semantics
; CHECK: foo
; CHECK: entry:
; CHECK: bb0:
; CHECK: bb1:
; CHECK: ret
define void @foo(i1 %x) {
entry:
%a = alloca i8
call void @llvm.lifetime.start.p0(ptr %a) nounwind
br i1 %x, label %bb0, label %bb1
bb0:
call void @llvm.lifetime.end.p0(ptr %a) nounwind
br label %bb1
bb1:
call void @f()
ret void
}
declare void @f()
declare void @llvm.lifetime.start.p0(ptr nocapture) nounwind
declare void @llvm.lifetime.end.p0(ptr nocapture) nounwind