<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Miss optimization for consecutive character equality testing"
href="https://bugs.llvm.org/show_bug.cgi?id=46965">46965</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Miss optimization for consecutive character equality testing
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zufuliu@163.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>For following code (online at <a href="https://godbolt.org/z/3oxx69">https://godbolt.org/z/3oxx69</a>)
```
template <typename T, typename... Args>
constexpr bool AnyOf(T t, Args... args) noexcept {
return ((t == args) || ...);
}
bool Escape1(int ch) noexcept {
return AnyOf(ch, '\\', '\'', '\"', 'a', 'b', 'e',
'f', 'n', 'r', 't', 'x', 'u', 'U');
}
bool Escape2(int ch) noexcept {
return ch == '\\' || ch == '\'' || ch == '\"'
|| ch == 'a' || ch == 'b' || ch == 'e'
|| ch == 'f' || ch == 'n' || ch == 'r' || ch == 't'
|| ch == 'x' || ch == 'u' || ch == 'U';
}
```
Clang (and GCC, ICC) generates different code for Escape1 and Escape2, while
MSVC generates identical code. Clang also generates different code when
parameter `int ch` is changed to `char ch`.</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>