aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Kaylor <akaylor@nvidia.com>2025-06-24 10:44:15 -0700
committerGitHub <noreply@github.com>2025-06-24 10:44:15 -0700
commit90828e00a09c4e6687d93d1bd6cb24f29e9a8bb5 (patch)
treebac3a17570b19e1431b5da5f6c9b78f44d47908c
parent8f7f48a97ea53161e046eeb52a8020f228d79a00 (diff)
downloadllvm-90828e00a09c4e6687d93d1bd6cb24f29e9a8bb5.zip
llvm-90828e00a09c4e6687d93d1bd6cb24f29e9a8bb5.tar.gz
llvm-90828e00a09c4e6687d93d1bd6cb24f29e9a8bb5.tar.bz2
[CIR] Restore the underscore in dso_local (#145551)
The CIR handling of `dso_local` for globals was upstreamed without the underscore, making it inconsistent with the incubator and LLVM IR. This change restores the underscore.
-rw-r--r--clang/include/clang/CIR/Dialect/IR/CIROps.td4
-rw-r--r--clang/include/clang/CIR/Interfaces/CIROpInterfaces.td4
-rw-r--r--clang/include/clang/CIR/MissingFeatures.h2
-rw-r--r--clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp6
-rw-r--r--clang/test/CIR/CodeGen/builtin_printf.cpp4
-rw-r--r--clang/test/CIR/CodeGen/deferred-defs.cpp2
-rw-r--r--clang/test/CIR/CodeGen/namespace.cpp2
-rw-r--r--clang/test/CIR/CodeGen/static-vars.c12
-rw-r--r--clang/test/CIR/CodeGen/static-vars.cpp12
-rw-r--r--clang/test/CIR/CodeGen/string-literals.c6
-rw-r--r--clang/test/CIR/CodeGen/string-literals.cpp2
-rw-r--r--clang/test/CIR/global-var-linkage.cpp2
12 files changed, 29 insertions, 29 deletions
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index db86845..decba83 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -1610,7 +1610,7 @@ def GlobalOp : CIR_Op<"global",
CIR_GlobalLinkageKind:$linkage,
OptionalAttr<AnyAttr>:$initial_value,
UnitAttr:$comdat,
- UnitAttr:$dsolocal,
+ UnitAttr:$dso_local,
OptionalAttr<I64Attr>:$alignment);
let assemblyFormat = [{
@@ -1618,7 +1618,7 @@ def GlobalOp : CIR_Op<"global",
(`` $global_visibility^)?
$linkage
(`comdat` $comdat^)?
- (`dsolocal` $dsolocal^)?
+ (`dso_local` $dso_local^)?
$sym_name
custom<GlobalOpTypeAndInitialValue>($sym_type, $initial_value)
attr-dict
diff --git a/clang/include/clang/CIR/Interfaces/CIROpInterfaces.td b/clang/include/clang/CIR/Interfaces/CIROpInterfaces.td
index 203e42f..5817b91b 100644
--- a/clang/include/clang/CIR/Interfaces/CIROpInterfaces.td
+++ b/clang/include/clang/CIR/Interfaces/CIROpInterfaces.td
@@ -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<"",
diff --git a/clang/include/clang/CIR/MissingFeatures.h b/clang/include/clang/CIR/MissingFeatures.h
index bf370a9..fb5014a 100644
--- a/clang/include/clang/CIR/MissingFeatures.h
+++ b/clang/include/clang/CIR/MissingFeatures.h
@@ -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; }
diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index 5d95c6e..a870e6c 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -1032,7 +1032,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());
@@ -1119,7 +1119,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);
@@ -1173,7 +1173,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);
diff --git a/clang/test/CIR/CodeGen/builtin_printf.cpp b/clang/test/CIR/CodeGen/builtin_printf.cpp
index 366e474..35c71eb 100644
--- a/clang/test/CIR/CodeGen/builtin_printf.cpp
+++ b/clang/test/CIR/CodeGen/builtin_printf.cpp
@@ -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"
diff --git a/clang/test/CIR/CodeGen/deferred-defs.cpp b/clang/test/CIR/CodeGen/deferred-defs.cpp
index 4230a4e..0b9ff92 100644
--- a/clang/test/CIR/CodeGen/deferred-defs.cpp
+++ b/clang/test/CIR/CodeGen/deferred-defs.cpp
@@ -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
diff --git a/clang/test/CIR/CodeGen/namespace.cpp b/clang/test/CIR/CodeGen/namespace.cpp
index 14490d505..cf02673 100644
--- a/clang/test/CIR/CodeGen/namespace.cpp
+++ b/clang/test/CIR/CodeGen/namespace.cpp
@@ -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()
diff --git a/clang/test/CIR/CodeGen/static-vars.c b/clang/test/CIR/CodeGen/static-vars.c
index f45a41d..ee4db82 100644
--- a/clang/test/CIR/CodeGen/static-vars.c
+++ b/clang/test/CIR/CodeGen/static-vars.c
@@ -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.
@@ -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
}
diff --git a/clang/test/CIR/CodeGen/static-vars.cpp b/clang/test/CIR/CodeGen/static-vars.cpp
index 9b892c6..d949936 100644
--- a/clang/test/CIR/CodeGen/static-vars.cpp
+++ b/clang/test/CIR/CodeGen/static-vars.cpp
@@ -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.
@@ -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
diff --git a/clang/test/CIR/CodeGen/string-literals.c b/clang/test/CIR/CodeGen/string-literals.c
index 90ea219..be9622f 100644
--- a/clang/test/CIR/CodeGen/string-literals.c
+++ b/clang/test/CIR/CodeGen/string-literals.c
@@ -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
diff --git a/clang/test/CIR/CodeGen/string-literals.cpp b/clang/test/CIR/CodeGen/string-literals.cpp
index c56eb74..081c4c2 100644
--- a/clang/test/CIR/CodeGen/string-literals.cpp
+++ b/clang/test/CIR/CodeGen/string-literals.cpp
@@ -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"
diff --git a/clang/test/CIR/global-var-linkage.cpp b/clang/test/CIR/global-var-linkage.cpp
index 3a288b8..c9ee8fb 100644
--- a/clang/test/CIR/global-var-linkage.cpp
+++ b/clang/test/CIR/global-var-linkage.cpp
@@ -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