Skip to content

Commit ff92211

Browse files
committed
Address nits
1 parent 0b4a042 commit ff92211

File tree

3 files changed

+31
-28
lines changed

3 files changed

+31
-28
lines changed

clang/lib/CIR/CodeGen/Address.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class Address {
117117
}
118118

119119
cir::TargetAddressSpaceAttr getAddressSpace() const {
120-
auto ptrTy = llvm::dyn_cast<cir::PointerType>(getType());
120+
auto ptrTy = mlir::dyn_cast<cir::PointerType>(getType());
121121
return ptrTy.getAddrSpace();
122122
}
123123

clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
173173

174174
// Initialize the allocated buffer if required.
175175
if (builtinID != Builtin::BI__builtin_alloca_uninitialized) {
176+
// Initialize the alloca with the given size and alignment according to
177+
// the lang opts. Only the trivial non-initialization is supported for
178+
// now.
176179

177180
switch (getLangOpts().getTrivialAutoVarInit()) {
178181
case LangOptions::TrivialAutoVarInitKind::Uninitialized:

clang/test/CIR/CodeGen/address-space-conversion.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ using ri2_t = int __attribute__((address_space(2))) &;
1717
void test_ptr() {
1818
pi1_t ptr1;
1919
pi2_t ptr2 = (pi2_t)ptr1;
20-
// CIR: %[[#PTR1:]] = cir.load align(8) %{{[0-9]+}} : !cir.ptr<!cir.ptr<!s32i, target_address_space(1)>>, !cir.ptr<!s32i, target_address_space(1)>
20+
// CIR: %[[#PTR1:]] = cir.load{{.*}} %{{[0-9]+}} : !cir.ptr<!cir.ptr<!s32i, target_address_space(1)>>, !cir.ptr<!s32i, target_address_space(1)>
2121
// CIR-NEXT: %[[#CAST:]] = cir.cast address_space %[[#PTR1]] : !cir.ptr<!s32i, target_address_space(1)> -> !cir.ptr<!s32i, target_address_space(2)>
22-
// CIR-NEXT: cir.store align(8) %[[#CAST]], %{{[0-9]+}} : !cir.ptr<!s32i, target_address_space(2)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(2)>>
22+
// CIR-NEXT: cir.store{{.*}} %[[#CAST]], %{{[0-9]+}} : !cir.ptr<!s32i, target_address_space(2)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(2)>>
2323

24-
// LLVM: %[[#PTR1:]] = load ptr addrspace(1), ptr %{{[0-9]+}}, align 8
24+
// LLVM: %[[#PTR1:]] = load ptr addrspace(1), ptr %{{.*}}
2525
// LLVM-NEXT: %[[#CAST:]] = addrspacecast ptr addrspace(1) %[[#PTR1]] to ptr addrspace(2)
26-
// LLVM-NEXT: store ptr addrspace(2) %[[#CAST]], ptr %{{[0-9]+}}, align 8
26+
// LLVM-NEXT: store ptr addrspace(2) %[[#CAST]], ptr %{{.*}}
2727

28-
// OGCG: %{{.*}} = load ptr addrspace(1), ptr %{{.*}}, align 8
28+
// OGCG: %{{.*}} = load ptr addrspace(1), ptr %{{.*}}
2929
// OGCG-NEXT: %{{.*}} = addrspacecast ptr addrspace(1) %{{.*}} to ptr addrspace(2)
30-
// OGCG-NEXT: store ptr addrspace(2) %{{.*}}, ptr %{{.*}}, align 8
30+
// OGCG-NEXT: store ptr addrspace(2) %{{.*}}, ptr %{{.*}}
3131
}
3232

3333
// CIR: cir.func dso_local @{{.*test_ref.*}}
@@ -37,23 +37,23 @@ void test_ref() {
3737
pi1_t ptr;
3838
ri1_t ref1 = *ptr;
3939
ri2_t ref2 = (ri2_t)ref1;
40-
// CIR: %[[#DEREF:]] = cir.load deref align(8) %{{[0-9]+}} : !cir.ptr<!cir.ptr<!s32i, target_address_space(1)>>, !cir.ptr<!s32i, target_address_space(1)>
41-
// CIR-NEXT: cir.store align(8) %[[#DEREF]], %{{[0-9]+}} : !cir.ptr<!s32i, target_address_space(1)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(1)>>
40+
// CIR: %[[#DEREF:]] = cir.load deref{{.*}} %{{[0-9]+}} : !cir.ptr<!cir.ptr<!s32i, target_address_space(1)>>, !cir.ptr<!s32i, target_address_space(1)>
41+
// CIR-NEXT: cir.store{{.*}} %[[#DEREF]], %{{[0-9]+}} : !cir.ptr<!s32i, target_address_space(1)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(1)>>
4242
// CIR-NEXT: %[[#REF1:]] = cir.load %{{[0-9]+}} : !cir.ptr<!cir.ptr<!s32i, target_address_space(1)>>, !cir.ptr<!s32i, target_address_space(1)>
4343
// CIR-NEXT: %[[#CAST:]] = cir.cast address_space %[[#REF1]] : !cir.ptr<!s32i, target_address_space(1)> -> !cir.ptr<!s32i, target_address_space(2)>
44-
// CIR-NEXT: cir.store align(8) %[[#CAST]], %{{[0-9]+}} : !cir.ptr<!s32i, target_address_space(2)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(2)>>
44+
// CIR-NEXT: cir.store{{.*}} %[[#CAST]], %{{[0-9]+}} : !cir.ptr<!s32i, target_address_space(2)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(2)>>
4545

46-
// LLVM: %[[#DEREF:]] = load ptr addrspace(1), ptr %{{[0-9]+}}, align 8
47-
// LLVM-NEXT: store ptr addrspace(1) %[[#DEREF]], ptr %{{[0-9]+}}, align 8
48-
// LLVM-NEXT: %[[#REF1:]] = load ptr addrspace(1), ptr %{{[0-9]+}}, align 8
46+
// LLVM: %[[#DEREF:]] = load ptr addrspace(1), ptr %{{.*}}
47+
// LLVM-NEXT: store ptr addrspace(1) %[[#DEREF]], ptr %{{.*}}
48+
// LLVM-NEXT: %[[#REF1:]] = load ptr addrspace(1), ptr %{{.*}}
4949
// LLVM-NEXT: %[[#CAST:]] = addrspacecast ptr addrspace(1) %[[#REF1]] to ptr addrspace(2)
50-
// LLVM-NEXT: store ptr addrspace(2) %[[#CAST]], ptr %{{[0-9]+}}, align 8
50+
// LLVM-NEXT: store ptr addrspace(2) %[[#CAST]], ptr %{{.*}}
5151

52-
// OGCG: %{{.*}} = load ptr addrspace(1), ptr %{{.*}}, align 8
53-
// OGCG-NEXT: store ptr addrspace(1) %{{.*}}, ptr %{{.*}}, align 8
54-
// OGCG-NEXT: %{{.*}} = load ptr addrspace(1), ptr %{{.*}}, align 8
52+
// OGCG: %{{.*}} = load ptr addrspace(1), ptr %{{.*}}
53+
// OGCG-NEXT: store ptr addrspace(1) %{{.*}}, ptr %{{.*}}
54+
// OGCG-NEXT: %{{.*}} = load ptr addrspace(1), ptr %{{.*}}
5555
// OGCG-NEXT: %{{.*}} = addrspacecast ptr addrspace(1) %{{.*}} to ptr addrspace(2)
56-
// OGCG-NEXT: store ptr addrspace(2) %{{.*}}, ptr %{{.*}}, align 8
56+
// OGCG-NEXT: store ptr addrspace(2) %{{.*}}, ptr %{{.*}}
5757
}
5858

5959
// CIR: cir.func dso_local @{{.*test_nullptr.*}}
@@ -63,30 +63,30 @@ void test_nullptr() {
6363
constexpr pi1_t null1 = nullptr;
6464
pi2_t ptr = (pi2_t)null1;
6565
// CIR: %[[#NULL1:]] = cir.const #cir.ptr<null> : !cir.ptr<!s32i, target_address_space(1)>
66-
// CIR-NEXT: cir.store align(8) %[[#NULL1]], %{{[0-9]+}} : !cir.ptr<!s32i, target_address_space(1)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(1)>>
66+
// CIR-NEXT: cir.store{{.*}} %[[#NULL1]], %{{[0-9]+}} : !cir.ptr<!s32i, target_address_space(1)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(1)>>
6767
// CIR-NEXT: %[[#NULL2:]] = cir.const #cir.ptr<null> : !cir.ptr<!s32i, target_address_space(2)>
68-
// CIR-NEXT: cir.store align(8) %[[#NULL2]], %{{[0-9]+}} : !cir.ptr<!s32i, target_address_space(2)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(2)>>
68+
// CIR-NEXT: cir.store{{.*}} %[[#NULL2]], %{{[0-9]+}} : !cir.ptr<!s32i, target_address_space(2)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(2)>>
6969

70-
// LLVM: store ptr addrspace(1) null, ptr %{{[0-9]+}}, align 8
71-
// LLVM-NEXT: store ptr addrspace(2) null, ptr %{{[0-9]+}}, align 8
70+
// LLVM: store ptr addrspace(1) null, ptr %{{.*}}
71+
// LLVM-NEXT: store ptr addrspace(2) null, ptr %{{.*}}
7272

73-
// OGCG: store ptr addrspace(1) null, ptr %{{.*}}, align 8
74-
// OGCG-NEXT: store ptr addrspace(2) null, ptr %{{.*}}, align 8
73+
// OGCG: store ptr addrspace(1) null, ptr %{{.*}}
74+
// OGCG-NEXT: store ptr addrspace(2) null, ptr %{{.*}}
7575
}
7676

7777
// CIR: cir.func dso_local @{{.*test_side_effect.*}}
7878
// LLVM: define dso_local void @{{.*test_side_effect.*}}
7979
// OGCG: define dso_local void @{{.*test_side_effect.*}}
8080
void test_side_effect(pi1_t b) {
8181
pi2_t p = (pi2_t)(*b++, (int*)0);
82-
// CIR: %[[#DEREF:]] = cir.load deref align(8) %{{[0-9]+}} : !cir.ptr<!cir.ptr<!s32i, target_address_space(1)>>, !cir.ptr<!s32i, target_address_space(1)>
82+
// CIR: %[[#DEREF:]] = cir.load deref{{.*}} %{{[0-9]+}} : !cir.ptr<!cir.ptr<!s32i, target_address_space(1)>>, !cir.ptr<!s32i, target_address_space(1)>
8383
// CIR: %[[#STRIDE:]] = cir.ptr_stride %[[#DEREF]], %{{[0-9]+}} : (!cir.ptr<!s32i, target_address_space(1)>, !s32i) -> !cir.ptr<!s32i, target_address_space(1)>
8484
// CIR: %[[#NULL:]] = cir.const #cir.ptr<null> : !cir.ptr<!s32i, target_address_space(2)>
85-
// CIR-NEXT: cir.store align(8) %[[#NULL]], %{{[0-9]+}} : !cir.ptr<!s32i, target_address_space(2)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(2)>>
85+
// CIR-NEXT: cir.store{{.*}} %[[#NULL]], %{{[0-9]+}} : !cir.ptr<!s32i, target_address_space(2)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(2)>>
8686

8787
// LLVM: %{{[0-9]+}} = getelementptr {{.*}}i32, ptr addrspace(1) %{{[0-9]+}}, i{{32|64}} 1
88-
// LLVM: store ptr addrspace(2) null, ptr %{{[0-9]+}}, align 8
88+
// LLVM: store ptr addrspace(2) null, ptr %{{.*}}
8989

9090
// OGCG: %{{.*}} = getelementptr{{.*}} i32, ptr addrspace(1) %{{.*}}, i32 1
91-
// OGCG: store ptr addrspace(2) null, ptr %{{.*}}, align 8
91+
// OGCG: store ptr addrspace(2) null, ptr %{{.*}}
9292
}

0 commit comments

Comments
 (0)