diff options
Diffstat (limited to 'clang/test/CIR/CodeGen/compound_literal.cpp')
| -rw-r--r-- | clang/test/CIR/CodeGen/compound_literal.cpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/clang/test/CIR/CodeGen/compound_literal.cpp b/clang/test/CIR/CodeGen/compound_literal.cpp index 30a1dc0..5219710 100644 --- a/clang/test/CIR/CodeGen/compound_literal.cpp +++ b/clang/test/CIR/CodeGen/compound_literal.cpp @@ -79,17 +79,17 @@ void foo3() { } // CIR: %[[A_ADDR:.*]] = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>, ["a", init] -// CIR: %[[CL_ADDR:.*]] = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>, [".compoundliteral", init] // CIR: %[[VEC:.*]] = cir.const #cir.const_vector<[#cir.int<10> : !s32i, #cir.int<20> : !s32i, #cir.int<30> : !s32i, #cir.int<40> : !s32i]> : !cir.vector<4 x !s32i> -// CIR: cir.store{{.*}} %[[VEC]], %[[CL_ADDR]] : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>> -// CIR: %[[TMP:.*]] = cir.load{{.*}} %[[CL_ADDR]] : !cir.ptr<!cir.vector<4 x !s32i>>, !cir.vector<4 x !s32i> -// CIR: cir.store{{.*}} %[[TMP]], %[[A_ADDR]] : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>> +// CIR: cir.store{{.*}} %[[VEC]], %[[A_ADDR]] : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>> // LLVM: %[[A_ADDR:.*]] = alloca <4 x i32>, i64 1, align 16 -// LLVM: %[[CL_ADDR:.*]] = alloca <4 x i32>, i64 1, align 16 -// LLVM: store <4 x i32> <i32 10, i32 20, i32 30, i32 40>, ptr %[[CL_ADDR]], align 16 -// LLVM: %[[TMP:.*]] = load <4 x i32>, ptr %[[CL_ADDR]], align 16 -// LLVM: store <4 x i32> %[[TMP]], ptr %[[A_ADDR]], align 16 +// LLVM: store <4 x i32> <i32 10, i32 20, i32 30, i32 40>, ptr %[[A_ADDR]], align 16 + +// FIXME: OGCG emits a temporary compound literal in this case because it omits +// vector types from the check for aggregate constants in +// EmitAutoVarAlloca. This looks like an oversight in OGCG because the +// code to emit a constant in EmitStoresForConstant specifically looks +// for vector types in OGCG. // OGCG: %[[A_ADDR:.*]] = alloca <4 x i32>, align 16 // OGCG: %[[CL_ADDR:.*]] = alloca <4 x i32>, align 16 @@ -107,19 +107,12 @@ void foo4() { // CIR-LABEL: @_Z4foo4v // CIR: %[[P:.*]] = cir.alloca !rec_Point, !cir.ptr<!rec_Point>, ["p", init] -// CIR: %[[P_X:.*]] = cir.get_member %[[P]][0] {name = "x"} -// CIR: %[[FIVE:.*]] = cir.const #cir.int<5> : !s32i -// CIR: cir.store{{.*}} %[[FIVE]], %[[P_X]] -// CIR: %[[P_Y:.*]] = cir.get_member %[[P]][1] {name = "y"} -// CIR: %[[TEN:.*]] = cir.const #cir.int<10> : !s32i -// CIR: cir.store{{.*}} %[[TEN]], %[[P_Y]] +// CIR: %[[CONST:.*]] = cir.const #cir.const_record<{#cir.int<5> : !s32i, #cir.int<10> : !s32i}> : !rec_Point +// CIR: cir.store{{.*}} %[[CONST]], %[[P]] : !rec_Point, !cir.ptr<!rec_Point> // LLVM-LABEL: @_Z4foo4v // LLVM: %[[P:.*]] = alloca %struct.Point -// LLVM: %[[P_X:.*]] = getelementptr %struct.Point, ptr %[[P]], i32 0, i32 0 -// LLVM: store i32 5, ptr %[[P_X]] -// LLVM: %[[P_Y:.*]] = getelementptr %struct.Point, ptr %[[P]], i32 0, i32 1 -// LLVM: store i32 10, ptr %[[P_Y]] +// LLVM: store %struct.Point { i32 5, i32 10 }, ptr %[[P]], align 4 // OGCG-LABEL: @_Z4foo4v // OGCG: %[[P:.*]] = alloca %struct.Point |
