Related to 16520
This change eliminates writes to variables where the value that is being written is already stored in the variable. This achieves the goal by looping through all memory defintions in the current state & each defintions uses. When there is a use where the write instruction is identical to the original instruction that created the memory definition, it will remove this redundant write.
For example,
void f() { x = 1; if foo() { x = 1; g(); } else { h(); } } void g(); void h();
The second x=1 will be eliminated since it is rewriting 1 to x. This pass will produce this:
void f() { x = 1; if foo() { g(); } else { h(); } } void g(); void h();
this test needs RUN & CHECK lines. You should be able to get some inspiration from other files in the directory.