[PATCH] D42830: Add and link to a testing philosophy document in the developer documentation.

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 18:12:06 PST 2018


rnk added inline comments.


================
Comment at: docs/TestingPolicy.rst:36
+
+* ``llvm/tools/clang/test/CodeGen``
+* ``llvm/test/Transforms/``
----------------
Is it worth mentioning Sema tests? This is targeted at backend / ISA people, but oftentimes attributes and target features need diagnostic tests. We could mention it briefly here and link to the VerifyDiagnosticConsumer doxygen to explain the other test format: https://clang.llvm.org/doxygen/classclang_1_1VerifyDiagnosticConsumer.html


================
Comment at: docs/TestingPolicy.rst:42
+
+``clang -O0 -mllvm -disable-llvm-optzns -S a.c -o - -emit-llvm | FileCheck %s``
+
----------------
MatzeB wrote:
> MatzeB wrote:
> > I hate making a simple example more complicated... But I would add `-disable-O0-optnone` to the clang commandline as many developers get biten by that nowadays.
> Actually maybe using `-O3 -mllvm -disable-llvm-optzns -emit-llvm` would be the way to go here ?
Clang CodeGen RUN lines use -cc1 and look more like:
`%clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s`

I don't think -disable-llvm-passes / -disable-O0-optnone is necessary. It is necessary when attempting to translate C input to LLVM IR for opt tests in the next step. I'd document it just below here.

Also, I prefer `-O1 -Xclang -disable-llvm-passes`, i.e. give me lifetime annotations, and any other stuff that Clang would put in the actual "optimizations enabled" IR. I remove them manually when reducing the LLVM IR test case.


================
Comment at: docs/TestingPolicy.rst:126
+   to make updating and writing your tests much easier. Take a look at
+   ``update_test_checks.py`` and the similar ones for llc and mir to make your
+   life as a compiler developer much easier.
----------------
Personally, I don't like this tool. We end up with golden tests or pixel tests that have to be regenerated when you breathe on the compiler, rather than targeted tests that are constructed so that the relevant code sequence can be easily pattern matched.


Repository:
  rL LLVM

https://reviews.llvm.org/D42830





More information about the llvm-commits mailing list