-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Open
Description
Reduced from a C++ class initialization. It should be possible to rewrite:
define void @src(ptr %a) {
%alloca = alloca <{ [2 x i8], i64, i64, i64 }>, align 2
%3 = getelementptr inbounds nuw i8, ptr %alloca, i64 2
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(24) %3, i8 0, i64 24, i1 false)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(26) %a, ptr noundef nonnull align 2 dereferenceable(26) %alloca, i64 26, i1 false)
ret void
}Into something like:
define void @tgt(ptr %a) {
%3 = getelementptr inbounds nuw i8, ptr %a, i64 2
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(24) %3, i8 0, i64 24, i1 false)
ret void
}Which eliminates an alloca and a copy, but LLVM current fails to do so: https://godbolt.org/z/hKqnzs7v7
dtcxzyw