Skip to content

[CIR] Restore the underscore in dso_local #145551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang/include/clang/CIR/Dialect/IR/CIROps.td
Original file line number Diff line number Diff line change
Expand Up @@ -1610,15 +1610,15 @@ def GlobalOp : CIR_Op<"global",
CIR_GlobalLinkageKind:$linkage,
OptionalAttr<AnyAttr>:$initial_value,
UnitAttr:$comdat,
UnitAttr:$dsolocal,
UnitAttr:$dso_local,
OptionalAttr<I64Attr>:$alignment);

let assemblyFormat = [{
($sym_visibility^)?
(`` $global_visibility^)?
$linkage
(`comdat` $comdat^)?
(`dsolocal` $dsolocal^)?
(`dso_local` $dso_local^)?
$sym_name
custom<GlobalOpTypeAndInitialValue>($sym_type, $initial_value)
attr-dict
Expand Down
4 changes: 2 additions & 2 deletions clang/include/clang/CIR/Interfaces/CIROpInterfaces.td
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ let cppNamespace = "::cir" in {
InterfaceMethod<"",
"void", "setDSOLocal", (ins "bool":$val), [{}],
/*defaultImplementation=*/[{
$_op.setDsolocal(val);
$_op.setDsoLocal(val);
}]
>,
InterfaceMethod<"",
"bool", "isDSOLocal", (ins), [{}],
/*defaultImplementation=*/[{
return $_op.getDsolocal();
return $_op.getDsoLocal();
}]
>,
InterfaceMethod<"",
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/CIR/MissingFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct MissingFeatures {
static bool opFuncOpenCLKernelMetadata() { return false; }
static bool opFuncCallingConv() { return false; }
static bool opFuncExtraAttrs() { return false; }
static bool opFuncDsolocal() { return false; }
static bool opFuncDsoLocal() { return false; }
static bool opFuncLinkage() { return false; }
static bool opFuncVisibility() { return false; }
static bool opFuncNoProto() { return false; }
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ mlir::LogicalResult CIRToLLVMFuncOpLowering::matchAndRewrite(
mlir::ConversionPatternRewriter &rewriter) const {

cir::FuncType fnType = op.getFunctionType();
assert(!cir::MissingFeatures::opFuncDsolocal());
assert(!cir::MissingFeatures::opFuncDsoLocal());
bool isDsoLocal = false;
mlir::TypeConverter::SignatureConversion signatureConversion(
fnType.getNumInputs());
Expand Down Expand Up @@ -1103,7 +1103,7 @@ void CIRToLLVMGlobalOpLowering::setupRegionInitializedLLVMGlobalOp(
const bool isConst = false;
assert(!cir::MissingFeatures::addressSpace());
const unsigned addrSpace = 0;
const bool isDsoLocal = op.getDsolocal();
const bool isDsoLocal = op.getDsoLocal();
assert(!cir::MissingFeatures::opGlobalThreadLocal());
const bool isThreadLocal = false;
const uint64_t alignment = op.getAlignment().value_or(0);
Expand Down Expand Up @@ -1157,7 +1157,7 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite(
const bool isConst = false;
assert(!cir::MissingFeatures::addressSpace());
const unsigned addrSpace = 0;
const bool isDsoLocal = op.getDsolocal();
const bool isDsoLocal = op.getDsoLocal();
assert(!cir::MissingFeatures::opGlobalThreadLocal());
const bool isThreadLocal = false;
const uint64_t alignment = op.getAlignment().value_or(0);
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CIR/CodeGen/builtin_printf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -Wno-unused-value -emit-llvm %s -o %t.ll
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG

// CIR: cir.global "private" cir_private dsolocal @".str" = #cir.const_array<"%s\00" : !cir.array<!s8i x 3>> : !cir.array<!s8i x 3>
// CIR: cir.global "private" cir_private dsolocal @".str.1" = #cir.const_array<"%s %d\0A\00" : !cir.array<!s8i x 7>> : !cir.array<!s8i x 7>
// CIR: cir.global "private" cir_private dso_local @".str" = #cir.const_array<"%s\00" : !cir.array<!s8i x 3>> : !cir.array<!s8i x 3>
// CIR: cir.global "private" cir_private dso_local @".str.1" = #cir.const_array<"%s %d\0A\00" : !cir.array<!s8i x 7>> : !cir.array<!s8i x 7>
// LLVM: @.str = private global [3 x i8] c"%s\00"
// LLVM: @.str.1 = private global [7 x i8] c"%s %d\0A\00"
// OGCG: @.str = private unnamed_addr constant [3 x i8] c"%s\00"
Expand Down
2 changes: 1 addition & 1 deletion clang/test/CIR/CodeGen/deferred-defs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ void use() {
}

// CIR: cir.global external @locallyDefined = #cir.int<0> : !s32i
// CIR: cir.global "private" internal dsolocal @_ZN12_GLOBAL__N_112usedInternalE = #cir.int<0> : !s32i
// CIR: cir.global "private" internal dso_local @_ZN12_GLOBAL__N_112usedInternalE = #cir.int<0> : !s32i
// CIR: cir.global "private" external @usedExternal : !s32i
2 changes: 1 addition & 1 deletion clang/test/CIR/CodeGen/namespace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace test {
}
}

// CHECK-DAG: cir.global "private" internal dsolocal @_ZN12_GLOBAL__N_12g1E = #cir.int<1> : !s32i
// CHECK-DAG: cir.global "private" internal dso_local @_ZN12_GLOBAL__N_12g1E = #cir.int<1> : !s32i
// CHECK-DAG: cir.global external @_ZN4test2g2E = #cir.int<2> : !s32i
// CHECK-DAG: cir.global external @_ZN4test5test22g3E = #cir.int<3> : !s32i
// CHECK-DAG: cir.func @_ZN12_GLOBAL__N_12f1Ev()
Expand Down
12 changes: 6 additions & 6 deletions clang/test/CIR/CodeGen/static-vars.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
void func1(void) {
// Should lower default-initialized static vars.
static int i;
// CHECK-DAG: cir.global "private" internal dsolocal @func1.i = #cir.int<0> : !s32i
// CHECK-DAG: cir.global "private" internal dso_local @func1.i = #cir.int<0> : !s32i

// Should lower constant-initialized static vars.
static int j = 1;
// CHECK-DAG: cir.global "private" internal dsolocal @func1.j = #cir.int<1> : !s32i
// CHECK-DAG: cir.global "private" internal dso_local @func1.j = #cir.int<1> : !s32i

// Should properly shadow static vars in nested scopes.
{
static int j = 2;
// CHECK-DAG: cir.global "private" internal dsolocal @func1.j.1 = #cir.int<2> : !s32i
// CHECK-DAG: cir.global "private" internal dso_local @func1.j.1 = #cir.int<2> : !s32i
}
{
static int j = 3;
// CHECK-DAG: cir.global "private" internal dsolocal @func1.j.2 = #cir.int<3> : !s32i
// CHECK-DAG: cir.global "private" internal dso_local @func1.j.2 = #cir.int<3> : !s32i
}

// Should lower basic static vars arithmetics.
Expand All @@ -31,7 +31,7 @@ void func1(void) {
// Should shadow static vars on different functions.
void func2(void) {
static char i;
// CHECK-DAG: cir.global "private" internal dsolocal @func2.i = #cir.int<0> : !s8i
// CHECK-DAG: cir.global "private" internal dso_local @func2.i = #cir.int<0> : !s8i
static float j;
// CHECK-DAG: cir.global "private" internal dsolocal @func2.j = #cir.fp<0.000000e+00> : !cir.float
// CHECK-DAG: cir.global "private" internal dso_local @func2.j = #cir.fp<0.000000e+00> : !cir.float
}
12 changes: 6 additions & 6 deletions clang/test/CIR/CodeGen/static-vars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
void func1(void) {
// Should lower default-initialized static vars.
static int i;
// CHECK-DAG: cir.global "private" internal dsolocal @_ZZ5func1vE1i = #cir.int<0> : !s32i
// CHECK-DAG: cir.global "private" internal dso_local @_ZZ5func1vE1i = #cir.int<0> : !s32i

// Should lower constant-initialized static vars.
static int j = 1;
// CHECK-DAG: cir.global "private" internal dsolocal @_ZZ5func1vE1j = #cir.int<1> : !s32i
// CHECK-DAG: cir.global "private" internal dso_local @_ZZ5func1vE1j = #cir.int<1> : !s32i

// Should properly shadow static vars in nested scopes.
{
static int j = 2;
// CHECK-DAG: cir.global "private" internal dsolocal @_ZZ5func1vE1j_0 = #cir.int<2> : !s32i
// CHECK-DAG: cir.global "private" internal dso_local @_ZZ5func1vE1j_0 = #cir.int<2> : !s32i
}
{
static int j = 3;
// CHECK-DAG: cir.global "private" internal dsolocal @_ZZ5func1vE1j_1 = #cir.int<3> : !s32i
// CHECK-DAG: cir.global "private" internal dso_local @_ZZ5func1vE1j_1 = #cir.int<3> : !s32i
}

// Should lower basic static vars arithmetics.
Expand All @@ -33,9 +33,9 @@ void func1(void) {
// Should shadow static vars on different functions.
void func2(void) {
static char i;
// CHECK-DAG: cir.global "private" internal dsolocal @_ZZ5func2vE1i = #cir.int<0> : !s8i
// CHECK-DAG: cir.global "private" internal dso_local @_ZZ5func2vE1i = #cir.int<0> : !s8i
static float j;
// CHECK-DAG: cir.global "private" internal dsolocal @_ZZ5func2vE1j = #cir.fp<0.000000e+00> : !cir.float
// CHECK-DAG: cir.global "private" internal dso_local @_ZZ5func2vE1j = #cir.fp<0.000000e+00> : !cir.float
}

// CHECK-DAG: cir.global linkonce_odr comdat @_ZZ4testvE1c = #cir.int<0> : !s32i
Expand Down
6 changes: 3 additions & 3 deletions clang/test/CIR/CodeGen/string-literals.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ char g_exact[4] = "123";

// CIR: cir.global external @g_exact = #cir.const_array<"123\00" : !cir.array<!s8i x 4>> : !cir.array<!s8i x 4>

// CIR: cir.global "private" cir_private dsolocal @[[STR1_GLOBAL:.*]] = #cir.const_array<"1\00" : !cir.array<!s8i x 2>> : !cir.array<!s8i x 2>
// CIR: cir.global "private" cir_private dsolocal @[[STR2_GLOBAL:.*]] = #cir.zero : !cir.array<!s8i x 1>
// CIR: cir.global "private" cir_private dsolocal @[[STR3_GLOBAL:.*]] = #cir.zero : !cir.array<!s8i x 2>
// CIR: cir.global "private" cir_private dso_local @[[STR1_GLOBAL:.*]] = #cir.const_array<"1\00" : !cir.array<!s8i x 2>> : !cir.array<!s8i x 2>
// CIR: cir.global "private" cir_private dso_local @[[STR2_GLOBAL:.*]] = #cir.zero : !cir.array<!s8i x 1>
// CIR: cir.global "private" cir_private dso_local @[[STR3_GLOBAL:.*]] = #cir.zero : !cir.array<!s8i x 2>

// LLVM: @[[STR1_GLOBAL:.*]] = private global [2 x i8] c"1\00"
// LLVM: @[[STR2_GLOBAL:.*]] = private global [1 x i8] zeroinitializer
Expand Down
2 changes: 1 addition & 1 deletion clang/test/CIR/CodeGen/string-literals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// RUN: %clang_cc1 -triple aarch64-none-linux-android21 -emit-llvm %s -o %t.ll
// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s

// CIR: cir.global "private" cir_private dsolocal @[[STR1_GLOBAL:.*]] = #cir.const_array<"abcd\00" : !cir.array<!s8i x 5>> : !cir.array<!s8i x 5>
// CIR: cir.global "private" cir_private dso_local @[[STR1_GLOBAL:.*]] = #cir.const_array<"abcd\00" : !cir.array<!s8i x 5>> : !cir.array<!s8i x 5>

// LLVM: @[[STR1_GLOBAL:.*]] = private global [5 x i8] c"abcd\00"

Expand Down
2 changes: 1 addition & 1 deletion clang/test/CIR/global-var-linkage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int aaaa;
// OGCG: @dddd = weak_odr global i32 0, comdat

static int bbbb;
// CIR: cir.global "private" internal dsolocal @_ZL4bbbb
// CIR: cir.global "private" internal dso_local @_ZL4bbbb
// LLVM: @_ZL4bbbb = internal global i32 0
// OGCG: @_ZL4bbbb = internal global i32 0

Expand Down
Loading