[clang] [CIR][NFC] Merge duplicate checks in CodeGenBuiltins tests (PR #196224)
https://github.com/andykaylor approved this pull request. lgtm, assuming CI testing passes https://github.com/llvm/llvm-project/pull/196224 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CIR][NFC] Merge duplicate checks in CodeGenBuiltins tests (PR #196224)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-aarch64-windows` running on `linaro-armv8-windows-msvc-05` while building `clang` at step 6 "test". Full details are available at: https://lab.llvm.org/buildbot/#/builders/141/builds/18344 Here is the relevant piece of the build log for the reference ``` Step 6 (test) failure: build (failure) ... XFAIL: lldb-api :: lang/cpp/symbols/TestSymbols.py (947 of 2524) PASS: lldb-api :: lang/cpp/template-arguments/TestCppTemplateArguments.py (948 of 2524) XFAIL: lldb-api :: lang/cpp/template-diagnostic-hint/TestTemplateDiagnosticHint.py (949 of 2524) PASS: lldb-api :: lang/cpp/template-alias/TestTemplateAlias.py (950 of 2524) UNSUPPORTED: lldb-api :: lang/cpp/template-function/TestTemplateFunctions.py (951 of 2524) PASS: lldb-api :: lang/cpp/template-specialization-type/TestTemplateSpecializationType.py (952 of 2524) XFAIL: lldb-api :: lang/cpp/this/TestCPPThis.py (953 of 2524) PASS: lldb-api :: lang/cpp/template/TestTemplateArgs.py (954 of 2524) XFAIL: lldb-api :: lang/cpp/thread_local/TestThreadLocal.py (955 of 2524) PASS: lldb-api :: lang/cpp/this_class_type_mixing/TestThisClassTypeMixing.py (956 of 2524) FAIL: lldb-api :: lang/cpp/thunk/TestThunk.py (957 of 2524) TEST 'lldb-api :: lang/cpp/thunk/TestThunk.py' FAILED Script: -- C:/Users/tcwg/scoop/apps/python/current/python.exe C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/llvm-project/lldb\test\API\dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --env LLVM_INCLUDE_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/include --env LLVM_TOOLS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --triple aarch64-pc-windows-msvc --build-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex --lldb-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-lldb\lldb-api --clang-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-api --executable C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/lldb.exe --compiler C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/clang.exe --dsymutil C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/dsymutil.exe --make C:/Users/tcwg/scoop/shims/make.exe --llvm-tools-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --lldb-obj-root C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb --lldb-libs-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --cmake-build-type Release --skip-category=watchpoint --env LLDB_LAUNCH_FLAG_USE_PIPES=1 C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\lang\cpp\thunk -p TestThunk.py -- Exit Code: 1 Command Output (stdout): -- lldb version 23.0.0git (https://github.com/llvm/llvm-project.git revision 72860cddbf575522bc686c9bed63addfa86f1071) clang revision 72860cddbf575522bc686c9bed63addfa86f1071 llvm revision 72860cddbf575522bc686c9bed63addfa86f1071 Skipping the following test categories: watchpoint, libc++, libstdcxx, dwo, dsym, gmodules, debugserver, objc, fork, pexpect -- Command Output (stderr): -- UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_step_out_thunk_dsym (TestThunk.ThunkTest.test_step_out_thunk_dsym) (test case does not fall in any category of interest for this run) UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_step_out_thunk_dwarf (TestThunk.ThunkTest.test_step_out_thunk_dwarf) (skip on windows) UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_step_out_thunk_dwo (TestThunk.ThunkTest.test_step_out_thunk_dwo) (test case does not fall in any category of interest for this run) UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_step_through_thunk_dsym (TestThunk.ThunkTest.test_step_through_thunk_dsym) (test case does not fall in any category of interest for this run) FAIL: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_step_through_thunk_dwarf (TestThunk.ThunkTest.test_step_through_thunk_dwarf) Log Files: - C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\lldb-test-build.noindex\lang\cpp\thunk\TestThunk\Failure_test_step_through_thunk_dwarf.log UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_step_through_thunk_dwo (TestThunk.ThunkTest.test_step_through_thunk_dwo) (test case does not fall in any category of interest for this run) == FAIL: test_step_through_thunk_dwarf (TestThunk.ThunkTest.test_step_through_thunk_dwarf) `
[clang] [CIR][NFC] Merge duplicate checks in CodeGenBuiltins tests (PR #196224)
https://github.com/jacquesguan closed https://github.com/llvm/llvm-project/pull/196224 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CIR][NFC] Merge duplicate checks in CodeGenBuiltins tests (PR #196224)
https://github.com/jacquesguan updated
https://github.com/llvm/llvm-project/pull/196224
>From f039c8cb636e8fa9b0ae8b059fedd2d73047d290 Mon Sep 17 00:00:00 2001
From: Jianjian GUAN
Date: Wed, 6 May 2026 17:04:29 +0800
Subject: [PATCH] [CIR][NFC] Merge duplicate checks in CodeGenBuiltins tests
---
.../test/CIR/CodeGenBuiltins/builtin-memchr.c | 8 +-
.../CodeGenBuiltins/builtin-object-size.cpp | 20 +---
.../CIR/CodeGenBuiltins/builtin-signbit.c | 42 +--
.../CodeGenBuiltins/builtins-elementwise.c| 113 +-
.../CIR/CodeGenBuiltins/builtins-overflow.cpp | 4 +-
.../CIR/CodeGenBuiltins/builtins-pred-info.c | 14 +--
clang/test/CIR/CodeGenBuiltins/builtins.cpp | 7 +-
7 files changed, 7 insertions(+), 201 deletions(-)
diff --git a/clang/test/CIR/CodeGenBuiltins/builtin-memchr.c
b/clang/test/CIR/CodeGenBuiltins/builtin-memchr.c
index 0f6a6261d2a0d..5380dbc371de1 100644
--- a/clang/test/CIR/CodeGenBuiltins/builtin-memchr.c
+++ b/clang/test/CIR/CodeGenBuiltins/builtin-memchr.c
@@ -3,7 +3,7 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o
%t-cir.ll
// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
-// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s
+// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s
void *test_char_memchr(const char arg[32]) {
return __builtin_char_memchr(arg, 123, 32);
@@ -18,9 +18,6 @@ void *test_char_memchr(const char arg[32]) {
// LLVM: call ptr @memchr(ptr noundef %{{.*}}, i32 noundef 123, i64 noundef 32)
// LLVM: ret ptr
-// OGCG-LABEL: @test_char_memchr
-// OGCG: call ptr @memchr(ptr noundef %{{.*}}, i32 noundef 123, i64 noundef 32)
-// OGCG: ret ptr
void *test_memchr(const void *ptr, int val, unsigned long size) {
return __builtin_memchr(ptr, val, size);
@@ -33,6 +30,3 @@ void *test_memchr(const void *ptr, int val, unsigned long
size) {
// LLVM: call ptr @memchr(ptr noundef %{{.*}}, i32 noundef %{{.*}}, i64
noundef %{{.*}})
// LLVM: ret ptr
-// OGCG-LABEL: @test_memchr
-// OGCG: call ptr @memchr(ptr noundef %{{.*}}, i32 noundef %{{.*}}, i64
noundef %{{.*}})
-// OGCG: ret ptr
diff --git a/clang/test/CIR/CodeGenBuiltins/builtin-object-size.cpp
b/clang/test/CIR/CodeGenBuiltins/builtin-object-size.cpp
index b60e24594388d..341fddc089e47 100644
--- a/clang/test/CIR/CodeGenBuiltins/builtin-object-size.cpp
+++ b/clang/test/CIR/CodeGenBuiltins/builtin-object-size.cpp
@@ -3,7 +3,7 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o
%t-cir.ll
// RUN: FileCheck --input-file=%t-cir.ll %s --check-prefix=LLVM
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
-// RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
+// RUN: FileCheck --input-file=%t.ll %s --check-prefix=LLVM
// C++-specific tests for __builtin_object_size
@@ -11,7 +11,6 @@ int gi;
// CIR-LABEL: @_Z5test1v
// LLVM-LABEL: define{{.*}} void @_Z5test1v()
-// OGCG-LABEL: define{{.*}} void @_Z5test1v()
void test1() {
// Guaranteeing that our cast removal logic doesn't break more interesting
// cases.
@@ -23,34 +22,27 @@ void test1() {
// CIR: cir.const #cir.int<8>
// LLVM: store i32 8
- // OGCG: store i32 8
gi = __builtin_object_size(&c, 0);
// CIR: cir.const #cir.int<8>
// LLVM: store i32 8
- // OGCG: store i32 8
gi = __builtin_object_size((A*)&c, 0);
// CIR: cir.const #cir.int<4>
// LLVM: store i32 4
- // OGCG: store i32 4
gi = __builtin_object_size((B*)&c, 0);
// CIR: cir.const #cir.int<8>
// LLVM: store i32 8
- // OGCG: store i32 8
gi = __builtin_object_size((char*)&c, 0);
// CIR: cir.const #cir.int<8>
// LLVM: store i32 8
- // OGCG: store i32 8
gi = __builtin_object_size((char*)(A*)&c, 0);
// CIR: cir.const #cir.int<4>
// LLVM: store i32 4
- // OGCG: store i32 4
gi = __builtin_object_size((char*)(B*)&c, 0);
}
// CIR-LABEL: @_Z5test2v()
// LLVM-LABEL: define{{.*}} void @_Z5test2v()
-// OGCG-LABEL: define{{.*}} void @_Z5test2v()
void test2() {
struct A { char buf[16]; };
struct B : A {};
@@ -58,19 +50,15 @@ void test2() {
// CIR: cir.objsize max nullunknown %{{.+}} : !cir.ptr -> !u64i
// LLVM: call i64 @llvm.objectsize.i64.p0(ptr %{{.*}}, i1 false, i1 true, i1
false)
- // OGCG: call i64 @llvm.objectsize.i64.p0(ptr %{{.*}}, i1 false, i1 true, i1
false)
gi = __builtin_object_size(&c->bs[0], 0);
// CIR: cir.objsize max nullunknown %{{.+}} : !cir.ptr -> !u64i
// LLVM: call i64 @llvm.objectsize.i64.p0(ptr %{{.*}}, i1 false, i1 true, i1
false)
- // OGCG: call i64 @llvm.objectsize.i64.p0(ptr %{{.*}}, i1 false, i1 true, i1
false)
gi = __builtin_object_size(&c->bs[0], 1);
// CIR: cir.objsize min nullunknown %{{.+}} : !cir.ptr -> !u64i
// LLVM: call i64 @llvm.objectsize.i64.p0(ptr %{{.*}}, i1 true, i1 true, i1
false)
- // OGCG: call i64 @llvm.objectsize.
[clang] [CIR][NFC] Merge duplicate checks in CodeGenBuiltins tests (PR #196224)
llvm-ci wrote:
LLVM Buildbot has detected a new failure on builder `sanitizer-x86_64-linux`
running on `sanitizer-buildbot2` while building `clang` at step 2 "annotate".
Full details are available at:
https://lab.llvm.org/buildbot/#/builders/66/builds/30631
Here is the relevant piece of the build log for the reference
```
Step 2 (annotate) failure: 'python
../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py'
(failure)
...
[415/421] Generating MSAN_INST_GTEST.gtest-all.cc.x86_64-with-call.o
[416/421] Generating MSAN_INST_GTEST.gtest-all.cc.x86_64.o
[417/421] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64-with-call.o
[418/421] Generating Msan-x86_64-with-call-Test
[419/421] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64.o
[420/421] Generating Msan-x86_64-Test
[420/421] Running compiler_rt regression tests
llvm-lit:
/home/b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:74:
note: The test suite configuration requested an individual test timeout of 0
seconds but a timeout of 900 seconds was requested on the command line. Forcing
timeout to be 900 seconds.
-- Testing: 11539 tests, 64 workers --
Testing: 0.. 10.. 20.. 30
FAIL: LeakSanitizer-Standalone-i386 :: TestCases/suppressions_default.cpp (4027
of 11539)
TEST 'LeakSanitizer-Standalone-i386 ::
TestCases/suppressions_default.cpp' FAILED
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
/home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang
--driver-mode=g++ -O0 -m32 -gline-tables-only -fsanitize=leak
-I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lsan/../
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/suppressions_default.cpp
-o
/home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/I386LsanConfig/TestCases/Output/suppressions_default.cpp.tmp
# executed command:
/home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang
--driver-mode=g++ -O0 -m32 -gline-tables-only -fsanitize=leak
-I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lsan/../
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/suppressions_default.cpp
-o
/home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/I386LsanConfig/TestCases/Output/suppressions_default.cpp.tmp
# note: command had no output on stdout or stderr
# RUN: at line 2
env LSAN_OPTIONS=:detect_leaks=1:use_registers=0:use_stacks=0 not
/home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/I386LsanConfig/TestCases/Output/suppressions_default.cpp.tmp
2>&1 | FileCheck
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/suppressions_default.cpp
# executed command: env
LSAN_OPTIONS=:detect_leaks=1:use_registers=0:use_stacks=0 not
/home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/I386LsanConfig/TestCases/Output/suppressions_default.cpp.tmp
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1
# executed command: FileCheck
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/suppressions_default.cpp
# .---command stderr
# |
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/suppressions_default.cpp:27:11:
error: CHECK: expected string not found in input
# | // CHECK: SUMMARY: {{.*}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s)
# | ^
# | :6:29: note: scanning from here
# | 1 666 *LSanTestLeakingFunc*
# | ^
# |
# | Input file:
# | Check file:
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/suppressions_default.cpp
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<
# | 1: Test alloc: 0xe7303c00.
# | 2: Test alloc: 0xe7103600.
# | 3: -
# | 4: Suppressions used:
# | 5: count bytes template
# | 6: 1 666 *LSanTestLeakingFunc*
# | check:27 X error: no match found
# | 7: -
Step 14 (test compiler-rt default) failure: test compiler-rt default (failure)
...
[415/421] Generating MSAN_INST_GTEST.gtest-all.cc.x86_64-with-call.o
[416/421] Generating MSAN_INST_GTEST.gtest-all.cc.x86_64.o
[417/421] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64-with-call.o
[418/421] Generating Msan-x86_64-with-call-Test
[419/421] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64.o
[420/421] Generating Msan-x86_64-Test
[420/421] Running compiler_rt regression tests
llvm-lit:
/home/b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.p
[clang] [CIR][NFC] Merge duplicate checks in CodeGenBuiltins tests (PR #196224)
https://github.com/jacquesguan updated
https://github.com/llvm/llvm-project/pull/196224
>From 6b98df8de29f84644e969891a9d0d15ceba9a43b Mon Sep 17 00:00:00 2001
From: Jianjian GUAN
Date: Wed, 6 May 2026 17:04:29 +0800
Subject: [PATCH] [CIR][NFC] Merge duplicate checks in CodeGenBuiltins tests
---
.../test/CIR/CodeGenBuiltins/builtin-memchr.c | 8 +-
.../CodeGenBuiltins/builtin-object-size.cpp | 20 +---
.../CIR/CodeGenBuiltins/builtin-signbit.c | 34 +-
.../CodeGenBuiltins/builtins-elementwise.c| 113 +-
.../CIR/CodeGenBuiltins/builtins-overflow.cpp | 4 +-
.../CIR/CodeGenBuiltins/builtins-pred-info.c | 14 +--
clang/test/CIR/CodeGenBuiltins/builtins.cpp | 7 +-
7 files changed, 7 insertions(+), 193 deletions(-)
diff --git a/clang/test/CIR/CodeGenBuiltins/builtin-memchr.c
b/clang/test/CIR/CodeGenBuiltins/builtin-memchr.c
index 0f6a6261d2a0d..5380dbc371de1 100644
--- a/clang/test/CIR/CodeGenBuiltins/builtin-memchr.c
+++ b/clang/test/CIR/CodeGenBuiltins/builtin-memchr.c
@@ -3,7 +3,7 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o
%t-cir.ll
// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
-// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s
+// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s
void *test_char_memchr(const char arg[32]) {
return __builtin_char_memchr(arg, 123, 32);
@@ -18,9 +18,6 @@ void *test_char_memchr(const char arg[32]) {
// LLVM: call ptr @memchr(ptr noundef %{{.*}}, i32 noundef 123, i64 noundef 32)
// LLVM: ret ptr
-// OGCG-LABEL: @test_char_memchr
-// OGCG: call ptr @memchr(ptr noundef %{{.*}}, i32 noundef 123, i64 noundef 32)
-// OGCG: ret ptr
void *test_memchr(const void *ptr, int val, unsigned long size) {
return __builtin_memchr(ptr, val, size);
@@ -33,6 +30,3 @@ void *test_memchr(const void *ptr, int val, unsigned long
size) {
// LLVM: call ptr @memchr(ptr noundef %{{.*}}, i32 noundef %{{.*}}, i64
noundef %{{.*}})
// LLVM: ret ptr
-// OGCG-LABEL: @test_memchr
-// OGCG: call ptr @memchr(ptr noundef %{{.*}}, i32 noundef %{{.*}}, i64
noundef %{{.*}})
-// OGCG: ret ptr
diff --git a/clang/test/CIR/CodeGenBuiltins/builtin-object-size.cpp
b/clang/test/CIR/CodeGenBuiltins/builtin-object-size.cpp
index b60e24594388d..341fddc089e47 100644
--- a/clang/test/CIR/CodeGenBuiltins/builtin-object-size.cpp
+++ b/clang/test/CIR/CodeGenBuiltins/builtin-object-size.cpp
@@ -3,7 +3,7 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o
%t-cir.ll
// RUN: FileCheck --input-file=%t-cir.ll %s --check-prefix=LLVM
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
-// RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
+// RUN: FileCheck --input-file=%t.ll %s --check-prefix=LLVM
// C++-specific tests for __builtin_object_size
@@ -11,7 +11,6 @@ int gi;
// CIR-LABEL: @_Z5test1v
// LLVM-LABEL: define{{.*}} void @_Z5test1v()
-// OGCG-LABEL: define{{.*}} void @_Z5test1v()
void test1() {
// Guaranteeing that our cast removal logic doesn't break more interesting
// cases.
@@ -23,34 +22,27 @@ void test1() {
// CIR: cir.const #cir.int<8>
// LLVM: store i32 8
- // OGCG: store i32 8
gi = __builtin_object_size(&c, 0);
// CIR: cir.const #cir.int<8>
// LLVM: store i32 8
- // OGCG: store i32 8
gi = __builtin_object_size((A*)&c, 0);
// CIR: cir.const #cir.int<4>
// LLVM: store i32 4
- // OGCG: store i32 4
gi = __builtin_object_size((B*)&c, 0);
// CIR: cir.const #cir.int<8>
// LLVM: store i32 8
- // OGCG: store i32 8
gi = __builtin_object_size((char*)&c, 0);
// CIR: cir.const #cir.int<8>
// LLVM: store i32 8
- // OGCG: store i32 8
gi = __builtin_object_size((char*)(A*)&c, 0);
// CIR: cir.const #cir.int<4>
// LLVM: store i32 4
- // OGCG: store i32 4
gi = __builtin_object_size((char*)(B*)&c, 0);
}
// CIR-LABEL: @_Z5test2v()
// LLVM-LABEL: define{{.*}} void @_Z5test2v()
-// OGCG-LABEL: define{{.*}} void @_Z5test2v()
void test2() {
struct A { char buf[16]; };
struct B : A {};
@@ -58,19 +50,15 @@ void test2() {
// CIR: cir.objsize max nullunknown %{{.+}} : !cir.ptr -> !u64i
// LLVM: call i64 @llvm.objectsize.i64.p0(ptr %{{.*}}, i1 false, i1 true, i1
false)
- // OGCG: call i64 @llvm.objectsize.i64.p0(ptr %{{.*}}, i1 false, i1 true, i1
false)
gi = __builtin_object_size(&c->bs[0], 0);
// CIR: cir.objsize max nullunknown %{{.+}} : !cir.ptr -> !u64i
// LLVM: call i64 @llvm.objectsize.i64.p0(ptr %{{.*}}, i1 false, i1 true, i1
false)
- // OGCG: call i64 @llvm.objectsize.i64.p0(ptr %{{.*}}, i1 false, i1 true, i1
false)
gi = __builtin_object_size(&c->bs[0], 1);
// CIR: cir.objsize min nullunknown %{{.+}} : !cir.ptr -> !u64i
// LLVM: call i64 @llvm.objectsize.i64.p0(ptr %{{.*}}, i1 true, i1 true, i1
false)
- // OGCG: call i64 @llvm.objectsize.i
[clang] [CIR][NFC] Merge duplicate checks in CodeGenBuiltins tests (PR #196224)
llvmorg-github-actions[bot] wrote:
@llvm/pr-subscribers-clangir
Author: Jianjian Guan (jacquesguan)
Changes
---
Patch is 54.92 KiB, truncated to 20.00 KiB below, full version:
https://github.com/llvm/llvm-project/pull/196224.diff
8 Files Affected:
- (modified) clang/test/CIR/CodeGenBuiltins/builtin-fpclassify.c (-243)
- (modified) clang/test/CIR/CodeGenBuiltins/builtin-memchr.c (+1-7)
- (modified) clang/test/CIR/CodeGenBuiltins/builtin-object-size.cpp (+1-19)
- (modified) clang/test/CIR/CodeGenBuiltins/builtin-signbit.c (+1-33)
- (modified) clang/test/CIR/CodeGenBuiltins/builtins-elementwise.c (+1-112)
- (modified) clang/test/CIR/CodeGenBuiltins/builtins-overflow.cpp (+1-3)
- (modified) clang/test/CIR/CodeGenBuiltins/builtins-pred-info.c (+1-13)
- (modified) clang/test/CIR/CodeGenBuiltins/builtins.cpp (+1-6)
``diff
diff --git a/clang/test/CIR/CodeGenBuiltins/builtin-fpclassify.c
b/clang/test/CIR/CodeGenBuiltins/builtin-fpclassify.c
index bad83c4f0ef4c..f544b0d0240f9 100644
--- a/clang/test/CIR/CodeGenBuiltins/builtin-fpclassify.c
+++ b/clang/test/CIR/CodeGenBuiltins/builtin-fpclassify.c
@@ -84,273 +84,30 @@ void test_fpclassify_inf(){
float infValue = 1.0f / 0.0f;
__builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
FP_SUBNORMAL, FP_ZERO, infValue);
-// CIR: %[[IS_ZERO:.+]] = cir.is_fp_class %{{.+}}, fcZero : (!cir.float) ->
!cir.bool
-// CIR: cir.ternary(%[[IS_ZERO]], true {
-// CIR: cir.const #cir.int<96> : !s32i
-// CIR: %[[IS_NAN:.+]] = cir.is_fp_class %{{.+}}, fcNan : (!cir.float) ->
!cir.bool
-// CIR: cir.ternary(%[[IS_NAN]], true {
-// CIR: cir.const #cir.int<3> : !s32i
-// CIR: %[[IS_INF:.+]] = cir.is_fp_class %{{.+}}, fcInf : (!cir.float) ->
!cir.bool
-// CIR: cir.ternary(%[[IS_INF]], true {
-// CIR: cir.const #cir.int<516> : !s32i
-// CIR: %[[IS_NORMAL:.+]] = cir.is_fp_class %{{.+}}, fcNormal : (!cir.float)
-> !cir.bool
-// CIR: %[[NORMAL_VAL:.+]] = cir.const #cir.int<264> : !s32i
-// CIR: %[[SUBNORMAL_VAL:.+]] = cir.const #cir.int<144> : !s32i
-// CIR: cir.select if %[[IS_NORMAL]] then %[[NORMAL_VAL]] else
%[[SUBNORMAL_VAL]] : (!cir.bool, !s32i, !s32i) -> !s32i
-// LLVM: %[[VAL:.+]] = load float, ptr
-// LLVM-NEXT: %[[IS_ZERO:.+]] = call i1 @llvm.is.fpclass.f32(float %[[VAL]],
i32 96)
-// LLVM-NEXT: br i1 %[[IS_ZERO]], label %[[BB_ZERO:.+]], label
%[[BB_NOT_ZERO:.+]]
-// LLVM: [[BB_ZERO]]:
-// LLVM-NEXT: br label %[[BB_RET:.+]]
-// LLVM: [[BB_NOT_ZERO]]:
-// LLVM-NEXT: %[[IS_NAN:.+]] = call i1 @llvm.is.fpclass.f32(float %[[VAL]],
i32 3)
-// LLVM-NEXT: br i1 %[[IS_NAN]], label %[[BB_NAN:.+]], label %[[BB_NOT_NAN:.+]]
-// LLVM: [[BB_NAN]]:
-// LLVM-NEXT: br label %[[BB_MERGE1:.+]]
-// LLVM: [[BB_NOT_NAN]]:
-// LLVM-NEXT: %[[IS_INF:.+]] = call i1 @llvm.is.fpclass.f32(float %[[VAL]],
i32 516)
-// LLVM-NEXT: br i1 %[[IS_INF]], label %[[BB_INF:.+]], label %[[BB_NOT_INF:.+]]
-// LLVM: [[BB_INF]]:
-// LLVM-NEXT: br label %[[BB_MERGE2:.+]]
-// LLVM: [[BB_NOT_INF]]:
-// LLVM-NEXT: %[[IS_NORMAL:.+]] = call i1 @llvm.is.fpclass.f32(float %[[VAL]],
i32 264)
-// LLVM-NEXT: %[[SEL:.+]] = select i1 %[[IS_NORMAL]], i32 264, i32 144
-// LLVM-NEXT: br label %[[BB_MERGE2]]
-// LLVM: [[BB_MERGE2]]:
-// LLVM-NEXT: %[[PHI1:.+]] = phi i32 [ %[[SEL]], %[[BB_NOT_INF]] ], [ 516,
%[[BB_INF]] ]
-// LLVM-NEXT: br label %[[BB_CONT1:.+]]
-// LLVM: [[BB_CONT1]]:
-// LLVM-NEXT: br label %[[BB_MERGE1]]
-// LLVM: [[BB_MERGE1]]:
-// LLVM-NEXT: %[[PHI2:.+]] = phi i32 [ %[[PHI1]], %[[BB_CONT1]] ], [ 3,
%[[BB_NAN]] ]
-// LLVM-NEXT: br label %[[BB_CONT2:.+]]
-// LLVM: [[BB_CONT2]]:
-// LLVM-NEXT: br label %[[BB_RET]]
-// LLVM: [[BB_RET]]:
-// LLVM-NEXT: %[[PHI3:.+]] = phi i32 [ %[[PHI2]], %[[BB_CONT2]] ], [ 96,
%[[BB_ZERO]] ]
-// LLVM-NEXT: br label
-// OGCG: %[[CMP_ZERO:.+]] = fcmp oeq float %[[VAL:.+]],
-// OGCG-NEXT: br i1 %[[CMP_ZERO]], label %[[BB_RET:.+]], label
%[[BB_NOT_ZERO:.+]]
-// OGCG: [[BB_RET]]:
-// OGCG-NEXT: %[[PHI:.+]] = phi i32 [ 96, %[[BB_ENTRY:.+]] ], [ 3,
%[[BB_NOT_ZERO]] ], [ 516, %[[BB_NOT_NAN:.+]] ], [ %[[SEL:.+]],
%[[BB_NOT_INF:.+]] ]
-// OGCG: [[BB_NOT_ZERO]]:
-// OGCG-NEXT: %[[CMP_NAN:.+]] = fcmp uno float %[[VAL]], %[[VAL]]
-// OGCG-NEXT: br i1 %[[CMP_NAN]], label %[[BB_RET]], label %[[BB_NOT_NAN]]
-// OGCG: [[BB_NOT_NAN]]:
-// OGCG-NEXT: %[[FABS:.+]] = call float @llvm.fabs.f32(float %[[VAL]])
-// OGCG-NEXT: %[[CMP_INF:.+]] = fcmp oeq float %[[FABS]],
-// OGCG-NEXT: br i1 %[[CMP_INF]], label %[[BB_RET]], label %[[BB_NOT_INF]]
-// OGCG: [[BB_NOT_INF]]:
-// OGCG-NEXT: %[[CMP_NORMAL:.+]] = fcmp uge float %[[FABS]],
-// OGCG-NEXT: %[[SEL]] = select i1 %[[CMP_NORMAL]], i32 264, i32 144
-// OGCG-NEXT: br label %[[BB_RET]]
}
void test_fpclassify_normal(){
float normalValue = 1.0f;
__builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
FP_SUBNORMAL, FP_ZERO,
normalValue);
-// CIR: %[[IS_ZERO:.+]] = cir.is_fp_class %{{.+}}, fcZero : (!cir.float) ->
!cir.
[clang] [CIR][NFC] Merge duplicate checks in CodeGenBuiltins tests (PR #196224)
https://github.com/jacquesguan created
https://github.com/llvm/llvm-project/pull/196224
None
>From 60b22d5d83e5b29ce339926e25f7f2731cdcd4d6 Mon Sep 17 00:00:00 2001
From: Jianjian GUAN
Date: Wed, 6 May 2026 17:04:29 +0800
Subject: [PATCH] [CIR][NFC] Merge duplicate checks in CodeGenBuiltins tests
---
.../CIR/CodeGenBuiltins/builtin-fpclassify.c | 243 --
.../test/CIR/CodeGenBuiltins/builtin-memchr.c | 8 +-
.../CodeGenBuiltins/builtin-object-size.cpp | 20 +-
.../CIR/CodeGenBuiltins/builtin-signbit.c | 34 +--
.../CodeGenBuiltins/builtins-elementwise.c| 113 +---
.../CIR/CodeGenBuiltins/builtins-overflow.cpp | 4 +-
.../CIR/CodeGenBuiltins/builtins-pred-info.c | 14 +-
clang/test/CIR/CodeGenBuiltins/builtins.cpp | 7 +-
8 files changed, 7 insertions(+), 436 deletions(-)
diff --git a/clang/test/CIR/CodeGenBuiltins/builtin-fpclassify.c
b/clang/test/CIR/CodeGenBuiltins/builtin-fpclassify.c
index bad83c4f0ef4c..f544b0d0240f9 100644
--- a/clang/test/CIR/CodeGenBuiltins/builtin-fpclassify.c
+++ b/clang/test/CIR/CodeGenBuiltins/builtin-fpclassify.c
@@ -84,273 +84,30 @@ void test_fpclassify_inf(){
float infValue = 1.0f / 0.0f;
__builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
FP_SUBNORMAL, FP_ZERO, infValue);
-// CIR: %[[IS_ZERO:.+]] = cir.is_fp_class %{{.+}}, fcZero : (!cir.float) ->
!cir.bool
-// CIR: cir.ternary(%[[IS_ZERO]], true {
-// CIR: cir.const #cir.int<96> : !s32i
-// CIR: %[[IS_NAN:.+]] = cir.is_fp_class %{{.+}}, fcNan : (!cir.float) ->
!cir.bool
-// CIR: cir.ternary(%[[IS_NAN]], true {
-// CIR: cir.const #cir.int<3> : !s32i
-// CIR: %[[IS_INF:.+]] = cir.is_fp_class %{{.+}}, fcInf : (!cir.float) ->
!cir.bool
-// CIR: cir.ternary(%[[IS_INF]], true {
-// CIR: cir.const #cir.int<516> : !s32i
-// CIR: %[[IS_NORMAL:.+]] = cir.is_fp_class %{{.+}}, fcNormal : (!cir.float)
-> !cir.bool
-// CIR: %[[NORMAL_VAL:.+]] = cir.const #cir.int<264> : !s32i
-// CIR: %[[SUBNORMAL_VAL:.+]] = cir.const #cir.int<144> : !s32i
-// CIR: cir.select if %[[IS_NORMAL]] then %[[NORMAL_VAL]] else
%[[SUBNORMAL_VAL]] : (!cir.bool, !s32i, !s32i) -> !s32i
-// LLVM: %[[VAL:.+]] = load float, ptr
-// LLVM-NEXT: %[[IS_ZERO:.+]] = call i1 @llvm.is.fpclass.f32(float %[[VAL]],
i32 96)
-// LLVM-NEXT: br i1 %[[IS_ZERO]], label %[[BB_ZERO:.+]], label
%[[BB_NOT_ZERO:.+]]
-// LLVM: [[BB_ZERO]]:
-// LLVM-NEXT: br label %[[BB_RET:.+]]
-// LLVM: [[BB_NOT_ZERO]]:
-// LLVM-NEXT: %[[IS_NAN:.+]] = call i1 @llvm.is.fpclass.f32(float %[[VAL]],
i32 3)
-// LLVM-NEXT: br i1 %[[IS_NAN]], label %[[BB_NAN:.+]], label %[[BB_NOT_NAN:.+]]
-// LLVM: [[BB_NAN]]:
-// LLVM-NEXT: br label %[[BB_MERGE1:.+]]
-// LLVM: [[BB_NOT_NAN]]:
-// LLVM-NEXT: %[[IS_INF:.+]] = call i1 @llvm.is.fpclass.f32(float %[[VAL]],
i32 516)
-// LLVM-NEXT: br i1 %[[IS_INF]], label %[[BB_INF:.+]], label %[[BB_NOT_INF:.+]]
-// LLVM: [[BB_INF]]:
-// LLVM-NEXT: br label %[[BB_MERGE2:.+]]
-// LLVM: [[BB_NOT_INF]]:
-// LLVM-NEXT: %[[IS_NORMAL:.+]] = call i1 @llvm.is.fpclass.f32(float %[[VAL]],
i32 264)
-// LLVM-NEXT: %[[SEL:.+]] = select i1 %[[IS_NORMAL]], i32 264, i32 144
-// LLVM-NEXT: br label %[[BB_MERGE2]]
-// LLVM: [[BB_MERGE2]]:
-// LLVM-NEXT: %[[PHI1:.+]] = phi i32 [ %[[SEL]], %[[BB_NOT_INF]] ], [ 516,
%[[BB_INF]] ]
-// LLVM-NEXT: br label %[[BB_CONT1:.+]]
-// LLVM: [[BB_CONT1]]:
-// LLVM-NEXT: br label %[[BB_MERGE1]]
-// LLVM: [[BB_MERGE1]]:
-// LLVM-NEXT: %[[PHI2:.+]] = phi i32 [ %[[PHI1]], %[[BB_CONT1]] ], [ 3,
%[[BB_NAN]] ]
-// LLVM-NEXT: br label %[[BB_CONT2:.+]]
-// LLVM: [[BB_CONT2]]:
-// LLVM-NEXT: br label %[[BB_RET]]
-// LLVM: [[BB_RET]]:
-// LLVM-NEXT: %[[PHI3:.+]] = phi i32 [ %[[PHI2]], %[[BB_CONT2]] ], [ 96,
%[[BB_ZERO]] ]
-// LLVM-NEXT: br label
-// OGCG: %[[CMP_ZERO:.+]] = fcmp oeq float %[[VAL:.+]],
-// OGCG-NEXT: br i1 %[[CMP_ZERO]], label %[[BB_RET:.+]], label
%[[BB_NOT_ZERO:.+]]
-// OGCG: [[BB_RET]]:
-// OGCG-NEXT: %[[PHI:.+]] = phi i32 [ 96, %[[BB_ENTRY:.+]] ], [ 3,
%[[BB_NOT_ZERO]] ], [ 516, %[[BB_NOT_NAN:.+]] ], [ %[[SEL:.+]],
%[[BB_NOT_INF:.+]] ]
-// OGCG: [[BB_NOT_ZERO]]:
-// OGCG-NEXT: %[[CMP_NAN:.+]] = fcmp uno float %[[VAL]], %[[VAL]]
-// OGCG-NEXT: br i1 %[[CMP_NAN]], label %[[BB_RET]], label %[[BB_NOT_NAN]]
-// OGCG: [[BB_NOT_NAN]]:
-// OGCG-NEXT: %[[FABS:.+]] = call float @llvm.fabs.f32(float %[[VAL]])
-// OGCG-NEXT: %[[CMP_INF:.+]] = fcmp oeq float %[[FABS]],
-// OGCG-NEXT: br i1 %[[CMP_INF]], label %[[BB_RET]], label %[[BB_NOT_INF]]
-// OGCG: [[BB_NOT_INF]]:
-// OGCG-NEXT: %[[CMP_NORMAL:.+]] = fcmp uge float %[[FABS]],
-// OGCG-NEXT: %[[SEL]] = select i1 %[[CMP_NORMAL]], i32 264, i32 144
-// OGCG-NEXT: br label %[[BB_RET]]
}
void test_fpclassify_normal(){
float normalValue = 1.0f;
__builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
FP_SUBNORMAL, FP_ZERO,
normalValue);
-// CIR: %[[IS_ZERO:.+]] = cir.is_fp_class %{{.+}}, fcZero : (!cir.float) ->
!cir.bool
-// CIR: cir.ternary(%[[
