<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 - CodeExtractor makes phi nodes with incoming values from the outlined function"
href="https://bugs.llvm.org/show_bug.cgi?id=39433">39433</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>CodeExtractor makes phi nodes with incoming values from the outlined function
</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>Transformation Utilities
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vsk@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>This test case is pulled from CodeExtractorTest.cpp (in unittests/).
```
define i32 @foo(i32 %x, i32 %y, i32 %z) {
header:
%0 = icmp ugt i32 %x, %y
br i1 %0, label %body1, label %body2
body1:
%1 = add i32 %z, 2
br label %notExtracted
body2:
%2 = mul i32 %z, 7
br label %notExtracted
notExtracted:
%3 = phi i32 [ %1, %body1 ], [ %2, %body2 ]
%4 = add i32 %3, %x
ret i32 %4
}
```
When extracting body{1,2}, CE adds two reloads in the codeReplacer block:
```
codeRepl: ; preds = %header
call void @foo_header.split(i32 %z, i32 %x, i32 %y, i32* %.loc, i32*
%.loc1)
%.reload = load i32, i32* %.loc
%.reload2 = load i32, i32* %.loc1
br label %notExtracted
```
These reloads must flow into the notExtracted block:
```
notExtracted: ; preds = %codeRepl
%0 = phi i32 [ %.reload, %codeRepl ], [ %.reload2, %body2 ]
```
The problem is that the PHI node in notExtracted now has an incoming
value from a BasicBlock that's in a different function.</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>