<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 --- - SimplifyCFG may de-optimize code with highly predictable branches"
href="https://llvm.org/bugs/show_bug.cgi?id=24743">24743</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>SimplifyCFG may de-optimize code with highly predictable branches
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Transformation Utilities
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>spatel+llvm@rotateright.com
</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>As mentioned in:
<a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - bad generated code for conditionals connected by (&)"
href="show_bug.cgi?id=23827#c7">https://llvm.org/bugs/show_bug.cgi?id=23827#c7</a>
SimplifyCFG (eg, FoldBranchToCommonDest()) transforms code based on a static
"BonusInstThreshold". This can waste time because this change in the CFG may
later be undone in CodeGenPrepare::splitBranchCondition() or
SelectionDAGBuilder::visitBr().
Without external information (target hook, profile data, or programmer hint) to
justify the transform, SimplifyCFG shouldn't be doing this:
$ cat predictable_branches.ll
define void @x_or_y(i32 %x, i32 %y) #0 {
entry:
%cmp = icmp slt i32 %x, 3
br i1 %cmp, label %if.then, label %lhs.false
lhs.false:
%cmp1 = icmp sgt i32 %y, 10
br i1 %cmp1, label %if.then, label %end
if.then:
%call = call i32 (...) @foo() #2
br label %end
end:
ret void
}
declare i32 @foo(...) #1
$ ./opt -simplifycfg predictable_branches.ll -S
define void @x_or_y(i32 %x, i32 %y) {
entry:
%cmp = icmp slt i32 %x, 3
%cmp1 = icmp sgt i32 %y, 10
%or.cond = or i1 %cmp, %cmp1
br i1 %or.cond, label %if.then, label %end
if.then:
%call = call i32 (...) @foo()
br label %end
end:
ret void
}</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>