<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/106762>106762</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Compile-time regression after #104815
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
artagnon
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
artagnon
</td>
</tr>
</table>
<pre>
The following code is too expensive, and causes a compile-time explosion:
```cpp
// If ChainElem depends on ChainBegin, they're not safe to reorder.
SmallVector<Instruction *, 8> Worklist;
Worklist.emplace_back(ChainElem);
while (!Worklist.empty()) {
Instruction *I = Worklist.pop_back_val();
for (Use &O : I->operands()) {
if (isa<PHINode>(O))
continue;
if (auto *J = dyn_cast<Instruction>(O)) {
if (J == ChainBegin) {
LLVM_DEBUG(dbgs() << "LSV: dependent loads; not safe to reorder\n");
return false;
}
Worklist.emplace_back(J);
}
}
}
```
Originally reported [here](https://github.com/llvm/llvm-project/commit/c46b41aaa6eaa787f808738d14c61a2f8b6d839f).
CC: @JoelWee, @fhahn, @arsenm.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE1v4zYT_jXjyyCGROrLBx1iOXlfB2lTYLvZY0CJI4ldihRIKqn_fSHZjr27BooKhk2P5vngkDPCe9UZohLSLTAmXBCdsQYYg3S3ElPorSvP0VVt5aH8sydsrdb2Q5kOGysJlcdgLdLfIxmv3glYhcJIbMTkyaPAxg6j0nQX1EBzmrZeWQP8HqIdROfvLDp-mnE8RhARgT0Ce8R9i1UvlHnQNKCkkYz0aM0xuKVOmVk09HQAljtCYwN60RIGi46sk-TWJ9Ivg9D6lZpgHfBqb3xwUxOUNQjsfmYpgD_gN-u-a-UD8O0Jd46saRi1aOitFs13YMWnL2CbSzYifvRKEwIrgMXX4HBYYhtgG4T8DPjJyB6B7y6aox0Xvbd3oU_oaynE1rpZ6qufFbMXBH6P-zvgD3YkJ4z0tzRPj2pnqPICePXH__e_W0nAH4AVL0fEj9mIjTVBmYkuFo4MYgp29v60eJcH89aIuYLXRf6B-FcrZzMLxcxyfcA38xGfn19_e9s9bL_-D1gh6-60VQReAa8QGHv-8jrX43hvyATUVkgPfHvrnkBaLQ3wS4mPj6MwOYOt0J5uJEC--5f78nSL-QL76e_n6rM9rnvmxalOGaH1AR2N1gWSCOm2J0eQ7oAVfQijnxttaaNOhX6q140dgD1q_X7-uRud_YuaAOyxscOglkWS1UkshMhIiLzI2yIqcl7IOGmyWLC2qDNZ8E0LbLO-tlRVc6khiZ4s6W-0DANIorYXvTmthfNkhvVKllxu-EasqIxzlkY8zzbJqi-jJI4ojVKRCMZlwnmTFTKlvGAxk_GmXqmSRSyJCh7FeVTEbJ1SQnkshGyyOhNxDklEg1B6Pe9ubV23Ut5PVMZRlmdspUVN2p-GnqEPXN6epp4rl5LUU-chieYT9BeaoIKmsrqeZ446R34eaCjaQHMb8jhKijhdTU6X__kEFi8e2OPJ7HvJ_gkAAP__yQWiwg">