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

    <tr>
        <th>Summary</th>
        <td>
            MLIR pass test fails when using dylib
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir
      </td>
    </tr>

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

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

<pre>
    I've configured LLVM like so:

```
cmake -GNinja -Wno-deprecated \
 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DLLVM_ENABLE_ASSERTIONS=ON \
 -DLLVM_USE_SPLIT_DWARF=ON \
  -DLLVM_BUILD_DOCS=ON \
 -DLLVM_ENABLE_SPHINX=ON \
  -DLLVM_LINK_LLVM_DYLIB=ON \
 -DCLANG_LINK_CLANG_DYLIB=ON \
  -DCMAKE_CXX_FLAGS="-fno-standalone-debug" \
  -DLLVM_ENABLE_PROJECTS="lldb;mlir;clang;lld;llvm;clang-tools-extra" \
  -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt" \
 ../llvm 
```

In `check-mlir`, this one unit test fails for me, apparently only on Mac:

```
$ ./tools/mlir/unittests/Pass/MLIRPassTests --gtest_filter=PassManagerTest.ExecutionAction
Note: Google Test filter = PassManagerTest.ExecutionAction
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from PassManagerTest
[ RUN      ] PassManagerTest.ExecutionAction
/Users/rnk/llvm-project/mlir/unittests/Pass/PassManagerTest.cpp:184: Failure
Value of: func->getDiscardableAttr("didProcess2")
  Actual: true
Expected: false

[  FAILED  ] PassManagerTest.ExecutionAction (0 ms)
[----------] 1 test from PassManagerTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[ FAILED  ] PassManagerTest.ExecutionAction
```

I don't know enough about MLIR to debug why this test is not behaving as expected, so I need help. The test author is @bzcheeseman . Any thoughts on why enabling the LLVM / MLIR dylib build makes this go wrong? You can also reproduce this locally if you have a Mac. It did not fail on Linux premerge testing in my pending PR: https://github.com/llvm/llvm-project/pull/138187
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVl9z2jgQ_zTiZceMLUMCDzwYDDlfCWEI6Z8nRpYXW42QPJIcwn36G9nQ9lLaazweI-Td3_72r8ysFaVCnJDhlAzTHmtcpc3EqOderovTJCP09gWBa7UXZWOwgOXy4z1I8YxgNYkTErb3TXi-w4Qf2DNCcLcS6iuD4JPSQYG1Qc4cFkCGMxImEKSz--TDfDd9ypbpbvtlPSdxukH5SbgqxTxTe30RhSD1NnfzVTJdznfJ4-N8s80eVo8kTh9W3wFboafH-e5xvcy2u_RTsln8R-Qi09lMH2ZXEc5mHtd_ZavPV_WX2erDrl2lX5bZ9A3IbJms7jqZbvmz0DfvZ58_7xbL5M4TIZQGe6UD65gqmNQKgwLzpiSU_iIS683D3_PZ9qwsZZGTeHqQwpB4yiVTJYmnUhbt8-Vw2Qyc1tIG-OoM-zX25mm1ze7nF2yR89dXD9QuWC66daOOQnkDXB9qIdEExv2A2e8TuvC24U2JkDDJFJCbkFfIn4OW801I6AxcJSxohdAo4cChdbBnQlrYawMH9CKsrplB5eQJtGofcM_41VIkdACeQ-syoYvWEF14bA_tt9bM-p_7Zbbxy63fhiAo_fvdXkiHhsSpf3XPFCvReIn-_BV544RWCfdPEiYr7ZDECdxpXUqEbcu8VQcSp_D_AL4B4_R39zCFTaOUUCVE59AYfbisbSMc9jug4Nvlle6kzpnspFC9CKPVAZUDiy5o6qsqP-K_od6Jw-ZpBe3lxf_AO7p4smh8qI16PpdFUBv9Fbn7bWbeYvO6JnESjQY-2gsmZGOQhMlHJhsEvfe7-0bxgMTzEl0qLGemYLnExDlD6IhQWohibTRHaymhlNBx2wAJdw2TXt-ZxkPOX2vkDosWk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