<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55576>55576</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Add SymbolStringWeakPtr, use it to avoid SymbolStringPtr copies during lookup.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            orcjit
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            lhames
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          lhames
      </td>
    </tr>
</table>

<pre>
    `ExecutionSession::lookup` currently makes several copies of the `SymbolStringPtr`s involved in the lookup. As of f9aef477ebc6cf7c5e453f39d8ea18863bcbcfd2 they're present in at least the `AsynchronousSymbolQuery` and the `InProgressLookupSet::LookupSet` member. They're also at least partially duplicated in the `DefGeneratorCandidates` and `DefGeneratorNonCandidates` sets of `InProgressLookupSet`.

If we introduced a new `SymbolStringWeakPtr` class (and probably a weakly-referencing version of `LookupSet` built on top of it), we could probably avoid many of these copies.

Note: Naming the weakly-referencing `LookupSet` will be an interesting exercise: We need to disambiguate weak reference (in the shared-ptr sense) of symbol strings and weak reference (in the linker sense) of symbols.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1U9tuozAQ_Rp4sYoI1_DAQ7bdriqtqq6y0j77MoAbg5Evafn7HZNks41aCQG2Z86cOWfMtFjaqEq_vwP3TuppD9biJ8p3-CitD37GY8K9MTA5tZCRHsASC0cwVBGuZ4lL3RE3AMHI_TIyrfbOyKl_cQZ3LJHTUasjCPxZw06wCdmtiV1DoSvqGhiveFfzEooy7_JGbIFuttsqZ5zxTmQhdYmy2gCZDVhkE_CoIwqodZf6O7tMfDB60t6euPzyYJbQA53EJeppejG6RxT7c-WyB3fq-LrEhBFGBiYhv_8Vpsrqa8mZGiepQlGEn5Xk1F17xPwH6H7AhDI5be6xuBQYYC9MbgKe9fQxxoJb5fmCbZUmUfoQpbvT-6kjb4C1ndHCc6RByQRvt4b8AXo4mUK4otaSKNsGLrPRjDLsgyIKPajlzkAHaDjHJIJOh5E4k_mgEPNSOYJnTs_hXLooa6LsPpDh2qv_oY9aCpyeaTlPi4Xz9Hxo5Fk7QB_IMx1D7SDlJ5RuebxJpQhDf6agAYZZF8LgHQyXdgX8A6gICuM0EdLSkcneo9YrOrlgQ1Dk7KAdqAFxNzuDXkwIkjWBuV31JHYV1K5Wfgmh5HSAz9JtEos2F03e0NhJp6DdCUE-swq19KiUdIH4ScObK3a5g8KHjcvlir1R7eDcbMNgZ4_49NINniVcj7hQ6nj53KFHr8DRukdprcfxyx7LsqyreGjrpis2wEVXF3XTFEXFmMgrUeVNWQgGXawoA2XbqPwWZZk2_DWMQBaVD7FsszTL0nLTpJuyyjdJ2WyqTbktK5ZBJbo0KlIYqVRJIJFo08emXfkw31s8VNI6ez3EeZU9WniupQY6BqprLerdoDF73YvXLtq1hb8Awali">