<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - [LICM] Invariant llvm.memcpy is not hoisted out of loop."
href="https://bugs.llvm.org/show_bug.cgi?id=47709">47709</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[LICM] Invariant llvm.memcpy is not hoisted out of loop.
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Loop Optimizer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>florian_hahn@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>