Merge pull request #2344 from YosysHQ/mwk/opt_share-fixes