[PATCH] D133943: [Utils] [WIP/RFC] Match function return type and other attributes on the definition in update_cc_test_checks

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 15 08:00:15 PDT 2022


asb created this revision.
asb added reviewers: arichardson, jdoerfert.
Herald added subscribers: wingo, pmatos, luke957, StephenFan, luismarques, sameer.abuasal, s.egerton, PkmX, simoncook.
Herald added a project: All.
asb requested review of this revision.
Herald added a subscriber: pcwang-thead.
Herald added a project: LLVM.

This is a WIP in the sense that it doesn't include full tests. My goal is to move over the hand-written RISC-V ABI tests to using update_cc_test_checks. A blocker on doing so is that `--function-signature option` doesn't generate checks of the function return type. This patch aims to rectify that. I have updated the behaviour of update_cc_test_checks whenever `--function-signature` is passed, but of course another option would be to add another flag so as not to perturb in-tree tests.

I've additionally found that merging of CHECK lines with identical outputs doesn't seem to work when using `--filter` to show only the function definition unless at least one line of the body is included. With this patch, you can do something like `./llvm/utils/update_cc_test_checks.py --function-signature --filter '^define |^entry:' --clang=build/default/bin/clang clang/test/CodeGen/RISCV/riscv-abi.cpp` and it generates check lines in that file like:

  -// ILP32-ILP32F-ILP32D-LABEL: define{{.*}} [2 x i32] @_Z30int32_int32_struct_inheritance14child1_int32_s([2 x i32] %a.coerce)
  -// LP64-LP64F-LP64D-LABEL: define{{.*}} i64 @_Z30int32_int32_struct_inheritance14child1_int32_s(i64 %a.coerce)
  +// ILP32-ILP32F-ILP32D-LABEL: define dso_local [2 x i32] @_Z30int32_int32_struct_inheritance14child1_int32_s
  +// ILP32-ILP32F-ILP32D-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0:[0-9]+]] {
  +// ILP32-ILP32F-ILP32D:  entry:
  +//
  +// LP64-LP64F-LP64D-LABEL: define dso_local i64 @_Z30int32_int32_struct_inheritance14child1_int32_s
  +// LP64-LP64F-LP64D-SAME: (i64 [[A_COERCE:%.*]]) #[[ATTR0:[0-9]+]] {
  +// LP64-LP64F-LP64D:  entry:
  +//

Input it would be useful to have at this stage include:

- Any comments on implementation approach / direction
- Thoughts on having this be a change to `--function-signature` for update_cc_test_checks (and causing some test churn due to this) vs adding a new flag,
- Any ideas on the bug regarding merging of identical check output very welcome
- Any other thoughts


https://reviews.llvm.org/D133943

Files:
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_cc_test_checks.py
  llvm/utils/update_test_checks.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133943.460411.patch
Type: text/x-patch
Size: 9968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220915/67f94f80/attachment.bin>


More information about the llvm-commits mailing list