<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 --- - Undef handling in constant folding"
href="http://llvm.org/bugs/show_bug.cgi?id=18355">18355</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Undef handling in constant folding
</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>Core LLVM classes
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>realprincewall@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>Let me use the code at
<a href="http://llvm.org/docs/doxygen/html/ConstantFold_8cpp_source.html">http://llvm.org/docs/doxygen/html/ConstantFold_8cpp_source.html</a> to explain the
problem.
In function llvm::ConstantFoldBinaryInstruction, Undef is handled first with a
switch block as quoted below. Note that there is no default case in the switch.
Therefore, Undef operations can go beyond the "if (isa<UndefValue>(C1) ||
isa<UndefValue>(C2)) " block.
00871 Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
00872 Constant *C1, Constant *C2)
{
00873 // Handle UndefValue up front.
00874 if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) {
00875 switch (Opcode) {
00876 case Instruction::Xor:
Is this intentional? As per the code below,
01038 // At this point we know neither constant is an UndefValue.
01039 if (ConstantInt *CI1 = dyn_cast<ConstantInt>(C1)) {
It is assumed that no Undef will reach there. Is this issue a missing default
case in switch or just bad comments? Thanks!</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>