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

    <tr>
        <th>Summary</th>
        <td>
            [HLSL] Enable reporting of multiple errors from DXILPostOptimizationValidation pass
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            HLSL
      </td>
    </tr>

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

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

<pre>
    `DXILPostOptimizationValidation` pass reports errors related to overlapping resource bindings or invalid use of resource counter. The pass is using `LLVMContext::diagnose()` to report the errors. The issue is that when it is called with `DiagnosticSeverity::Error`, the compiler exits right after the error is reported. Which means that error reporting from an LLVM pass is limited to a single error message. The other options for the diagnostic severity are `Warning`, `Remark` and `Note`, none of which seems like a good fit.

We need to figure out a way to report multiple errors from the `DXILPostOptimizationValidation` pass as there maybe be multiple overlapping resource binding or counter direction errors. One option is to add `NonFatalError` value to the `DiagnosticSeverity` enum that would report the error but not exit out of the compiler. The pass would then exit the compiler after all the errors are reported. 
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMlEFv4zYQhX8NfRmsIVGybB10SDdrtIDbLbrFpteRNJLYUByBHDmb_vqCkhJnsUXQi23Z48f3Hj8SQzC9I6rU4Sd1uN_hLAP7aqBHFtzV3D5Xqkju__rl8jsH-TyJGc0_KIbdV7SmXT6pIoEJQwBPE3sJQN6zj48WhVoQBr6StzhNxvXgKfDsG4LauNa4PgB7MO4a9WAOBNzdZhqenZDfw58DrYuYAHOIOqpILpevv35kJ_RNVHansrvWYO84kNInpctoTHizBTLQ5mxVMyHM8RVkQIGngRwYic8NWkstPBkZ4iL3q6aY5gtdyRt5Xtf6FLVUkSj9cdFueJyMJQ_0zUgAb_pBADshf1s6yq92qN3Dw2CaAUZCt5lYZ9aBGLHzPAI6iDlf01szmq1WhNiEfREfKQTsaY3HMpAHnuIOBeh4ddG-hoGwpQH0FHM-oHfG9VsiVSR_0Ij-MZaIro1f_MZC28-O3bJRT0uEQDRGY48ECD1zC52RvUruVHL3QOBotduZfvYEPAsgPOHzm80ZZytmekkS1uTR8P-nD2OJ5AlGfK4JarqJvodfpG-jDFrjqYmir6B8jjGXDhdSGLDdqnBnFLQvEMAV7Uxx4MX0j9QUCZCbx403nm37A5pQzwKOZWFoKYq77-B6cxBWBYncLtPfMbhyh9a-wX7Z6Bt9u7bK2jIrcUdVesyPp_xw1OVuqMom7dLjocx1glmbN1leZ_rYYJEWTX5qTztT6UQfkoNO0yLXSbknXaYn3RVpjaesKDKVJzSisXtrr-Oefb9bDluV5kmpTzuLNdmwXDla_3z5clFax8vHV3H-Qz33QeWJNUHCTUGM2OWaWv5wuIdPDmtLb04Ld_-N0fv8LGXuZm-rQWQK8Wzrs9Ln3sgw1_uGR6XP0cX29mHy_Dc1ovR5CRWUPm-5rpX-NwAA__8mtdjE">