[clang] [llvm] [UpdateTestChecks][Clang][CIR] Add support for CIR in update_cc_test_checks.py (PR #241654)
Andrzej Warzyński via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 4 09:49:33 PST 2026
================
----------------
banach-space wrote:
> entryv is just a name that starts with "entry" 😅
OK, so it's insignificant, right? However, it "overlaps" with the name of the "entry" label (which is _what_ the test is about) and the test file name ("normalize-local-names-entry.c"). I would rename it to avoid folks seeing a connection where there is none :)
Now, note that this file is actually testing _a lot_:
* For "normalize-local-names-entry.c", it verifies that the generated `CHECK` lines match the expected `CHECK` lines. It **also** checks that the Clang generated output matches those `CHECK` lines. That means that both `%update_cc_test_checks` and `%clang` are tested. That's specifically to handle the `entry` label.
* For "normalize-local-names-shared.c", it also verifies that the generated `CHECK` lines match the expected `CHECK` lines. it **also** checks that the Clang generated output matches, _with_ and _without_ `-fclangir`. That's specifically for LIT/FileCheck variable "normalization", right?
I like the rigour, but there's a lot going on and it should be documented more. In fact, I would consider making the test stronger and do the following:
```c
# RUN: cp %S/Inputs/normalize-local-names-entry.c %t-entry_without_normalzation.c
# RUN: cp %S/Inputs/normalize-local-names-entry.c %t-entry_with_normalization.c
/// ---------------------------------------------------
/// 1. VERIFY THE GENERATED CHECK LINES
/// ---------------------------------------------------
/// Expected to FAIL (hence `not`)
# RUN: %update_cc_test_checks --version 6 %t-entry_without_normalization.c
# RUN: not diff -u %S/Inputs/normalize-local-names-entry.c.expected %t-entry_without_normalization.c
/// Expected to PASS
# RUN: %update_cc_test_checks --version 6 --normalize-local-names %t-entry_with_normalization.c
# RUN: diff -u %S/Inputs/normalize-local-names-entry.c.expected %t-entry_with_normalization.c
/// ---------------------------------------------------
/// 2. VERIFY THE GENERATED CHECK LINES against CLANG OUTPUT
/// ---------------------------------------------------
/// Without normalization - only works for Clang's "original code-gen"
# RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -disable-O0-optnone -o - %t-entry_without_normalization.c \
# RUN: | opt -passes=mem2reg -S | FileCheck %t-entry_without_normalization.c
# RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -fclangir -disable-O0-optnone -o - %t-entry_without_normalization.c \
# RUN: | opt -passes=mem2reg -S | not FileCheck %t-entry_without_normalization.c
/// With normalization - works for both Clang's "original code-gen" and CIR-based code-gen
# RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -disable-O0-optnone -o - %t-entry_with_normalization.c \
# RUN: | opt -passes=mem2reg -S | FileCheck %t-entry_with_normalization.c
# RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -fclangir -disable-O0-optnone -o - %t-entry_with_normalization.c \
# RUN: | opt -passes=mem2reg -S | FileCheck %t-entry_with_normalization.c
```
Is this what you had in mind? Btw, I feel that you can merge "normalize-local-names-shared.c" and "normalize-local-names-entry.c" - it's just not quite clear to me _why_ we need both?
https://github.com/llvm/llvm-project/pull/241654
More information about the cfe-commits
mailing list