llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Andy Kaylor (andykaylor) <details> <summary>Changes</summary> A number of CIR tests were checking LLVM IR output for GEP statements that contained `inbounds` and `nuw` flags that had been added by LLVM's constant folder. Following https://github.com/llvm/llvm-project/pull/226534 these are no longer produced. This change updates the tests to match the current output. Assisted-by: Cursor / claude-opus-5.5 --- Full diff: https://github.com/llvm/llvm-project/pull/227523.diff 7 Files Affected: - (modified) clang/test/CIR/CodeGen/constexpr-ptr-offset.cpp (+1-1) - (modified) clang/test/CIR/CodeGen/global-ptr-init.cpp (+1-1) - (modified) clang/test/CIR/CodeGen/globals.cpp (+1-3) - (modified) clang/test/CIR/CodeGen/self-ref-temporaries.cpp (+2-2) - (modified) clang/test/CIR/CodeGen/vtt.cpp (+7-7) - (modified) clang/test/CIR/CodeGenCXX/base-layout.cpp (+1-1) - (modified) clang/test/CIR/CodeGenCXX/vtable-linkage.cpp (+1-1) ``````````diff diff --git a/clang/test/CIR/CodeGen/constexpr-ptr-offset.cpp b/clang/test/CIR/CodeGen/constexpr-ptr-offset.cpp index 5c4f0f13ef758..87e7ca291a045 100644 --- a/clang/test/CIR/CodeGen/constexpr-ptr-offset.cpp +++ b/clang/test/CIR/CodeGen/constexpr-ptr-offset.cpp @@ -20,7 +20,7 @@ void test() { // CIR: cir.global "private" constant cir_private @__const._Z4testv.v = #cir.const_record<{#cir.global_view<@"[[STR_NAME:.*]]", [2 : i32]> : !cir.ptr<!s8i>, #cir.int<3> : !s32i, #cir.zero : !cir.array<!u8i x 4>}> : !rec_View // CIR: cir.global "private" constant cir_private dso_local @"[[STR_NAME]]" = #cir.const_array<"hello" : !cir.array<!s8i x 5>, trailing_zeros> : !cir.array<!s8i x 6> -// LLVMCIR: @__const._Z4testv.v = private constant %struct.View <{ ptr getelementptr inbounds nuw (i8, ptr @[[STR_NAME:.*]], i64 2), i32 3, [4 x i8] zeroinitializer }> +// LLVMCIR: @__const._Z4testv.v = private constant %struct.View <{ ptr getelementptr (i8, ptr @[[STR_NAME:.*]], i64 2), i32 3, [4 x i8] zeroinitializer }> // LLVMCIR: @[[STR_NAME]] = private {{.*}}constant [6 x i8] c"hello\00" // OGCG: @[[STR_NAME:.*]] = private {{.*}}constant [6 x i8] c"hello\00" diff --git a/clang/test/CIR/CodeGen/global-ptr-init.cpp b/clang/test/CIR/CodeGen/global-ptr-init.cpp index 9a9824881a98c..bbaaea01f741d 100644 --- a/clang/test/CIR/CodeGen/global-ptr-init.cpp +++ b/clang/test/CIR/CodeGen/global-ptr-init.cpp @@ -12,5 +12,5 @@ struct B { B x; // CIR: cir.global external @x = #cir.const_record<{#cir.global_view<@_ZTV1B, [0 : i32, 2 : i32]> : !cir.vptr}> : !rec_B -// LLVM: @x = global %struct.B { ptr getelementptr inbounds nuw (i8, ptr @_ZTV1B, i64 16) }, align 8 +// LLVM: @x = global %struct.B { ptr getelementptr (i8, ptr @_ZTV1B, i64 16) }, align 8 // OGCG: @x = global %struct.B { ptr getelementptr inbounds inrange(-16, 24) (i8, ptr @_ZTV1B, i64 16) }, align 8 diff --git a/clang/test/CIR/CodeGen/globals.cpp b/clang/test/CIR/CodeGen/globals.cpp index 44e80fa7d2a6d..cac86c61567c1 100644 --- a/clang/test/CIR/CodeGen/globals.cpp +++ b/clang/test/CIR/CodeGen/globals.cpp @@ -30,9 +30,7 @@ int *constArrAddr = &arr[2][1]; // CIR: cir.global external @constArrAddr = #cir.global_view<@arr, [2 : i32, 1 : i32]> : !cir.ptr<!s32i> -// The 'inbounds' and 'nuw' flags are inferred by LLVM's constant folder. The -// same flags show up at -O1 in OGCG. -// LLVM: @constArrAddr = global ptr getelementptr inbounds nuw (i8, ptr @arr, i64 132), align 8 +// LLVM: @constArrAddr = global ptr getelementptr (i8, ptr @arr, i64 132), align 8 // OGCG: @constArrAddr = global ptr getelementptr (i8, ptr @arr, i64 132), align 8 diff --git a/clang/test/CIR/CodeGen/self-ref-temporaries.cpp b/clang/test/CIR/CodeGen/self-ref-temporaries.cpp index f31bbc03c2e75..4755b9046f820 100644 --- a/clang/test/CIR/CodeGen/self-ref-temporaries.cpp +++ b/clang/test/CIR/CodeGen/self-ref-temporaries.cpp @@ -15,7 +15,7 @@ struct SelfRef { constexpr const SelfRef &sr = SelfRef(); // CIR: cir.global "private" constant internal @_ZGR2sr_ = #cir.const_record<{#cir.global_view<@_ZGR2sr_, [1 : i32]> : !cir.ptr<!s32i>, #cir.const_array<[#cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i]> : !cir.array<!s32i x 3>, #cir.zero : !cir.array<!u8i x 4>}> : !rec_SelfRef // CIR: cir.global constant external @sr = #cir.global_view<@_ZGR2sr_> : !cir.ptr<!rec_SelfRef> -// LLVMCIR: @_ZGR2sr_ = {{.*}}constant %struct.SelfRef <{ ptr getelementptr inbounds nuw (i8, ptr @_ZGR2sr_, i64 8), [3 x i32] [i32 1, i32 2, i32 3], [4 x i8] zeroinitializer }>, align 8 +// LLVMCIR: @_ZGR2sr_ = {{.*}}constant %struct.SelfRef <{ ptr getelementptr (i8, ptr @_ZGR2sr_, i64 8), [3 x i32] [i32 1, i32 2, i32 3], [4 x i8] zeroinitializer }>, align 8 // OGCG: @_ZGR2sr_ = {{.*}}constant { ptr, [3 x i32] } { ptr getelementptr {{.*}}(i8, ptr @_ZGR2sr_, i64 8), [3 x i32] [i32 1, i32 2, i32 3] }, align 8 // LLVM: @sr = constant ptr @_ZGR2sr_, align 8 @@ -29,7 +29,7 @@ struct MultiSelfRef { constexpr const MultiSelfRef &msr = MultiSelfRef(); // CIR: cir.global "private" constant internal @_ZGR3msr_ = #cir.const_record<{#cir.global_view<@_ZGR3msr_, [2 : i32]> : !cir.ptr<!s32i>, #cir.global_view<@_ZGR3msr_, [2 : i32]> : !cir.ptr<!s32i>, #cir.const_array<[#cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i]> : !cir.array<!s32i x 3>, #cir.zero : !cir.array<!u8i x 4>}> : !rec_MultiSelfRef // CIR: cir.global constant external @msr = #cir.global_view<@_ZGR3msr_> : !cir.ptr<!rec_MultiSelfRef> -// LLVMCIR: @_ZGR3msr_ = internal constant %struct.MultiSelfRef <{ ptr getelementptr inbounds nuw (i8, ptr @_ZGR3msr_, i64 16), ptr getelementptr inbounds nuw (i8, ptr @_ZGR3msr_, i64 16), [3 x i32] [i32 1, i32 2, i32 3], [4 x i8] zeroinitializer }>, align 8 +// LLVMCIR: @_ZGR3msr_ = internal constant %struct.MultiSelfRef <{ ptr getelementptr (i8, ptr @_ZGR3msr_, i64 16), ptr getelementptr (i8, ptr @_ZGR3msr_, i64 16), [3 x i32] [i32 1, i32 2, i32 3], [4 x i8] zeroinitializer }>, align 8 // OGCG: @_ZGR3msr_ = {{.*}}constant { ptr, ptr, [3 x i32] } { ptr getelementptr {{.*}}(i8, ptr @_ZGR3msr_, i64 16), ptr getelementptr {{.*}}(i8, ptr @_ZGR3msr_, i64 16), [3 x i32] [i32 1, i32 2, i32 3] }, align 8 // LLVM: @msr = constant ptr @_ZGR3msr_, align 8 diff --git a/clang/test/CIR/CodeGen/vtt.cpp b/clang/test/CIR/CodeGen/vtt.cpp index 4fa1a5b1f4c27..cf878e0c315e6 100644 --- a/clang/test/CIR/CodeGen/vtt.cpp +++ b/clang/test/CIR/CodeGen/vtt.cpp @@ -117,13 +117,13 @@ void D::y() {} // CIR-COMMON-SAME: ]> : !cir.array<!cir.ptr<!u8i> x 7> align(8) // LLVM-COMMON: @_ZTT1D = constant [7 x ptr] [ -// LLVM-COMMON-SAME: ptr getelementptr inbounds nuw (i8, ptr @_ZTV1D, i64 24), -// LLVM-COMMON-SAME: ptr getelementptr inbounds nuw (i8, ptr @_ZTC1D0_1B, i64 24), -// LLVM-COMMON-SAME: ptr getelementptr inbounds nuw (i8, ptr @_ZTC1D0_1B, i64 56), -// LLVM-COMMON-SAME: ptr getelementptr inbounds nuw (i8, ptr @_ZTC1D16_1C, i64 24), -// LLVM-COMMON-SAME: ptr getelementptr inbounds nuw (i8, ptr @_ZTC1D16_1C, i64 56), -// LLVM-COMMON-SAME: ptr getelementptr inbounds nuw (i8, ptr @_ZTV1D, i64 96), -// LLVM-COMMON-SAME: ptr getelementptr inbounds nuw (i8, ptr @_ZTV1D, i64 64) +// LLVM-COMMON-SAME: ptr getelementptr (i8, ptr @_ZTV1D, i64 24), +// LLVM-COMMON-SAME: ptr getelementptr (i8, ptr @_ZTC1D0_1B, i64 24), +// LLVM-COMMON-SAME: ptr getelementptr (i8, ptr @_ZTC1D0_1B, i64 56), +// LLVM-COMMON-SAME: ptr getelementptr (i8, ptr @_ZTC1D16_1C, i64 24), +// LLVM-COMMON-SAME: ptr getelementptr (i8, ptr @_ZTC1D16_1C, i64 56), +// LLVM-COMMON-SAME: ptr getelementptr (i8, ptr @_ZTV1D, i64 96), +// LLVM-COMMON-SAME: ptr getelementptr (i8, ptr @_ZTV1D, i64 64) // LLVM-COMMON-SAME: ], align 8 // OGCG-COMMON: @_ZTT1D = unnamed_addr constant [7 x ptr] [ diff --git a/clang/test/CIR/CodeGenCXX/base-layout.cpp b/clang/test/CIR/CodeGenCXX/base-layout.cpp index dc80ef1dbb8dd..596809b54506c 100644 --- a/clang/test/CIR/CodeGenCXX/base-layout.cpp +++ b/clang/test/CIR/CodeGenCXX/base-layout.cpp @@ -15,7 +15,7 @@ struct D : V3, B {}; constinit D d{}; // CIR: cir.global external @d = #cir.const_record<{#cir.const_record<{#cir.global_view<@_ZTV1D, [0 : i32, 2 : i32]> : !cir.vptr}> : !rec_V3, #cir.const_record<{#cir.const_record<{#cir.global_view<@_ZTV1D, [1 : i32, 2 : i32]> : !cir.vptr}> : !rec_V1, #cir.const_record<{#cir.global_view<@_ZTV1D, [2 : i32, 2 : i32]> : !cir.vptr}> : !rec_V2}> : !rec_B}> : !rec_D -// LLVM: @d = global %struct.D { %struct.V3 { ptr getelementptr inbounds nuw (i8, ptr @_ZTV1D, i64 16) }, %struct.B { %struct.V1 { ptr getelementptr inbounds nuw (i8, ptr @_ZTV1D, i64 40) }, %struct.V2 { ptr getelementptr inbounds nuw (i8, ptr @_ZTV1D, i64 64) } } } +// LLVM: @d = global %struct.D { %struct.V3 { ptr getelementptr (i8, ptr @_ZTV1D, i64 16) }, %struct.B { %struct.V1 { ptr getelementptr (i8, ptr @_ZTV1D, i64 40) }, %struct.V2 { ptr getelementptr (i8, ptr @_ZTV1D, i64 64) } } } // OGCG: @d = global { ptr, ptr, ptr } { ptr getelementptr inbounds inrange(-16, 8) (i8, ptr @_ZTV1D, i64 16), ptr getelementptr inbounds inrange(-16, 8) (i8, ptr @_ZTV1D, i64 40), ptr getelementptr inbounds inrange(-16, 8) (i8, ptr @_ZTV1D, i64 64) } diff --git a/clang/test/CIR/CodeGenCXX/vtable-linkage.cpp b/clang/test/CIR/CodeGenCXX/vtable-linkage.cpp index cdef1dbeb086a..2b7bf531a9d5e 100644 --- a/clang/test/CIR/CodeGenCXX/vtable-linkage.cpp +++ b/clang/test/CIR/CodeGenCXX/vtable-linkage.cpp @@ -121,7 +121,7 @@ void use_F() { // LLVM-DAG: @_ZTV1C = linkonce_odr constant { [5 x ptr] } { [5 x ptr] [ptr null, ptr null, ptr null, ptr @_ZTI1C, ptr @_ZN1C1fEv] }, comdat, align 8 // LLVM-DAG: @_ZTS1C = linkonce_odr constant [{{[0-9]}} x i8] c"1C\00", comdat, align 1 // LLVM-DAG: @_ZTI1C = linkonce_odr constant { ptr, ptr, i32, i32, ptr, i64 } { ptr getelementptr{{.*}}({{.*}}, ptr @_ZTVN10__cxxabiv121__vmi_class_type_infoE, i64 {{.*}}), ptr @_ZTS1C, i32 0, i32 1, ptr @_ZTI1B, i64 -8189 }, comdat -// LLVM-DAG: @_ZTT1C = linkonce_odr{{.*}} constant [2 x ptr] [ptr getelementptr inbounds{{.*}}({{.*}}, ptr @_ZTV1C, {{.*}}, ptr getelementptr inbounds {{.*}}({{.*}}, ptr @_ZTV1C{{.*}})] +// LLVM-DAG: @_ZTT1C = linkonce_odr{{.*}} constant [2 x ptr] [ptr getelementptr {{.*}}(i8, ptr @_ZTV1C, i64 32), ptr getelementptr {{.*}}(i8, ptr @_ZTV1C, i64 32)] // D has a key function that is defined in this translation unit so its vtable is // defined in the translation unit. `````````` </details> https://github.com/llvm/llvm-project/pull/227523 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
