<html>
<head>
<base href="http://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 --- - Form a switch from a loop if the loop is really switch-like"
href="http://llvm.org/bugs/show_bug.cgi?id=22020">22020</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Form a switch from a loop if the loop is really switch-like
</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>Loop Optimizer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.majnemer@gmail.com
</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>consider:
int f(char C) {
const char *Str = ",/\\:. \n\t\'-";
for (int i = 0, e = 10; i < e; ++i) {
if (Str[i] == C)
return i;
}
return -1;
}
this is another way of writing:
int f(char C) {
switch (C) {
case ',':
return 0;
case '/':
return 1;
case '\\':
return 2;
case ':'
return 3;
case '.':
return 4;
case ' ':
return 5;
case '\n':
return 6;
case '\t':
return 7;
case '\'':
return 8;
case '-'
return 9;
}
return -1;
}
we should canonicalize the first to the second. pathalogical switches should
be *lower* back to loops for performance.</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>