When optimization remarks are enabled via the driver flag -Rpass, we
should allow the FE diagnostic handler to check if the given pass name
needs a diagnostic.
We were unconditionally checking the pattern defined in opt's
-pass-remarks flag. This was causing the FE to not emit any diagnostics.
I am not a huge fan of duplicating this test (i.e., this is the test used in LLVMContext::diagnose).
Could we instead teach optimizationRemarksEnabledFor to always returns true when we set a diagnostic handler?
For instance, we could change the method used to check the optimization remarks within LLVMContext::setDiagnosticHandler.