<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 - Stack overflow in PeepHoleOptimizer"
href="https://bugs.llvm.org/show_bug.cgi?id=37273">37273</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Stack overflow in PeepHoleOptimizer
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0
</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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.l.kreitzer@intel.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=20236" name="attach_20236" title="Reproducer compile as "llc bugpoint-reduced-function.bc"">attachment 20236</a> <a href="attachment.cgi?id=20236&action=edit" title="Reproducer compile as "llc bugpoint-reduced-function.bc"">[details]</a></span>
Reproducer compile as "llc bugpoint-reduced-function.bc"
The attached test case crashes llc due to deep recursion in this function:
TargetInstrInfo::RegSubRegPair
getNewSource(MachineRegisterInfo *MRI, const TargetInstrInfo *TII,
TargetInstrInfo::RegSubRegPair Def,
PeepholeOptimizer::RewriteMapTy &RewriteMap,
bool HandleMultipleSources = true) {
I think this is because PeepholeOptimizer::findNextSource returns true even
though the RewritePHILimit is reached.
I confirmed that the following patch fixes the problem even though it was
intended to be NFC. It restructured the findNextSource code in such a way that
exceeding RewritePHILimit will always cause the routine to return false.
commit e5f83314a1df7ef7843f904da01f2aa236bbe7f0
Author: Matthias Braun <<a href="mailto:matze@braunis.de">matze@braunis.de</a>>
Date: Thu Jan 11 22:59:33 2018 +0000
PeepholeOpt cleanup/refactor; NFC
- Less unnecessary use of `auto`
- Add early `using RegSubRegPair(AndIdx) =` to avoid countless
`TargetInstrInfo::` qualifications.
- Use references instead of pointers where possible.
- Remove unused parameters.
- Rewrite the CopyRewriter class hierarchy:
- Pull out uncoalescable copy rewriting functionality into
PeepholeOptimizer class.
- Use an abstract base class to make it clear that rewriters are
independent.
- Remove unnecessary \brief in doxygen comments.
- Remove unused constructor and method from ValueTracker.
- Replace UseAdvancedTracking of ValueTracker with DisableAdvCopyOpt use.</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>