[llvm] 2a7c3f8 - [Docs] Document scripts that are use to generate assertion in test cases

Shivam Gupta via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 3 09:54:15 PDT 2021


Author: Shivam Gupta
Date: 2021-11-03T22:24:10+05:30
New Revision: 2a7c3f8b02bf9c692bd28e6560ced1aaae53ad7e

URL: https://github.com/llvm/llvm-project/commit/2a7c3f8b02bf9c692bd28e6560ced1aaae53ad7e
DIFF: https://github.com/llvm/llvm-project/commit/2a7c3f8b02bf9c692bd28e6560ced1aaae53ad7e.diff

LOG: [Docs] Document scripts that are use to generate assertion in test cases

This patch document llvm/utils/update_*  python scripts that are used to generate
assertions in many of the LLVM regression test cases.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D112936

Added: 
    

Modified: 
    llvm/docs/TestingGuide.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/TestingGuide.rst b/llvm/docs/TestingGuide.rst
index 88f08cd88c32a..c8dca7120e544 100644
--- a/llvm/docs/TestingGuide.rst
+++ b/llvm/docs/TestingGuide.rst
@@ -275,6 +275,45 @@ Put related tests into a single file rather than having a separate file per
 test. Check if there are files already covering your feature and consider
 adding your code there instead of creating a new file.
 
+Generating assertions in regression tests
+-----------------------------------------
+
+Some regression test cases are very large and complex to write/update by hand.
+In that case to reduce the human work we can use the scripts available in
+llvm/utils/ to generate the assertions.
+
+For example to generate assertions in an :program:`llc`-based test, run:
+
+ .. code-block:: bash
+
+     % llvm/utils/update_llc_test_checks.py --llc-binary build/bin/llc test.ll
+
+And if you want to update assertions in an existing test case, pass `-u` option
+which first check the ``NOTE:`` line exists and matches the script name.
+
+These are the most common scripts and their purposes/applications in generating
+assertions:
+
+.. code-block::
+
+  update_analyze_test_checks.py
+  opt --analyze --costmodel
+
+  update_cc_test_checks.py
+  C/C++, or clang/clang++ (IR checks)
+
+  update_llc_test_checks.py
+  llc (assembly checks)
+
+  update_mca_test_checks.py
+  llvm-mca
+
+  update_mir_test_checks.py
+  llc (MIR checks)
+
+  update_test_checks.py
+  opt
+
 Extra files
 -----------
 


        


More information about the llvm-commits mailing list