<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 - InstCombine incorrectly optimizes `select`s with conditionally undef values"
href="https://bugs.llvm.org/show_bug.cgi?id=43879">43879</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>InstCombine incorrectly optimizes `select`s with conditionally undef values
</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>Linux
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>george.burgess.iv@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Found while trying to bootstrap clang-tidy.
The intent of the repro is to call @bar() once and return false if `%B` is
true. Otherwise, it should loop calling @bar() forever. (The non-reduced code
isn't an infloop, but the infloop doesn't appear to make a difference here)
[ub] ~/l/t/gbiv_repro [ 20ms ] ((6082a062…)) ~> git rev-parse HEAD
6082a062a76d0bc9c9c641f5600569bafdf4c338
[ub] ~/l/t/gbiv_repro [ 5ms ] ((6082a062…)) ~> cat repro.ll
declare void @bar()
define dso_local i1 @_Z3foob(i1 zeroext %B) local_unnamed_addr #0 {
entry:
br label %loop
loop:
%x = phi i1 [ undef, %entry ], [ %foo, %loop.end ]
call void @bar()
br label %loop.end
loop.end:
%foo = select i1 %B, i1 false, i1 %x
br i1 %B, label %return, label %loop
return:
ret i1 %foo
}
[ub] ~/l/t/gbiv_repro [ 2ms ] ((6082a062…)) ~> ../build/release/bin/opt
-instcombine < repro.ll -S
; ModuleID = '<stdin>'
source_filename = "<stdin>"
declare void @bar()
define dso_local i1 @_Z3foob(i1 zeroext %B) local_unnamed_addr {
entry:
br label %loop
loop: ; preds = %loop.end, %entry
call void @bar()
br label %loop.end
loop.end: ; preds = %loop
br i1 %B, label %return, label %loop
return: ; preds = %loop.end
ret i1 undef
}
AIUI, select should block undef from entering the program if %B is true, so the
`ret i1 undef` shouldn't be possible.</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>