Open antoninbas opened 5 years ago
Localcopyprop currently does not copyprop list expressions (deliberately). The code from localcopyprop.cpp:323
if (as->right->is<IR::ListExpression>()) {
/* FIXME -- List Expressions need to be turned into constructor calls before
* we can copyprop them */
return as; }
That's because list expressions are only valid in some contexts, so we can't generally copyprop them.
The code could be rearranged to allow list expression copyprops and only copyprop list expressions into contexts where they are supported. So remove these 4 lines and instead have copyprop_name (the method that figures out if there's a value to copyprop to replace a use of a name) check the context when trying to copyprop a list expression.
This is a follow-up question on the LDWG discussion we had on April 1st.
I have the following program:
What is preventing the local copy propagation pass from replacing this code:
with: