<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 - SCEV expander assertion in LSR"
href="https://bugs.llvm.org/show_bug.cgi?id=35890">35890</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>SCEV expander assertion in LSR
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>opt
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>anna@azul.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=19648" name="attach_19648" title="input IR to pass with -loop-reduce">attachment 19648</a> <a href="attachment.cgi?id=19648&action=edit" title="input IR to pass with -loop-reduce">[details]</a></span>
input IR to pass with -loop-reduce
With the following bugpoint code attached, llvm trunk (without rL321550)
crashes when trying to retrieve a PostIncExpr because the PostIncExpr is not an
AddRecurrence.
rL321550 limits the depth in recursive call to getAddRec because we were
missing passing the depth.
I think the change only hides the actual problem in SCEV because limiting the
recursion depth is only a compile time restriction and not a functional
requirement. Is this correct?
Command to use:
opt -loop-reduce reduced.ll
Trunk with the following diff [1] still crashes with assertion failure:
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!")
when trying to cast the result of getAddRec into SCEVAddRecExpr:
#4 0x00007ffff5147dcc in llvm::cast<llvm::SCEVAddRecExpr, llvm::SCEV const> ()
Diff to apply is basically the revert of rL321550:
diff --git a/lib/Analysis/ScalarEvolution.cpp
b/lib/Analysis/ScalarEvolution.cpp
index 10b5c74e378..32fd05d2ea4 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -2358,7 +2358,7 @@ const SCEV
*ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
FoundMatch = true;
}
if (FoundMatch)
- return getAddExpr(Ops, Flags, Depth + 1);
+ return getAddExpr(Ops, Flags);
// Check for truncates. If all the operands are truncated from the same
// type, see if factoring out the truncate would permit the result to be</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>