<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - Vector and scalar loop being dead code"
href="https://llvm.org/bugs/show_bug.cgi?id=25705">25705</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Vector and scalar loop being dead code
</td>
</tr>
<tr>
<th>Product</th>
<td>Projects
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Polly
</td>
</tr>
<tr>
<th>Assignee</th>
<td>polly-dev@googlegroups.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>chrisj@codeaurora.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=15379" name="attach_15379" title="reduced test">attachment 15379</a> <a href="attachment.cgi?id=15379&action=edit" title="reduced test">[details]</a></span>
reduced test
opt -polly-process-unprofitable -polly-code-generator=isl -polly-scops
-polly-codegen test.ll -S
Both the scalar version and vector loop body polly.stmt.for.body end up being
dead code,
polly.preload.begin:
br i1 true, label %polly.start, label %for.body
for.body:
%i.034 = phi i32 [ %inc, %for.body ], [ 0, %polly.preload.begin ]
%arrayidx = getelementptr inbounds i16, i16* %2, i32 %i.034
%3 = load i16, i16* %arrayidx, align 2
%add = add i16 %3, 10
store i16 %add, i16* %arrayidx, align 2
%inc = add nuw nsw i32 %i.034, 1
%cmp = icmp slt i32 %inc, %1
br i1 %cmp, label %for.body, label %for.cond2.preheader
..
..
..
polly.loop_if:
br i1 false, label %polly.loop_preheader, label %polly.loop_exit
polly.loop_header:
%polly.indvar = phi i64 [ 0, %polly.loop_preheader ], [ %polly.indvar_next,
%polly.stmt.for.body ]
br label %polly.stmt.for.body
polly.stmt.for.body:
%10 = trunc i64 %polly.indvar to i32
%11 = shl i32 %10, 1
%scevgep = getelementptr i8, i8* %call, i32 %11
%scevgep1 = bitcast i8* %scevgep to i16*
%_p_scalar_ = load i16, i16* %scevgep1, align 2, !alias.scope !0, !noalias !2
%p_add = add i16 %_p_scalar_, 10
store i16 %p_add, i16* %scevgep1, align 2, !alias.scope !0, !noalias !2
%12 = trunc i64 %polly.indvar to i32
%13 = add i32 %12, 1
%p_cmp = icmp slt i32 %13, %1
%polly.indvar_next = add nsw i64 %polly.indvar, 1
%polly.loop_cond = icmp slt i64 %polly.indvar, -1
br i1 %polly.loop_cond, label %polly.loop_header, label %polly.loop_exit
polly.loop_preheader:
br label %polly.loop_header
When run with -simplifycfg
define void @foo1() #0 {
entry:
%0 = load i32, i32* @n, align 4
%call = tail call i8* @foo(i32 %0)
store i8* %call, i8** bitcast (i16** @A to i8**), align 4
%1 = load i32, i32* @n, align 4
%cmp33 = icmp sgt i32 %1, 0
%2 = bitcast i8* %call to i16*
br i1 %cmp33, label %polly.stmt.for.body2, label %for.end20
for.end20: ; preds =
%polly.stmt.for.body2, %entry
ret void
polly.stmt.for.body2: ; preds = %entry
%scevgep3 = getelementptr i8, i8* %call, i32 0
%scevgep34 = bitcast i8* %scevgep3 to i16*
%_p_scalar_5 = load i16, i16* %scevgep34, align 2, !alias.scope !0, !noalias
!2
%p_add6 = add i16 %_p_scalar_5, 10
store i16 %p_add6, i16* %scevgep34, align 2, !alias.scope !0, !noalias !2
%p_cmp7 = icmp slt i32 1, %1
br label %for.end20
}</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>