This script can be used to regenerate tests in the test/tools/llvm-mca directory (PR36904).
I've regenerated all of the subtarget specific tests as an example (command and console output below). In some of the cases they're now matching on a lot more tool output than they were previously. I can either commit these as-is, or leave for now. I've tested with Python 2.7 and 3.6 although the default is 2.7 for now to match the rest of the utility scripts. I've kept indentation at 2 spaces to match the rest of the LLVM project, but with all indentation warnings suppressed this runs cleanly through pep8, pylint and various other python style and linting tools I've tried.
C:\work\public-git\upstream-llvm\llvm\utils>py -2 update_mca_test_checks.py ..\test\tools\llvm-mca\*\*\*.s Test path: ..\test\tools\llvm-mca\AArch64\CortexA57\direct-branch.s Test path: ..\test\tools\llvm-mca\AArch64\Exynos\direct-branch.s Test path: ..\test\tools\llvm-mca\AArch64\Exynos\scheduler-queue-usage.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\dot-product.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\hadd-read-after-ld-1.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\hadd-read-after-ld-2.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\instruction-info-view.s update_mca_test_checks.py:297: Warning: not writing for prefix DISABLED due to presence of "DISABLED-NOT:" in input file. Test path: ..\test\tools\llvm-mca\X86\BtVer2\load-store-alias.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\memcpy-like-test.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\pipes-fpu.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\read-advance-1.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\read-advance-2.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\register-files-1.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\register-files-2.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\register-files-3.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\register-files-4.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\register-files-5.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-aes.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-avx1.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-clmul.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-f16c.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-sse1.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-sse2.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-sse3.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-sse41.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-sse42.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-sse4a.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\resources-ssse3.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\scheduler-queue-usage.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\simple-test.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\vec-logic-read-after-ld-1.s Test path: ..\test\tools\llvm-mca\X86\BtVer2\vec-logic-read-after-ld-2.s