5.10: [DCE] Process instructions added during deletion. #69925
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description: Make DCE mark instructions added by InstructionDeleter live.
In OSSA, the InstructionDeleter may insert instructions when it deletes a dead instruction. Specifically, when the instruction that is deleted would have resulted in something being destroyed, it inserts an instruction to destroy that thing. For example, if the InstructionDeleter deletes an instruction which consumes a value, such as a cast of an owned value, it inserts a
destroy_value
of that value. In the same vein, when deleting aload [take]
, it insertsdestroy_addr
of the the taken-from address.Previously, DCE didn't observe these newly created instructions. As a result it was able to delete them.
Here, the newly created instructions are marked live, preventing DCE from deleting them.
Risk: Low. The patch makes DCE delete less code.
Scope: Affects dead code deletion.
Original PR: #69898
Reviewed By: Andrew Trick ( @atrick )
Testing: Added tests.
Resolves: rdar://118524766