[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.
This commit is contained in:
parent
8f7f48a97e
commit
90828e00a0
@ -1610,7 +1610,7 @@ def GlobalOp : CIR_Op<"global",
|
|||||||
CIR_GlobalLinkageKind:$linkage,
|
CIR_GlobalLinkageKind:$linkage,
|
||||||
OptionalAttr<AnyAttr>:$initial_value,
|
OptionalAttr<AnyAttr>:$initial_value,
|
||||||
UnitAttr:$comdat,
|
UnitAttr:$comdat,
|
||||||
UnitAttr:$dsolocal,
|
UnitAttr:$dso_local,
|
||||||
OptionalAttr<I64Attr>:$alignment);
|
OptionalAttr<I64Attr>:$alignment);
|
||||||
|
|
||||||
let assemblyFormat = [{
|
let assemblyFormat = [{
|
||||||
@ -1618,7 +1618,7 @@ def GlobalOp : CIR_Op<"global",
|
|||||||
(`` $global_visibility^)?
|
(`` $global_visibility^)?
|
||||||
$linkage
|
$linkage
|
||||||
(`comdat` $comdat^)?
|
(`comdat` $comdat^)?
|
||||||
(`dsolocal` $dsolocal^)?
|
(`dso_local` $dso_local^)?
|
||||||
$sym_name
|
$sym_name
|
||||||
custom<GlobalOpTypeAndInitialValue>($sym_type, $initial_value)
|
custom<GlobalOpTypeAndInitialValue>($sym_type, $initial_value)
|
||||||
attr-dict
|
attr-dict
|
||||||
|
@ -138,13 +138,13 @@ let cppNamespace = "::cir" in {
|
|||||||
InterfaceMethod<"",
|
InterfaceMethod<"",
|
||||||
"void", "setDSOLocal", (ins "bool":$val), [{}],
|
"void", "setDSOLocal", (ins "bool":$val), [{}],
|
||||||
/*defaultImplementation=*/[{
|
/*defaultImplementation=*/[{
|
||||||
$_op.setDsolocal(val);
|
$_op.setDsoLocal(val);
|
||||||
}]
|
}]
|
||||||
>,
|
>,
|
||||||
InterfaceMethod<"",
|
InterfaceMethod<"",
|
||||||
"bool", "isDSOLocal", (ins), [{}],
|
"bool", "isDSOLocal", (ins), [{}],
|
||||||
/*defaultImplementation=*/[{
|
/*defaultImplementation=*/[{
|
||||||
return $_op.getDsolocal();
|
return $_op.getDsoLocal();
|
||||||
}]
|
}]
|
||||||
>,
|
>,
|
||||||
InterfaceMethod<"",
|
InterfaceMethod<"",
|
||||||
|
@ -74,7 +74,7 @@ struct MissingFeatures {
|
|||||||
static bool opFuncOpenCLKernelMetadata() { return false; }
|
static bool opFuncOpenCLKernelMetadata() { return false; }
|
||||||
static bool opFuncCallingConv() { return false; }
|
static bool opFuncCallingConv() { return false; }
|
||||||
static bool opFuncExtraAttrs() { return false; }
|
static bool opFuncExtraAttrs() { return false; }
|
||||||
static bool opFuncDsolocal() { return false; }
|
static bool opFuncDsoLocal() { return false; }
|
||||||
static bool opFuncLinkage() { return false; }
|
static bool opFuncLinkage() { return false; }
|
||||||
static bool opFuncVisibility() { return false; }
|
static bool opFuncVisibility() { return false; }
|
||||||
static bool opFuncNoProto() { return false; }
|
static bool opFuncNoProto() { return false; }
|
||||||
|
@ -1032,7 +1032,7 @@ mlir::LogicalResult CIRToLLVMFuncOpLowering::matchAndRewrite(
|
|||||||
mlir::ConversionPatternRewriter &rewriter) const {
|
mlir::ConversionPatternRewriter &rewriter) const {
|
||||||
|
|
||||||
cir::FuncType fnType = op.getFunctionType();
|
cir::FuncType fnType = op.getFunctionType();
|
||||||
assert(!cir::MissingFeatures::opFuncDsolocal());
|
assert(!cir::MissingFeatures::opFuncDsoLocal());
|
||||||
bool isDsoLocal = false;
|
bool isDsoLocal = false;
|
||||||
mlir::TypeConverter::SignatureConversion signatureConversion(
|
mlir::TypeConverter::SignatureConversion signatureConversion(
|
||||||
fnType.getNumInputs());
|
fnType.getNumInputs());
|
||||||
@ -1119,7 +1119,7 @@ void CIRToLLVMGlobalOpLowering::setupRegionInitializedLLVMGlobalOp(
|
|||||||
const bool isConst = false;
|
const bool isConst = false;
|
||||||
assert(!cir::MissingFeatures::addressSpace());
|
assert(!cir::MissingFeatures::addressSpace());
|
||||||
const unsigned addrSpace = 0;
|
const unsigned addrSpace = 0;
|
||||||
const bool isDsoLocal = op.getDsolocal();
|
const bool isDsoLocal = op.getDsoLocal();
|
||||||
assert(!cir::MissingFeatures::opGlobalThreadLocal());
|
assert(!cir::MissingFeatures::opGlobalThreadLocal());
|
||||||
const bool isThreadLocal = false;
|
const bool isThreadLocal = false;
|
||||||
const uint64_t alignment = op.getAlignment().value_or(0);
|
const uint64_t alignment = op.getAlignment().value_or(0);
|
||||||
@ -1173,7 +1173,7 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite(
|
|||||||
const bool isConst = false;
|
const bool isConst = false;
|
||||||
assert(!cir::MissingFeatures::addressSpace());
|
assert(!cir::MissingFeatures::addressSpace());
|
||||||
const unsigned addrSpace = 0;
|
const unsigned addrSpace = 0;
|
||||||
const bool isDsoLocal = op.getDsolocal();
|
const bool isDsoLocal = op.getDsoLocal();
|
||||||
assert(!cir::MissingFeatures::opGlobalThreadLocal());
|
assert(!cir::MissingFeatures::opGlobalThreadLocal());
|
||||||
const bool isThreadLocal = false;
|
const bool isThreadLocal = false;
|
||||||
const uint64_t alignment = op.getAlignment().value_or(0);
|
const uint64_t alignment = op.getAlignment().value_or(0);
|
||||||
|
@ -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: %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
|
// 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 dso_local @".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.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 = private global [3 x i8] c"%s\00"
|
||||||
// LLVM: @.str.1 = private global [7 x i8] c"%s %d\0A\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"
|
// OGCG: @.str = private unnamed_addr constant [3 x i8] c"%s\00"
|
||||||
|
@ -18,5 +18,5 @@ void use() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CIR: cir.global external @locallyDefined = #cir.int<0> : !s32i
|
// 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
|
// CIR: cir.global "private" external @usedExternal : !s32i
|
||||||
|
@ -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 @_ZN4test2g2E = #cir.int<2> : !s32i
|
||||||
// CHECK-DAG: cir.global external @_ZN4test5test22g3E = #cir.int<3> : !s32i
|
// CHECK-DAG: cir.global external @_ZN4test5test22g3E = #cir.int<3> : !s32i
|
||||||
// CHECK-DAG: cir.func @_ZN12_GLOBAL__N_12f1Ev()
|
// CHECK-DAG: cir.func @_ZN12_GLOBAL__N_12f1Ev()
|
||||||
|
@ -4,20 +4,20 @@
|
|||||||
void func1(void) {
|
void func1(void) {
|
||||||
// Should lower default-initialized static vars.
|
// Should lower default-initialized static vars.
|
||||||
static int i;
|
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.
|
// Should lower constant-initialized static vars.
|
||||||
static int j = 1;
|
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.
|
// Should properly shadow static vars in nested scopes.
|
||||||
{
|
{
|
||||||
static int j = 2;
|
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;
|
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.
|
// Should lower basic static vars arithmetics.
|
||||||
@ -31,7 +31,7 @@ void func1(void) {
|
|||||||
// Should shadow static vars on different functions.
|
// Should shadow static vars on different functions.
|
||||||
void func2(void) {
|
void func2(void) {
|
||||||
static char i;
|
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;
|
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
|
||||||
}
|
}
|
||||||
|
@ -6,20 +6,20 @@
|
|||||||
void func1(void) {
|
void func1(void) {
|
||||||
// Should lower default-initialized static vars.
|
// Should lower default-initialized static vars.
|
||||||
static int i;
|
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.
|
// Should lower constant-initialized static vars.
|
||||||
static int j = 1;
|
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.
|
// Should properly shadow static vars in nested scopes.
|
||||||
{
|
{
|
||||||
static int j = 2;
|
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;
|
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.
|
// Should lower basic static vars arithmetics.
|
||||||
@ -33,9 +33,9 @@ void func1(void) {
|
|||||||
// Should shadow static vars on different functions.
|
// Should shadow static vars on different functions.
|
||||||
void func2(void) {
|
void func2(void) {
|
||||||
static char i;
|
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;
|
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
|
// CHECK-DAG: cir.global linkonce_odr comdat @_ZZ4testvE1c = #cir.int<0> : !s32i
|
||||||
|
@ -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 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 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 dsolocal @[[STR2_GLOBAL:.*]] = #cir.zero : !cir.array<!s8i x 1>
|
// CIR: cir.global "private" cir_private dso_local @[[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 @[[STR3_GLOBAL:.*]] = #cir.zero : !cir.array<!s8i x 2>
|
||||||
|
|
||||||
// LLVM: @[[STR1_GLOBAL:.*]] = private global [2 x i8] c"1\00"
|
// LLVM: @[[STR1_GLOBAL:.*]] = private global [2 x i8] c"1\00"
|
||||||
// LLVM: @[[STR2_GLOBAL:.*]] = private global [1 x i8] zeroinitializer
|
// LLVM: @[[STR2_GLOBAL:.*]] = private global [1 x i8] zeroinitializer
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// RUN: %clang_cc1 -triple aarch64-none-linux-android21 -emit-llvm %s -o %t.ll
|
// RUN: %clang_cc1 -triple aarch64-none-linux-android21 -emit-llvm %s -o %t.ll
|
||||||
// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s
|
// 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"
|
// LLVM: @[[STR1_GLOBAL:.*]] = private global [5 x i8] c"abcd\00"
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ int aaaa;
|
|||||||
// OGCG: @dddd = weak_odr global i32 0, comdat
|
// OGCG: @dddd = weak_odr global i32 0, comdat
|
||||||
|
|
||||||
static int bbbb;
|
static int bbbb;
|
||||||
// CIR: cir.global "private" internal dsolocal @_ZL4bbbb
|
// CIR: cir.global "private" internal dso_local @_ZL4bbbb
|
||||||
// LLVM: @_ZL4bbbb = internal global i32 0
|
// LLVM: @_ZL4bbbb = internal global i32 0
|
||||||
// OGCG: @_ZL4bbbb = internal global i32 0
|
// OGCG: @_ZL4bbbb = internal global i32 0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user