Skip to content

Commit 2827d72

Browse files
committed
[pred-dead-alloc] Be more conservative and bail if we did not find a complete available value when cleaning up takes.
1 parent 705373c commit 2827d72

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/SILOptimizer/Mandatory/PredictableMemOpt.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,6 +2265,12 @@ bool AllocOptimize::canPromoteTake(
22652265
if (!agg.canTake(loadTy, firstElt))
22662266
return false;
22672267

2268+
// As a final check, make sure that we have an available value for each value,
2269+
// if not bail.
2270+
for (const auto &av : tmpList)
2271+
if (!av.Value)
2272+
return false;
2273+
22682274
// Ok, we can promote this destroy_addr... move the temporary lists contents
22692275
// into the final AvailableValues list.
22702276
std::move(tmpList.begin(), tmpList.end(),

0 commit comments

Comments
 (0)