[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

Anton Zabaznov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 16 05:10:18 PDT 2021


azabaznov added a comment.

I have one more though.

I like the idea of turning `opencl-c.h` into the test: as it is already in the repo and is already being used for quite a while we can assume it as a mainline for now. I think the first step should be to test that `-fdeclare-oprencl-builtins` generates the same built-ins which are declared in `opencl-c.h`. If we can't do this //programmable way// we can use AST pretty-printing for tablegen header and `opencl-c.h` and compare these with //diff //(we can also do a clean-up of AST files with //rm// while running that tests).

Once this is done we can incrementally modify either `opencl-c.h` header and tablegen header. Testing changes to either of them can combine sanity check as @svenvh suggested in **builtins-opencl2.0.check** and diff for AST pretty printing.

Advantages:

- Time of testing. Locally I get nice results: 

  $ time ./build_release/bin/clang-check -extra-arg=-cl-std=CL2.0 --ast-print  llvm-project/clang/lib/Headers/opencl-c.h &> header.h
  real    0m0.182s
  user    0m0.162s
  sys     0m0.020s

  But not yet clear how much time such printing will take for tablegen header. I assume it won't take a lot longer.

- This will keep changes to `opencl-h` header and tablegen header consistent (until `opencl-c.h` will be deprecated)

 
Disadvantages:

- Still doesn't eliminate subtle errors, need to carefully collect information from the spec about amount of the built-ins


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97869/new/

https://reviews.llvm.org/D97869



More information about the cfe-commits mailing list