Skip to content

Commit 2bca2f4

Browse files
committed
remove the too restrictive assertion
1 parent 0766623 commit 2bca2f4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,8 @@ void CIRGenModule::replaceGlobal(mlir::cir::GlobalOp Old,
518518
if (OldSymUses.has_value()) {
519519
for (auto Use : *OldSymUses) {
520520
auto UseOp = dyn_cast<mlir::cir::GetGlobalOp>(Use.getUser());
521-
assert(UseOp && "GlobalOp symbol user is not a GetGlobalOp");
521+
if (!UseOp)
522+
continue;
522523

523524
auto UseOpResultValue = UseOp.getAddr();
524525
UseOpResultValue.setType(

clang/test/CIR/CodeGen/array-unknown-bound.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
extern int table[];
44
// CHECK: cir.global external @table = #cir.const_array<[#cir.int<1> : !s32i, #cir.int<2> : !s32i, #cir.int<3> : !s32i]> : !cir.array<!s32i x 3>
55

6+
int *table_ptr = table;
7+
// CHECK: cir.global external @table_ptr = #cir.global_view<@table> : !cir.ptr<!s32i>
8+
69
int test() { return table[1]; }
710
// CHECK: cir.func @_Z4testv() -> !s32i extra( {inline = #cir.inline<no>, optnone = #cir.optnone} ) {
811
// CHECK-NEXT: %0 = cir.alloca !s32i, cir.ptr <!s32i>, ["__retval"] {alignment = 4 : i64}
912
// CHECK-NEXT: %1 = cir.get_global @table : cir.ptr <!cir.array<!s32i x 3>>
1013

11-
int table[3] {1, 2, 3};
14+
int table[3] {1, 2, 3};

0 commit comments

Comments
 (0)