https://bugs.llvm.org/show_bug.cgi?id=47709
Bug ID: 47709
Summary: [LICM] Invariant llvm.memcpy is not hoisted out of
loop.
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
In the example below, both operands of the llvm.memcpy calls are loop-invariant
and do not alias. They should be hoisted out of the loop, but are not.
define i32 @main(i8* %ptr.0) {
entry:
%identity = alloca [48 x i8], align 4
%identity.0 = bitcast [48 x i8]* %identity to i8*
%identity.1 = getelementptr inbounds [48 x i8], [48 x i8]* %identity, i64 0,
i64 16
%identity.2 = getelementptr inbounds [48 x i8], [48 x i8]* %identity, i64 0,
i64 32
call void @llvm.memset.p0i8.i64(i8* nonnull align 4 dereferenceable(16)
%identity.0, i8 0, i64 16, i1 false)
call void @llvm.memset.p0i8.i64(i8* nonnull align 4 dereferenceable(16)
%identity.1, i8 0, i64 16, i1 false)
call void @llvm.memset.p0i8.i64(i8* nonnull align 4 dereferenceable(16)
%identity.2, i8 0, i64 16, i1 false)
%ptr.1 = getelementptr inbounds i8, i8* %ptr.0, i64 16
%ptr.2 = getelementptr inbounds i8, i8* %ptr.0, i64 32
br label %loop
loop: ; preds = %loop, %entry
%run.096 = phi i32 [ 0, %entry ], [ %inc.1, %loop ]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 4 dereferenceable(16)
%ptr.0, i8* nonnull align 4 dereferenceable(16) %identity.0, i64 16, i1 false)
call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 4 dereferenceable(16)
%ptr.1, i8* nonnull align 4 dereferenceable(16) %identity.1, i64 16, i1 false)
call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 4 dereferenceable(16)
%ptr.2, i8* nonnull align 4 dereferenceable(16) %identity.2, i64 16, i1 false)
%inc.1 = add nuw nsw i32 %run.096, 1
%exitcond98.not = icmp eq i32 %run.096, 24
br i1 %exitcond98.not, label %exit, label %loop
exit: ; preds = %loop
ret i32 1
}
; Function Attrs: argmemonly nounwind willreturn writeonly
declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg)
#0
; Function Attrs: argmemonly nounwind willreturn
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8*
noalias nocapture readonly, i64, i1 immarg) #1
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs