HomePhabricator

[InstCombine] Eliminate stores to constant memory

Description

[InstCombine] Eliminate stores to constant memory

If we have a store to a piece of memory which is known constant, then we know the store must be storing back the same value. As a result, the store (or memset, or memmove) must either be down a dead path, or a noop. In either case, it is valid to simply remove the store.

The motivating case for this involves a memmove to a buffer which is constant down a path which is dynamically dead.

Note that I'm choosing to implement the less aggressive of two possible semantics here. We could simply say that the store *is undefined*, and prune the path. Consensus in the review was that the more aggressive form might be a good follow on change at a later date.

Differential Revision: https://reviews.llvm.org/D60659

Details

Committed
reamesApr 22 2019, 1:28 PM
Differential Revision
D60659: [InstCombine] Eliminate stores to constant memory
Parents
rL358918: [EditLineTest] Not always TERM is available, e.g. on some bots.
Branches
Unknown
Tags
Unknown