Files
swift-mirror/lib/SILOptimizer/Transforms/ArrayElementValuePropagation.cpp
Erik Eckstein 4acffab173 SILOptimizer: fix a crash in ArrayElementValuePropagation.
This optimization is doing 2 things: replacing getElement calls and replacing append(contentOf:) calls.
Now if the argument to a append(contentOf:) is a previously replaced getElement call, we ended up in a use-after-free crash.

The main change here is to do the transformations immediately after gathering the data (and that means: separately) and not collecting all the data and do both transformation afterwards
The pass does not use any Analysis (where invalidation could be a problem). Also iterator invalidation is not a problem here.

SR-10003
rdar://problem/48445856
2019-02-28 14:38:45 -08:00

13 KiB