-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Closed
Labels
crash-on-validllvm:GVNGVN and NewGVN stages (Global value numbering)GVN and NewGVN stages (Global value numbering)regression
Description
https://godbolt.org/z/sK5aYrfhs
define ptr @foobar(ptr %this, ptr %RHS) {
entry:
store volatile i32 0, ptr %this, align 4
%call2 = call ptr @bar(ptr %this, ptr %RHS)
ret ptr %call2
}
define ptr @bar(ptr %this, ptr %RHS) {
entry:
%cmp = icmp eq ptr %this, %RHS
call void @llvm.assume(i1 %cmp)
ret ptr null
}
define i1 @foo(ptr %Builder) {
entry:
%Result = alloca { [24 x i8] }, align 8
%0 = call ptr @foobar(ptr %Result, ptr %Builder)
call void @llvm.lifetime.end.p0(i64 0, ptr %Result)
ret i1 false
}
opt -O2
produces
llvm.lifetime.start/end can only be used on alloca
call void @llvm.lifetime.end.p0(i64 0, ptr nonnull %Builder)
It is a result of GVN
; *** IR Dump After MergedLoadStoreMotionPass on foo ***
define i1 @foo(ptr readnone captures(address) %Builder) local_unnamed_addr {
entry:
%Result = alloca { [24 x i8] }, align 8
store volatile i32 0, ptr %Result, align 4
%cmp.i.i = icmp eq ptr %Result, %Builder
call void @llvm.assume(i1 %cmp.i.i)
call void @llvm.lifetime.end.p0(i64 0, ptr nonnull %Result)
ret i1 false
}
; *** IR Dump After GVNPass on foo ***
define i1 @foo(ptr readnone captures(address) %Builder) local_unnamed_addr {
entry:
%Result = alloca { [24 x i8] }, align 8
store volatile i32 0, ptr %Result, align 4
%cmp.i.i = icmp eq ptr %Result, %Builder
call void @llvm.assume(i1 %cmp.i.i)
call void @llvm.lifetime.end.p0(i64 0, ptr nonnull %Builder)
ret i1 false
}
Metadata
Metadata
Assignees
Labels
crash-on-validllvm:GVNGVN and NewGVN stages (Global value numbering)GVN and NewGVN stages (Global value numbering)regression