<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 --- - metadata on branch not preserved with loop unswitch" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23851&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=EmKdpUYFYky8pSrTl2f2fHJxrdiNBDiZF7fjZWMOGX8&s=HH926xhHg2h5MGBQvo_OGibIaySGNKrrEaLAjnuYkls&e=">23851</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>metadata on branch not preserved with loop unswitch
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>weimingz@codeaurora.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The metadata attached with the unswitched branch was not preserved.
test case:
;RUN: opt -loop-unswitch -simplifycfg -S < %s | FileCheck %s
define i32 @foo(i32 %a, i32 %b) {
;CHECK-LABEL: foo
entry:
br label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%cmp.10 = icmp sgt i32 %b, 0
br i1 %cmp.10, label %for.body, label %for.cond.cleanup
for.body: ; preds = %for.inc,
%for.body.lr.ph
%i.013 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
%t2.012 = phi i32 [ 200, %for.body.lr.ph ], [ %t2.1, %for.inc ]
%t1.011 = phi i32 [ 100, %for.body.lr.ph ], [ %t1.1, %for.inc ]
%cmp1 = icmp eq i32 %a, 12345
br i1 %cmp1, label %if.then, label %if.else, !prof !0
; CHECK: %cmp1 = icmp eq i32 %a, 12345
; CHECK-NEXT: br i1 %cmp1, label %if.then.us, label %if.else, !prof !0
if.then: ; preds = %for.body
; CHECK: if.then.us:
; CHECK: %shr.us = ashr i32 %b, 1
; CHECK: tail call i32 @bar(i32 %shr.us)
; CHECK: add nuw nsw i32 %i.{{.*}}, 1
; CHECK: %exitcond.us = icmp eq i32 %inc.us, %b
; CHECK: br i1 %exitcond.us, label %for.cond.cleanup, label %if.then.us
%shr = ashr i32 %b, 1
%call = tail call i32 @bar(i32 %shr)
%add = add nsw i32 %call, %t1.011
br label %for.inc
if.else: ; preds = %for.body
%call2 = tail call i32 @bar(i32 %b)
%mul = mul nsw i32 %call2, %t2.012
br label %for.inc
; CHECK: if.else:
; CHECK: tail call i32 @bar(i32 %b)
; CHECK: %inc = add nuw nsw i32 %i.{{[0-9]+}}, 1
; CHECK: %exitcond = icmp eq i32 %inc, %b
; CHECK: br i1 %exitcond, label %for.cond.cleanup, label %if.else
for.inc: ; preds = %if.then, %if.else
%t1.1 = phi i32 [ %add, %if.then ], [ %t1.011, %if.else ]
%t2.1 = phi i32 [ %t2.012, %if.then ], [ %mul, %if.else ]
%inc = add nuw nsw i32 %i.013, 1
%exitcond = icmp eq i32 %inc, %b
br i1 %exitcond, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.inc,
%for.body.lr.ph
%t2.0.lcssa = phi i32 [ 200, %for.body.lr.ph ], [ %t2.1, %for.inc ]
%t1.0.lcssa = phi i32 [ 100, %for.body.lr.ph ], [ %t1.1, %for.inc ]
%add3 = add nsw i32 %t2.0.lcssa, %t1.0.lcssa
ret i32 %add3
}
;CHECK: !0 = !{!"branch_weights", {{.*}}}
declare i32 @bar(i32)
!0 = !{!"branch_weights", i32 64, i32 4}</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>