brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 091269d Raw
47 lines · cpp
1// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu %s -fclangir -emit-cir -o %t.cir2// RUN: FileCheck --input-file=%t.cir -check-prefix=CIR %s3// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu %s -fclangir -emit-llvm -o %t-cir.ll4// RUN: FileCheck --input-file=%t-cir.ll -check-prefix=LLVM %s5// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o %t.ll6// RUN: FileCheck --input-file=%t.ll -check-prefix=OGCG %s7 8void t1() {9  int *p1 = nullptr;10  int *p2 = 0;11  int *p3 = (int*)0;12}13 14// CIR:      cir.func{{.*}} @_Z2t1v()15// CIR-NEXT:     %[[P1:.*]] = cir.alloca !cir.ptr<!s32i>, !cir.ptr<!cir.ptr<!s32i>>, ["p1", init] {alignment = 8 : i64}16// CIR-NEXT:     %[[P2:.*]] = cir.alloca !cir.ptr<!s32i>, !cir.ptr<!cir.ptr<!s32i>>, ["p2", init] {alignment = 8 : i64}17// CIR-NEXT:     %[[P3:.*]] = cir.alloca !cir.ptr<!s32i>, !cir.ptr<!cir.ptr<!s32i>>, ["p3", init] {alignment = 8 : i64}18// CIR-NEXT:     %[[NULLPTR1:.*]] = cir.const #cir.ptr<null> : !cir.ptr<!s32i>19// CIR-NEXT:     cir.store{{.*}} %[[NULLPTR1]], %[[P1]] : !cir.ptr<!s32i>, !cir.ptr<!cir.ptr<!s32i>>20// CIR-NEXT:     %[[NULLPTR2:.*]] = cir.const #cir.ptr<null> : !cir.ptr<!s32i>21// CIR-NEXT:     cir.store{{.*}} %[[NULLPTR2]], %[[P2]] : !cir.ptr<!s32i>, !cir.ptr<!cir.ptr<!s32i>>22// CIR-NEXT:     %[[NULLPTR3:.*]] = cir.const #cir.ptr<null> : !cir.ptr<!s32i>23// CIR-NEXT:     cir.store{{.*}} %[[NULLPTR3]], %[[P3]] : !cir.ptr<!s32i>, !cir.ptr<!cir.ptr<!s32i>>24// CIR-NEXT:     cir.return25// CIR-NEXT: }26 27// LLVM:      define{{.*}} @_Z2t1v()28// LLVM-NEXT:     %[[P1:.*]] = alloca ptr, i64 1, align 829// LLVM-NEXT:     %[[P2:.*]] = alloca ptr, i64 1, align 830// LLVM-NEXT:     %[[P3:.*]] = alloca ptr, i64 1, align 831// LLVM-NEXT:     store ptr null, ptr %[[P1]], align 832// LLVM-NEXT:     store ptr null, ptr %[[P2]], align 833// LLVM-NEXT:     store ptr null, ptr %[[P3]], align 834// LLVM-NEXT:     ret void35// LLVM-NEXT: }36 37// OGCG:      define{{.*}} @_Z2t1v()38// OGCG-NEXT: entry:39// OGCG-NEXT:     %[[P1:.*]] = alloca ptr, align 840// OGCG-NEXT:     %[[P2:.*]] = alloca ptr, align 841// OGCG-NEXT:     %[[P3:.*]] = alloca ptr, align 842// OGCG-NEXT:     store ptr null, ptr %[[P1]], align 843// OGCG-NEXT:     store ptr null, ptr %[[P2]], align 844// OGCG-NEXT:     store ptr null, ptr %[[P3]], align 845// OGCG-NEXT:     ret void46// OGCG-NEXT: }47