<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 --- - Redundent and instruction caused by switch condition operand shrinking"
href="https://llvm.org/bugs/show_bug.cgi?id=29009">29009</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Redundent and instruction caused by switch condition operand shrinking
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>wmi@google.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>Created <span class=""><a href="attachment.cgi?id=16969" name="attach_16969" title="testcase 1.cc">attachment 16969</a> <a href="attachment.cgi?id=16969&action=edit" title="testcase 1.cc">[details]</a></span>
testcase 1.cc
For the testcase 1.cc attached.
~/workarea/llvm-r278451/dbuild/bin/clang -O2 -S 1.cc
Here is the code to generate the index to access jump table:
movl njob(%rip), %eax
callq _Z3goov
movl %eax, %edx
andb $7, %dl
movl %eax, %ecx
andl $7, %ecx // There is redundency to compute "and $7, ..."
twice.
cmpb $7, %dl
je .LBB0_3
# BB#2: # %while.cond
# in Loop: Header=BB0_1 Depth=1
jmpq *.LJTI0_0(,%rcx,8)
Better code is:
.LBB0_1: # =>This Inner Loop Header: Depth=1
movl njob(%rip), %eax
callq _Z3goov
movl %eax, %ecx
andl $7, %ecx
cmpl $6, %ecx
ja .LBB0_3
# BB#2: # in Loop: Header=BB0_1 Depth=1
jmpq *.LJTI0_0(,%rcx,8)
Looks like it is caused by r274233 which allows illegal type generated when
shrinking switch condition operand.</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>