[IR] Disallow llvm.global_ctors and llvm.global_dtors of the 2-field form in textual format

The 3-field form was introduced by D3499 in 2014 and the legacy 2-field
form was planned to be removed in LLVM 4.0

For the textual format, this patch migrates the existing 2-field form to
use the 3-field form and deletes the compatibility code.
test/Verifier/global-ctors-2.ll checks we have a friendly error message.

For bitcode, lib/IR/AutoUpgrade UpgradeGlobalVariables will upgrade the
2-field form (add i8* null as the third field).

Reviewed By: rnk, dexonsmith

Differential Revision: https://reviews.llvm.org/D61547

llvm-svn: 360742
This commit is contained in:
Fangrui Song
2019-05-15 02:35:32 +00:00
parent bd3adfe5e3
commit f4dfd63c74
60 changed files with 146 additions and 177 deletions

View File

@@ -6482,12 +6482,12 @@ The '``llvm.global_ctors``' Global Variable
@llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @ctor, i8* @data }] @llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @ctor, i8* @data }]
The ``@llvm.global_ctors`` array contains a list of constructor The ``@llvm.global_ctors`` array contains a list of constructor
functions, priorities, and an optional associated global or function. functions, priorities, and an associated global or function.
The functions referenced by this array will be called in ascending order The functions referenced by this array will be called in ascending order
of priority (i.e. lowest first) when the module is loaded. The order of of priority (i.e. lowest first) when the module is loaded. The order of
functions with the same priority is not defined. functions with the same priority is not defined.
If the third field is present, non-null, and points to a global variable If the third field is non-null, and points to a global variable
or function, the initializer function will only run if the associated or function, the initializer function will only run if the associated
data from the current module is not discarded. data from the current module is not discarded.
@@ -6502,12 +6502,12 @@ The '``llvm.global_dtors``' Global Variable
@llvm.global_dtors = appending global [1 x %0] [%0 { i32 65535, void ()* @dtor, i8* @data }] @llvm.global_dtors = appending global [1 x %0] [%0 { i32 65535, void ()* @dtor, i8* @data }]
The ``@llvm.global_dtors`` array contains a list of destructor The ``@llvm.global_dtors`` array contains a list of destructor
functions, priorities, and an optional associated global or function. functions, priorities, and an associated global or function.
The functions referenced by this array will be called in descending The functions referenced by this array will be called in descending
order of priority (i.e. highest first) when the module is unloaded. The order of priority (i.e. highest first) when the module is unloaded. The
order of functions with the same priority is not defined. order of functions with the same priority is not defined.
If the third field is present, non-null, and points to a global variable If the third field is non-null, and points to a global variable
or function, the destructor function will only run if the associated or function, the destructor function will only run if the associated
data from the current module is not discarded. data from the current module is not discarded.

View File

@@ -62,6 +62,10 @@ Changes to the LLVM IR
parameter is required to be a simple constant. This annotation must parameter is required to be a simple constant. This annotation must
be accurate to avoid possible miscompiles. be accurate to avoid possible miscompiles.
* The 2-field form of global variables ``@llvm.global_ctors`` and
``@llvm.global_dtors`` has been deleted. The third field of their element
type is now mandatory. Specify `i8* null` to migrate from the obsoleted
2-field form.
Changes to the ARM Backend Changes to the ARM Backend
-------------------------- --------------------------

View File

@@ -46,9 +46,9 @@ namespace llvm {
/// so that it can update all calls to the old function. /// so that it can update all calls to the old function.
void UpgradeCallsToIntrinsic(Function* F); void UpgradeCallsToIntrinsic(Function* F);
/// This checks for global variables which should be upgraded. It returns true /// This checks for global variables which should be upgraded. It it requires
/// if it requires upgrading. /// upgrading, returns a pointer to the upgraded variable.
bool UpgradeGlobalVariable(GlobalVariable *GV); GlobalVariable *UpgradeGlobalVariable(GlobalVariable *GV);
/// This checks for module flags which should be upgraded. It returns true if /// This checks for module flags which should be upgraded. It returns true if
/// module is modified. /// module is modified.

View File

@@ -2794,8 +2794,14 @@ Error BitcodeReader::globalCleanup() {
} }
// Look for global variables which need to be renamed. // Look for global variables which need to be renamed.
std::vector<std::pair<GlobalVariable *, GlobalVariable *>> UpgradedVariables;
for (GlobalVariable &GV : TheModule->globals()) for (GlobalVariable &GV : TheModule->globals())
UpgradeGlobalVariable(&GV); if (GlobalVariable *Upgraded = UpgradeGlobalVariable(&GV))
UpgradedVariables.emplace_back(&GV, Upgraded);
for (auto &Pair : UpgradedVariables) {
Pair.first->eraseFromParent();
TheModule->getGlobalList().push_back(Pair.second);
}
// Force deallocation of memory for these vectors to favor the client that // Force deallocation of memory for these vectors to favor the client that
// want lazy deserialization. // want lazy deserialization.

View File

@@ -1966,7 +1966,7 @@ struct Structor {
/// priority. /// priority.
void AsmPrinter::EmitXXStructorList(const DataLayout &DL, const Constant *List, void AsmPrinter::EmitXXStructorList(const DataLayout &DL, const Constant *List,
bool isCtor) { bool isCtor) {
// Should be an array of '{ int, void ()* }' structs. The first value is the // Should be an array of '{ i32, void ()*, i8* }' structs. The first value is the
// init priority. // init priority.
if (!isa<ConstantArray>(List)) return; if (!isa<ConstantArray>(List)) return;
@@ -1974,12 +1974,10 @@ void AsmPrinter::EmitXXStructorList(const DataLayout &DL, const Constant *List,
const ConstantArray *InitList = dyn_cast<ConstantArray>(List); const ConstantArray *InitList = dyn_cast<ConstantArray>(List);
if (!InitList) return; // Not an array! if (!InitList) return; // Not an array!
StructType *ETy = dyn_cast<StructType>(InitList->getType()->getElementType()); StructType *ETy = dyn_cast<StructType>(InitList->getType()->getElementType());
// FIXME: Only allow the 3-field form in LLVM 4.0. if (!ETy || ETy->getNumElements() != 3 ||
if (!ETy || ETy->getNumElements() < 2 || ETy->getNumElements() > 3) !isa<IntegerType>(ETy->getTypeAtIndex(0U)) ||
return; // Not an array of two or three elements! !isa<PointerType>(ETy->getTypeAtIndex(1U)) ||
if (!isa<IntegerType>(ETy->getTypeAtIndex(0U)) || !isa<PointerType>(ETy->getTypeAtIndex(2U)))
!isa<PointerType>(ETy->getTypeAtIndex(1U))) return; // Not (int, ptr).
if (ETy->getNumElements() == 3 && !isa<PointerType>(ETy->getTypeAtIndex(2U)))
return; // Not (int, ptr, ptr). return; // Not (int, ptr, ptr).
// Gather the structors in a form that's convenient for sorting by priority. // Gather the structors in a form that's convenient for sorting by priority.
@@ -1995,7 +1993,7 @@ void AsmPrinter::EmitXXStructorList(const DataLayout &DL, const Constant *List,
Structor &S = Structors.back(); Structor &S = Structors.back();
S.Priority = Priority->getLimitedValue(65535); S.Priority = Priority->getLimitedValue(65535);
S.Func = CS->getOperand(1); S.Func = CS->getOperand(1);
if (ETy->getNumElements() == 3 && !CS->getOperand(2)->isNullValue()) if (!CS->getOperand(2)->isNullValue())
S.ComdatKey = S.ComdatKey =
dyn_cast<GlobalValue>(CS->getOperand(2)->stripPointerCasts()); dyn_cast<GlobalValue>(CS->getOperand(2)->stripPointerCasts());
} }

View File

@@ -805,9 +805,35 @@ bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn) {
return Upgraded; return Upgraded;
} }
bool llvm::UpgradeGlobalVariable(GlobalVariable *GV) { GlobalVariable *llvm::UpgradeGlobalVariable(GlobalVariable *GV) {
// Nothing to do yet. if (!(GV->hasName() && (GV->getName() == "llvm.global_ctors" ||
return false; GV->getName() == "llvm.global_dtors")) ||
!GV->hasInitializer())
return nullptr;
ArrayType *ATy = dyn_cast<ArrayType>(GV->getValueType());
if (!ATy)
return nullptr;
StructType *STy = dyn_cast<StructType>(ATy->getElementType());
if (!STy || STy->getNumElements() != 2)
return nullptr;
LLVMContext &C = GV->getContext();
IRBuilder<> IRB(C);
auto EltTy = StructType::get(STy->getElementType(0), STy->getElementType(1),
IRB.getInt8PtrTy());
Constant *Init = GV->getInitializer();
unsigned N = Init->getNumOperands();
std::vector<Constant *> NewCtors(N);
for (unsigned i = 0; i != N; ++i) {
auto Ctor = cast<Constant>(Init->getOperand(i));
NewCtors[i] = ConstantStruct::get(
EltTy, Ctor->getAggregateElement(0u), Ctor->getAggregateElement(1),
Constant::getNullValue(IRB.getInt8PtrTy()));
}
Constant *NewInit = ConstantArray::get(ArrayType::get(EltTy, N), NewCtors);
return new GlobalVariable(NewInit->getType(), false, GV->getLinkage(),
NewInit, GV->getName());
} }
// Handles upgrading SSE2/AVX2/AVX512BW PSLLDQ intrinsics by converting them // Handles upgrading SSE2/AVX2/AVX512BW PSLLDQ intrinsics by converting them

View File

@@ -641,18 +641,18 @@ void Verifier::visitGlobalVariable(const GlobalVariable &GV) {
PointerType *FuncPtrTy = PointerType *FuncPtrTy =
FunctionType::get(Type::getVoidTy(Context), false)-> FunctionType::get(Type::getVoidTy(Context), false)->
getPointerTo(DL.getProgramAddressSpace()); getPointerTo(DL.getProgramAddressSpace());
// FIXME: Reject the 2-field form in LLVM 4.0.
Assert(STy && Assert(STy &&
(STy->getNumElements() == 2 || STy->getNumElements() == 3) && (STy->getNumElements() == 2 || STy->getNumElements() == 3) &&
STy->getTypeAtIndex(0u)->isIntegerTy(32) && STy->getTypeAtIndex(0u)->isIntegerTy(32) &&
STy->getTypeAtIndex(1) == FuncPtrTy, STy->getTypeAtIndex(1) == FuncPtrTy,
"wrong type for intrinsic global variable", &GV); "wrong type for intrinsic global variable", &GV);
if (STy->getNumElements() == 3) { Assert(STy->getNumElements() == 3,
Type *ETy = STy->getTypeAtIndex(2); "the third field of the element type is mandatory, "
Assert(ETy->isPointerTy() && "specify i8* null to migrate from the obsoleted 2-field form");
cast<PointerType>(ETy)->getElementType()->isIntegerTy(8), Type *ETy = STy->getTypeAtIndex(2);
"wrong type for intrinsic global variable", &GV); Assert(ETy->isPointerTy() &&
} cast<PointerType>(ETy)->getElementType()->isIntegerTy(8),
"wrong type for intrinsic global variable", &GV);
} }
} }

View File

@@ -27,44 +27,24 @@ static void appendToGlobalArray(const char *Array, Module &M, Function *F,
// Get the current set of static global constructors and add the new ctor // Get the current set of static global constructors and add the new ctor
// to the list. // to the list.
SmallVector<Constant *, 16> CurrentCtors; SmallVector<Constant *, 16> CurrentCtors;
StructType *EltTy; StructType *EltTy = StructType::get(
IRB.getInt32Ty(), PointerType::getUnqual(FnTy), IRB.getInt8PtrTy());
if (GlobalVariable *GVCtor = M.getNamedGlobal(Array)) { if (GlobalVariable *GVCtor = M.getNamedGlobal(Array)) {
ArrayType *ATy = cast<ArrayType>(GVCtor->getValueType());
StructType *OldEltTy = cast<StructType>(ATy->getElementType());
// Upgrade a 2-field global array type to the new 3-field format if needed.
if (Data && OldEltTy->getNumElements() < 3)
EltTy = StructType::get(IRB.getInt32Ty(), PointerType::getUnqual(FnTy),
IRB.getInt8PtrTy());
else
EltTy = OldEltTy;
if (Constant *Init = GVCtor->getInitializer()) { if (Constant *Init = GVCtor->getInitializer()) {
unsigned n = Init->getNumOperands(); unsigned n = Init->getNumOperands();
CurrentCtors.reserve(n + 1); CurrentCtors.reserve(n + 1);
for (unsigned i = 0; i != n; ++i) { for (unsigned i = 0; i != n; ++i)
auto Ctor = cast<Constant>(Init->getOperand(i)); CurrentCtors.push_back(cast<Constant>(Init->getOperand(i)));
if (EltTy != OldEltTy)
Ctor =
ConstantStruct::get(EltTy, Ctor->getAggregateElement((unsigned)0),
Ctor->getAggregateElement(1),
Constant::getNullValue(IRB.getInt8PtrTy()));
CurrentCtors.push_back(Ctor);
}
} }
GVCtor->eraseFromParent(); GVCtor->eraseFromParent();
} else {
// Use the new three-field struct if there isn't one already.
EltTy = StructType::get(IRB.getInt32Ty(), PointerType::getUnqual(FnTy),
IRB.getInt8PtrTy());
} }
// Build a 2 or 3 field global_ctor entry. We don't take a comdat key. // Build a 3 field global_ctor entry. We don't take a comdat key.
Constant *CSVals[3]; Constant *CSVals[3];
CSVals[0] = IRB.getInt32(Priority); CSVals[0] = IRB.getInt32(Priority);
CSVals[1] = F; CSVals[1] = F;
// FIXME: Drop support for the two element form in LLVM 4.0. CSVals[2] = Data ? ConstantExpr::getPointerCast(Data, IRB.getInt8PtrTy())
if (EltTy->getNumElements() >= 3) : Constant::getNullValue(IRB.getInt8PtrTy());
CSVals[2] = Data ? ConstantExpr::getPointerCast(Data, IRB.getInt8PtrTy())
: Constant::getNullValue(IRB.getInt8PtrTy());
Constant *RuntimeCtorInit = Constant *RuntimeCtorInit =
ConstantStruct::get(EltTy, makeArrayRef(CSVals, EltTy->getNumElements())); ConstantStruct::get(EltTy, makeArrayRef(CSVals, EltTy->getNumElements()));

View File

@@ -2,7 +2,7 @@
; RUN: verify-uselistorder < %s ; RUN: verify-uselistorder < %s
%0 = type { %object.ModuleInfo.__vtbl*, i8*, %"byte[]", %1, %"ClassInfo[]", i32, void ()*, void ()*, void ()*, i8*, void ()* } ; type %0 %0 = type { %object.ModuleInfo.__vtbl*, i8*, %"byte[]", %1, %"ClassInfo[]", i32, void ()*, void ()*, void ()*, i8*, void ()* } ; type %0
%1 = type { i64, %object.ModuleInfo* } ; type %1 %1 = type { i64, %object.ModuleInfo* } ; type %1
%2 = type { i32, void ()* } ; type %2 %2 = type { i32, void ()*, i8* } ; type %2
%"ClassInfo[]" = type { i64, %object.ClassInfo** } %"ClassInfo[]" = type { i64, %object.ClassInfo** }
%"Interface[]" = type { i64, %object.Interface* } %"Interface[]" = type { i64, %object.Interface* }
%"ModuleInfo[]" = type { i64, %object.ModuleInfo** } %"ModuleInfo[]" = type { i64, %object.ModuleInfo** }
@@ -24,7 +24,7 @@
@_D5tango4core8BitManip8__ModuleZ = global %0 { %object.ModuleInfo.__vtbl* @_D10ModuleInfo6__vtblZ, i8* null, %"byte[]" { i64 19, i8* getelementptr ([20 x i8], [20 x i8]* @.str, i32 0, i32 0) }, %1 zeroinitializer, %"ClassInfo[]" zeroinitializer, i32 4, void ()* null, void ()* null, void ()* null, i8* null, void ()* null } ; <%0*> [#uses=1] @_D5tango4core8BitManip8__ModuleZ = global %0 { %object.ModuleInfo.__vtbl* @_D10ModuleInfo6__vtblZ, i8* null, %"byte[]" { i64 19, i8* getelementptr ([20 x i8], [20 x i8]* @.str, i32 0, i32 0) }, %1 zeroinitializer, %"ClassInfo[]" zeroinitializer, i32 4, void ()* null, void ()* null, void ()* null, i8* null, void ()* null } ; <%0*> [#uses=1]
@_D5tango4core8BitManip11__moduleRefZ = internal global %ModuleReference { %ModuleReference* null, %object.ModuleInfo* bitcast (%0* @_D5tango4core8BitManip8__ModuleZ to %object.ModuleInfo*) } ; <%ModuleReference*> [#uses=2] @_D5tango4core8BitManip11__moduleRefZ = internal global %ModuleReference { %ModuleReference* null, %object.ModuleInfo* bitcast (%0* @_D5tango4core8BitManip8__ModuleZ to %object.ModuleInfo*) } ; <%ModuleReference*> [#uses=2]
@_Dmodule_ref = external global %ModuleReference* ; <%ModuleReference**> [#uses=2] @_Dmodule_ref = external global %ModuleReference* ; <%ModuleReference**> [#uses=2]
@llvm.global_ctors = appending constant [1 x %2] [%2 { i32 65535, void ()* @_D5tango4core8BitManip16__moduleinfoCtorZ }] ; <[1 x %2]*> [#uses=0] @llvm.global_ctors = appending constant [1 x %2] [%2 { i32 65535, void ()* @_D5tango4core8BitManip16__moduleinfoCtorZ, i8* null }] ; <[1 x %2]*> [#uses=0]
define fastcc i32 @_D5tango4core8BitManip6popcntFkZi(i32 %x_arg) nounwind readnone { define fastcc i32 @_D5tango4core8BitManip6popcntFkZi(i32 %x_arg) nounwind readnone {
entry: entry:

View File

@@ -1,5 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s ; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: verify-uselistorder < %s.bc ; RUN: verify-uselistorder < %s.bc
; Global constructors should no longer be upgraded when reading bitcode. ; The 2-field form @llvm.global_ctors will be upgraded when reading bitcode.
; CHECK: @llvm.global_ctors = appending global [0 x { i32, void ()* }] zeroinitializer ; CHECK: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer

View File

@@ -0,0 +1,5 @@
; RUN: llvm-dis < %s.bc | FileCheck %s
; RUN: verify-uselistorder < %s.bc
; The 2-field form @llvm.global_dtors will be upgraded when reading bitcode.
; CHECK: @llvm.global_dtors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* null, i8* null }, { i32, void ()*, i8* } { i32 65534, void ()* null, i8* null }]

Binary file not shown.

View File

@@ -5,6 +5,6 @@ define internal void @_GLOBAL__I_a() section ".text.startup" {
ret void ret void
} }
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }]
; CHECK: .section .init_array ; CHECK: .section .init_array

View File

@@ -21,7 +21,7 @@
; GNUEABI: .long f152 ; GNUEABI: .long f152
@llvm.global_ctors = appending global [2 x { i32, void ()* }] [ { i32, void ()* } { i32 151, void ()* @f151 }, { i32, void ()* } { i32 152, void ()* @f152 } ] @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [ { i32, void ()*, i8* } { i32 151, void ()* @f151, i8* null }, { i32, void ()*, i8* } { i32 152, void ()* @f152, i8* null } ]
define void @f151() { define void @f151() {
entry: entry:

View File

@@ -11,8 +11,8 @@
; GNUEABI: .section .init_array,"aw",%init_array ; GNUEABI: .section .init_array,"aw",%init_array
; GNUEABI: .section .fini_array,"aw",%fini_array ; GNUEABI: .section .fini_array,"aw",%fini_array
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @__mf_init } ] ; <[1 x { i32, void ()* }]*> [#uses=0] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [ { i32, void ()*, i8* } { i32 65535, void ()* @__mf_init, i8* null } ] ; <[1 x { i32, void ()*, i8* }]*> [#uses=0]
@llvm.global_dtors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @__mf_fini } ] ; <[1 x { i32, void ()* }]*> [#uses=0] @llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [ { i32, void ()*, i8* } { i32 65535, void ()* @__mf_fini, i8* null } ] ; <[1 x { i32, void ()*, i8* }]*> [#uses=0]
define void @__mf_init() { define void @__mf_init() {
entry: entry:

View File

@@ -2,7 +2,7 @@
target triple = "mipsel-unknown-linux" target triple = "mipsel-unknown-linux"
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @test }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @test, i8* null }]
; CHECK: .section ; CHECK: .section
; CHECK: .init_array ; CHECK: .init_array
; CHECK-NOT: .ctors ; CHECK-NOT: .ctors

View File

@@ -10,7 +10,7 @@ target triple = "powerpc64-unknown-linux-gnu"
%struct.CS = type { i32 } %struct.CS = type { i32 }
@_ZL3glb = internal global [1 x %struct.CS] zeroinitializer, align 4 @_ZL3glb = internal global [1 x %struct.CS] zeroinitializer, align 4
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }]
define internal void @__cxx_global_var_init() section ".text.startup" { define internal void @__cxx_global_var_init() section ".text.startup" {
entry: entry:

View File

@@ -20,7 +20,7 @@ define internal void @_GLOBAL__I_a() section ".text.startup" {
ret void ret void
} }
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }]
;INITARRAY: section .init_array ;INITARRAY: section .init_array
;INITARRAY-NOT: .section .ctors ;INITARRAY-NOT: .section .ctors

View File

@@ -2,7 +2,7 @@
; PR 1557 ; PR 1557
target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f128:128:128" target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f128:128:128"
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @set_fast_math } ] ; <[1 x { i32, void ()* }]*> [#uses=0] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [ { i32, void ()*, i8* } { i32 65535, void ()* @set_fast_math, i8* null } ] ; <[1 x { i32, void ()*, i8* }]*> [#uses=0]
define internal void @set_fast_math() nounwind { define internal void @set_fast_math() nounwind {
entry: entry:

View File

@@ -3,7 +3,7 @@
%struct.A = type { [1024 x i8] } %struct.A = type { [1024 x i8] }
@_ZN1A1aE = global %struct.A zeroinitializer, align 32 ; <%struct.A*> [#uses=1] @_ZN1A1aE = global %struct.A zeroinitializer, align 32 ; <%struct.A*> [#uses=1]
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN1A1aE } ] ; <[1 x { i32, void ()* }]*> [#uses=0] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [ { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN1A1aE, i8* null } ] ; <[1 x { i32, void ()*, i8* null }]*> [#uses=0]
define internal void @_GLOBAL__I__ZN1A1aE() section "__TEXT,__StaticInit,regular,pure_instructions" { define internal void @_GLOBAL__I__ZN1A1aE() section "__TEXT,__StaticInit,regular,pure_instructions" {
entry: entry:

View File

@@ -2,7 +2,7 @@
; RUN: llc < %s -mtriple=i386-apple-darwin | FileCheck %s --check-prefix=CHECK-DARWIN ; RUN: llc < %s -mtriple=i386-apple-darwin | FileCheck %s --check-prefix=CHECK-DARWIN
; PR5329 ; PR5329
@llvm.global_ctors = appending global [3 x { i32, void ()* }] [{ i32, void ()* } { i32 2000, void ()* @construct_2 }, { i32, void ()* } { i32 3000, void ()* @construct_3 }, { i32, void ()* } { i32 1000, void ()* @construct_1 }] @llvm.global_ctors = appending global [3 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 2000, void ()* @construct_2, i8* null }, { i32, void ()*, i8* } { i32 3000, void ()* @construct_3, i8* null }, { i32, void ()*, i8* } { i32 1000, void ()* @construct_1, i8* null }]
; CHECK-DEFAULT: .section .ctors.64535,"aw",@progbits ; CHECK-DEFAULT: .section .ctors.64535,"aw",@progbits
; CHECK-DEFAULT: .long construct_1 ; CHECK-DEFAULT: .long construct_1
; CHECK-DEFAULT: .section .ctors.63535,"aw",@progbits ; CHECK-DEFAULT: .section .ctors.63535,"aw",@progbits
@@ -14,7 +14,7 @@
; CHECK-DARWIN-NEXT: .long _construct_2 ; CHECK-DARWIN-NEXT: .long _construct_2
; CHECK-DARWIN-NEXT: .long _construct_3 ; CHECK-DARWIN-NEXT: .long _construct_3
@llvm.global_dtors = appending global [3 x { i32, void ()* }] [{ i32, void ()* } { i32 2000, void ()* @destruct_2 }, { i32, void ()* } { i32 1000, void ()* @destruct_1 }, { i32, void ()* } { i32 3000, void ()* @destruct_3 }] @llvm.global_dtors = appending global [3 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 2000, void ()* @destruct_2, i8* null }, { i32, void ()*, i8* } { i32 1000, void ()* @destruct_1, i8* null }, { i32, void ()*, i8* } { i32 3000, void ()* @destruct_3, i8* null }]
; CHECK-DEFAULT: .section .dtors.64535,"aw",@progbits ; CHECK-DEFAULT: .section .dtors.64535,"aw",@progbits
; CHECK-DEFAULT: .long destruct_1 ; CHECK-DEFAULT: .long destruct_1
; CHECK-DEFAULT: .section .dtors.63535,"aw",@progbits ; CHECK-DEFAULT: .section .dtors.63535,"aw",@progbits

View File

@@ -16,7 +16,7 @@
@c1 = global %class.C zeroinitializer, align 1 @c1 = global %class.C zeroinitializer, align 1
@d1 = global %class.D zeroinitializer, align 1 @d1 = global %class.D zeroinitializer, align 1
@llvm.global_ctors = appending global [2 x { i32, void ()* }] [{ i32, void ()* } { i32 101, void ()* @_GLOBAL__I_000101 }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 101, void ()* @_GLOBAL__I_000101, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }]
define linkonce_odr void @_ZN1CC1Ev(%class.C* nocapture %this) { define linkonce_odr void @_ZN1CC1Ev(%class.C* nocapture %this) {
entry: entry:

View File

@@ -188,7 +188,6 @@ target triple = "i386-apple-darwin7"
@"\01LC28" = external constant [15 x i8] ; <[15 x i8]*> [#uses=0] @"\01LC28" = external constant [15 x i8] ; <[15 x i8]*> [#uses=0]
@"\01LC29" = external constant [20 x i8] ; <[20 x i8]*> [#uses=0] @"\01LC29" = external constant [20 x i8] ; <[20 x i8]*> [#uses=0]
@"\01LC30" = external constant [41 x i8] ; <[41 x i8]*> [#uses=0] @"\01LC30" = external constant [41 x i8] ; <[41 x i8]*> [#uses=0]
@llvm.global_ctors = external global [1 x { i32, void ()* }] ; <[1 x { i32, void ()* }]*> [#uses=0]
declare void @_GLOBAL__I__ZN9HingeNode7DEG2RADE() section "__TEXT,__StaticInit,regular,pure_instructions" declare void @_GLOBAL__I__ZN9HingeNode7DEG2RADE() section "__TEXT,__StaticInit,regular,pure_instructions"

View File

@@ -21,7 +21,7 @@
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32" target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-win32" target triple = "i686-pc-win32"
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 1, void ()* @asan.module_ctor }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 1, void ()* @asan.module_ctor, i8* null }]
; Function Attrs: nounwind sanitize_address ; Function Attrs: nounwind sanitize_address
define i32 @foo() #0 !dbg !4 { define i32 @foo() #0 !dbg !4 {

View File

@@ -14,11 +14,11 @@ target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-win32" target triple = "i686-pc-win32"
@c = global { i8, [63 x i8] } { i8 42, [63 x i8] zeroinitializer }, align 32 @c = global { i8, [63 x i8] } { i8 42, [63 x i8] zeroinitializer }, align 32
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 1, void ()* @asan.module_ctor }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 1, void ()* @asan.module_ctor, i8* null }]
@___asan_gen_ = private constant [7 x i8] c"asan.c\00", align 1 @___asan_gen_ = private constant [7 x i8] c"asan.c\00", align 1
@___asan_gen_1 = private unnamed_addr constant [2 x i8] c"c\00", align 1 @___asan_gen_1 = private unnamed_addr constant [2 x i8] c"c\00", align 1
@0 = internal global [1 x { i32, i32, i32, i32, i32, i32 }] [{ i32, i32, i32, i32, i32, i32 } { i32 ptrtoint ({ i8, [63 x i8] }* @c to i32), i32 1, i32 64, i32 ptrtoint ([2 x i8]* @___asan_gen_1 to i32), i32 ptrtoint ([7 x i8]* @___asan_gen_ to i32), i32 0 }] @0 = internal global [1 x { i32, i32, i32, i32, i32, i32 }] [{ i32, i32, i32, i32, i32, i32 } { i32 ptrtoint ({ i8, [63 x i8] }* @c to i32), i32 1, i32 64, i32 ptrtoint ([2 x i8]* @___asan_gen_1 to i32), i32 ptrtoint ([7 x i8]* @___asan_gen_ to i32), i32 0 }]
@llvm.global_dtors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 1, void ()* @asan.module_dtor }] @llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 1, void ()* @asan.module_dtor, i8* null }]
define internal void @asan.module_ctor() { define internal void @asan.module_ctor() {
call void @__asan_init_v3() call void @__asan_init_v3()

View File

@@ -52,7 +52,7 @@
%struct.B = type { i32 } %struct.B = type { i32 }
%struct.A = type { i8 } %struct.A = type { i8 }
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 1, void ()* @asan.module_ctor }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 1, void ()* @asan.module_ctor, i8* null }]
@__asan_option_detect_stack_use_after_return = external global i32 @__asan_option_detect_stack_use_after_return = external global i32
@___asan_gen_ = private unnamed_addr constant [11 x i8] c"1 32 8 1 A\00", align 1 @___asan_gen_ = private unnamed_addr constant [11 x i8] c"1 32 8 1 A\00", align 1
@___asan_gen_1 = private unnamed_addr constant [13 x i8] c"1 32 1 3 tmp\00", align 1 @___asan_gen_1 = private unnamed_addr constant [13 x i8] c"1 32 1 3 tmp\00", align 1

View File

@@ -23,7 +23,7 @@ source_filename = "test/DebugInfo/X86/cu-ranges-odr.ll"
%class.A = type { i32 } %class.A = type { i32 }
@a = global %class.A zeroinitializer, align 4, !dbg !0 @a = global %class.A zeroinitializer, align 4, !dbg !0
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }]
define internal void @__cxx_global_var_init() section ".text.startup" !dbg !18 { define internal void @__cxx_global_var_init() section ".text.startup" !dbg !18 {
entry: entry:

View File

@@ -19,7 +19,7 @@ target triple = "x86_64-unknown-linux-gnu"
@__asan_mapping_offset = linkonce_odr constant i64 2147450880 @__asan_mapping_offset = linkonce_odr constant i64 2147450880
@__asan_mapping_scale = linkonce_odr constant i64 3 @__asan_mapping_scale = linkonce_odr constant i64 3
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 1, void ()* @asan.module_ctor }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 1, void ()* @asan.module_ctor, i8* null }]
@___asan_gen_ = private unnamed_addr constant [16 x i8] c"1 32 4 5 .addr \00", align 1 @___asan_gen_ = private unnamed_addr constant [16 x i8] c"1 32 4 5 .addr \00", align 1
; Function Attrs: sanitize_address uwtable ; Function Attrs: sanitize_address uwtable

View File

@@ -6,7 +6,7 @@
; low_pc for the compile unit. ; low_pc for the compile unit.
; CHECK-NOT: .rela.debug_ranges ; CHECK-NOT: .rela.debug_ranges
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 0, void ()* @__msan_init }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__msan_init, i8* null }]
@str = private unnamed_addr constant [4 x i8] c"zzz\00" @str = private unnamed_addr constant [4 x i8] c"zzz\00"
@__msan_retval_tls = external thread_local(initialexec) global [8 x i64] @__msan_retval_tls = external thread_local(initialexec) global [8 x i64]
@__msan_retval_origin_tls = external thread_local(initialexec) global i32 @__msan_retval_origin_tls = external thread_local(initialexec) global i32

View File

@@ -181,7 +181,7 @@ source_filename = "test/DebugInfo/X86/generate-odr-hash.ll"
@_ZN7echidna8capybara8mongoose6animalE = global %"class.echidna::capybara::mongoose::fluffy" zeroinitializer, align 4, !dbg !6 @_ZN7echidna8capybara8mongoose6animalE = global %"class.echidna::capybara::mongoose::fluffy" zeroinitializer, align 4, !dbg !6
@w = internal global %"struct.<anonymous namespace>::walrus" zeroinitializer, align 1, !dbg !16 @w = internal global %"struct.<anonymous namespace>::walrus" zeroinitializer, align 1, !dbg !16
@wom = global %struct.wombat zeroinitializer, align 4, !dbg !25 @wom = global %struct.wombat zeroinitializer, align 4, !dbg !25
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }]
; Function Attrs: nounwind uwtable ; Function Attrs: nounwind uwtable
define void @_Z3foov() #0 !dbg !40 { define void @_Z3foov() #0 !dbg !40 {

View File

@@ -3,8 +3,8 @@
@G1 = global i32 zeroinitializer @G1 = global i32 zeroinitializer
@G2 = global i32 zeroinitializer @G2 = global i32 zeroinitializer
@g = global <2 x i32*> zeroinitializer @g = global <2 x i32*> zeroinitializer
%0 = type { i32, void ()* } %0 = type { i32, void ()*, i8* }
@llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @test }] @llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @test, i8* null }]
define internal void @test() { define internal void @test() {
%A = insertelement <2 x i32*> undef, i32* @G1, i32 0 %A = insertelement <2 x i32*> undef, i32* @G1, i32 0
%B = insertelement <2 x i32*> %A, i32* @G2, i32 1 %B = insertelement <2 x i32*> %A, i32* @G2, i32 1

View File

@@ -26,7 +26,7 @@ entry:
ret void ret void
} }
@llvm.global_ctors = appending global [2 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @__late_ctor }, { i32, void ()* } { i32 0, void ()* @__early_ctor }] @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__late_ctor, i8* null }, { i32, void ()*, i8* } { i32 0, void ()* @__early_ctor, i8* null }]
define internal void @__late_ctor() sanitize_address section ".text.startup" { define internal void @__late_ctor() sanitize_address section ".text.startup" {
entry: entry:

View File

@@ -1,18 +0,0 @@
; MSan converts 2-element global_ctors to 3-element when adding the new entry.
; RUN: opt < %s -msan-with-comdat -S -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -msan-with-comdat -S | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; CHECK: $msan.module_ctor = comdat any
; CHECK: @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* null }, { i32, void ()*, i8* } { i32 0, void ()* @msan.module_ctor, i8* bitcast (void ()* @msan.module_ctor to i8*) }]
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @f }]
define internal void @f() {
entry:
ret void
}
; CHECK: define internal void @msan.module_ctor() comdat {

View File

@@ -1,8 +0,0 @@
; RUN: llvm-link -S %s | FileCheck %s
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @f }]
; CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* null }]
define void @f() {
ret void
}

View File

@@ -1,29 +0,0 @@
; RUN: llvm-link -S %s %S/Inputs/old_global_ctors.3.4.bc | FileCheck %s
; RUN: llvm-link -S %S/Inputs/old_global_ctors.3.4.bc %s | FileCheck %s
; old_global_ctors.3.4.bc contains the following LLVM IL, assembled into
; bitcode by llvm-as from 3.4. It uses a two element @llvm.global_ctors array.
; ---
; declare void @a_global_ctor()
; declare void @b_global_ctor()
;
; @llvm.global_ctors = appending global [2 x { i32, void ()* } ] [
; { i32, void ()* } { i32 65535, void ()* @a_global_ctor },
; { i32, void ()* } { i32 65535, void ()* @b_global_ctor }
; ]
; ---
declare void @c_global_ctor()
declare void @d_global_ctor()
@llvm.global_ctors = appending global [2 x { i32, void ()*, i8* } ] [
{ i32, void ()*, i8* } { i32 65535, void ()* @c_global_ctor, i8* null },
{ i32, void ()*, i8* } { i32 65535, void ()* @d_global_ctor, i8* null }
]
; CHECK: @llvm.global_ctors = appending global [4 x { i32, void ()*, i8* }] [
; CHECK-DAG: { i32, void ()*, i8* } { i32 65535, void ()* @a_global_ctor, i8* null }
; CHECK-DAG: { i32, void ()*, i8* } { i32 65535, void ()* @b_global_ctor, i8* null }
; CHECK-DAG: { i32, void ()*, i8* } { i32 65535, void ()* @c_global_ctor, i8* null }
; CHECK-DAG: { i32, void ()*, i8* } { i32 65535, void ()* @d_global_ctor, i8* null }
; CHECK: ]

View File

@@ -2,7 +2,7 @@
; RUN: -filetype=obj -o - | llvm-readobj -r | FileCheck %s ; RUN: -filetype=obj -o - | llvm-readobj -r | FileCheck %s
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @f }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* null }]
define void @f() { define void @f() {
ret void ret void

View File

@@ -1,12 +1,12 @@
; RUN: opt -S -globaldce < %s | FileCheck %s ; RUN: opt -S -globaldce < %s | FileCheck %s
; Test that the presence of debug intrinsics isn't affecting GlobalDCE. ; Test that the presence of debug intrinsics isn't affecting GlobalDCE.
; CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_notremovable }] ; CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_notremovable, i8* null }]
; CHECK-NOT: @_GLOBAL__I_a ; CHECK-NOT: @_GLOBAL__I_a
declare void @_notremovable() declare void @_notremovable()
@llvm.global_ctors = appending global [3 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_b }, { i32, void ()* } { i32 65535, void ()* @_notremovable }] @llvm.global_ctors = appending global [3 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_b, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_notremovable, i8* null }]
@x = internal unnamed_addr constant i8 undef, align 1 @x = internal unnamed_addr constant i8 undef, align 1

View File

@@ -9,7 +9,7 @@
@foo = global %class.Foo zeroinitializer, align 4 @foo = global %class.Foo zeroinitializer, align 4
@_ZN3Bar18LINKER_INITIALIZEDE = external constant i32 @_ZN3Bar18LINKER_INITIALIZEDE = external constant i32
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }]
define internal void @__cxx_global_var_init() section "__TEXT,__StaticInit,regular,pure_instructions" { define internal void @__cxx_global_var_init() section "__TEXT,__StaticInit,regular,pure_instructions" {
%1 = load i32, i32* @_ZN3Bar18LINKER_INITIALIZEDE, align 4 %1 = load i32, i32* @_ZN3Bar18LINKER_INITIALIZEDE, align 4

View File

@@ -16,7 +16,7 @@ target triple = "i686-pc-linux-gnu"
%"struct.std::vector<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >" } %"struct.std::vector<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >" }
@registry_lock = external global %struct..0FileDescriptor ; <%struct..0FileDescriptor*> [#uses=0] @registry_lock = external global %struct..0FileDescriptor ; <%struct..0FileDescriptor*> [#uses=0]
@_ZN61FLAG__foo_int32_44FLAGS_E = external global %"struct.FlagRegisterer<bool>" ; <%"struct.FlagRegisterer<bool>"*> [#uses=0] @_ZN61FLAG__foo_int32_44FLAGS_E = external global %"struct.FlagRegisterer<bool>" ; <%"struct.FlagRegisterer<bool>"*> [#uses=0]
@llvm.global_ctors = appending global [20 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_10FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN60FLAG__foo_bool_19FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZNK5Bzh4Enum13is_contiguousEv }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_21FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN7ScannerC2Ev }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__Z11StripStringPSsPKcc }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZNK9__gnu_cxx4hashI11StringPieceEclERKS1_ }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN8Hasher325ResetEj }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__Z25ACLRv }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int64_25FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_7FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_18FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_25FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_eventbuf }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_26FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_16FLAGS_E }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__ZN17InitializerC2EPKcS1_PFvvE }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__checker_bcad_variable } ] ; <[20 x { i32, void ()* }]*> [#uses=0] @llvm.global_ctors = appending global [20 x { i32, void ()*, i8* }] [ { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_10FLAGS_E, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN60FLAG__foo_bool_19FLAGS_E, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZNK5Bzh4Enum13is_contiguousEv, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_21FLAGS_E, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN7ScannerC2Ev, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__Z11StripStringPSsPKcc, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZNK9__gnu_cxx4hashI11StringPieceEclERKS1_, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN8Hasher325ResetEj, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__Z25ACLRv, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int64_25FLAGS_E, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_7FLAGS_E, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_18FLAGS_E, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_25FLAGS_E, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_eventbuf, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN61FLAG__foo_int32_26FLAGS_E, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN62FLAG__foo_string_16FLAGS_E, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__ZN17InitializerC2EPKcS1_PFvvE, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__checker_bcad_variable, i8* null } ] ; <[20 x { i32, void ()*, i8* }]*> [#uses=0]
declare void @_GLOBAL__I__ZN62FLAG__foo_string_10FLAGS_E() declare void @_GLOBAL__I__ZN62FLAG__foo_string_10FLAGS_E()

View File

@@ -9,8 +9,8 @@ target triple = "i686-pc-linux-gnu"
%"struct.std::_Rb_tree_node_base" = type { i32, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"* } %"struct.std::_Rb_tree_node_base" = type { i32, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"*, %"struct.std::_Rb_tree_node_base"* }
%"struct.std::map<int,int,std::less<int>,std::allocator<std::pair<const int, int> > >" = type { %"struct.std::_Rb_tree<int,std::pair<const int, int>,std::_Select1st<std::pair<const int, int> >,std::less<int>,std::allocator<std::pair<const int, int> > >" } %"struct.std::map<int,int,std::less<int>,std::allocator<std::pair<const int, int> > >" = type { %"struct.std::_Rb_tree<int,std::pair<const int, int>,std::_Select1st<std::pair<const int, int> >,std::less<int>,std::allocator<std::pair<const int, int> > >" }
@someMap = global %"struct.std::map<int,int,std::less<int>,std::allocator<std::pair<const int, int> > >" zeroinitializer ; <%"struct.std::map<int,int,std::less<int>,std::allocator<std::pair<const int, int> > >"*> [#uses=1] @someMap = global %"struct.std::map<int,int,std::less<int>,std::allocator<std::pair<const int, int> > >" zeroinitializer ; <%"struct.std::map<int,int,std::less<int>,std::allocator<std::pair<const int, int> > >"*> [#uses=1]
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_someMap } ] ; <[1 x { i32, void ()* }]*> [#uses=0] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [ { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_someMap, i8* null } ] ; <[1 x { i32, void ()*, i8* }]*> [#uses=0]
@llvm.global_dtors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__D_someMap } ] ; <[1 x { i32, void ()* }]*> [#uses=0] @llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [ { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__D_someMap, i8* null } ] ; <[1 x { i32, void ()*, i8* }]*> [#uses=0]
define void @_GLOBAL__I_someMap() { define void @_GLOBAL__I_someMap() {
entry: entry:

View File

@@ -6,7 +6,7 @@
@SomeVar = weak_odr global i32 0 @SomeVar = weak_odr global i32 0
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @CTOR } ] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [ { i32, void ()*, i8* } { i32 65535, void ()* @CTOR, i8* null } ]
define internal void @CTOR() { define internal void @CTOR() {
store i32 23, i32* @SomeVar store i32 23, i32* @SomeVar

View File

@@ -1,5 +1,5 @@
; RUN: opt < %s -globalopt -disable-output ; RUN: opt < %s -globalopt -disable-output
%0 = type { i32, void ()* } %0 = type { i32, void ()*, i8* }
@llvm.global_ctors = appending global [0 x %0] zeroinitializer @llvm.global_ctors = appending global [0 x %0] zeroinitializer

View File

@@ -2,7 +2,7 @@
; CHECK: @tmp = local_unnamed_addr global i32 42 ; CHECK: @tmp = local_unnamed_addr global i32 42
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }]
@tmp = global i32 0 @tmp = global i32 0
define i32 @TheAnswerToLifeTheUniverseAndEverything() { define i32 @TheAnswerToLifeTheUniverseAndEverything() {

View File

@@ -94,10 +94,10 @@ define internal void @test6() {
} }
@llvm.global_ctors = appending constant @llvm.global_ctors = appending constant
[6 x { i32, void ()* }] [6 x { i32, void ()*, i8* }]
[{ i32, void ()* } { i32 65535, void ()* @test1 }, [{ i32, void ()*, i8* } { i32 65535, void ()* @test1, i8* null },
{ i32, void ()* } { i32 65535, void ()* @test2 }, { i32, void ()*, i8* } { i32 65535, void ()* @test2, i8* null },
{ i32, void ()* } { i32 65535, void ()* @test3 }, { i32, void ()*, i8* } { i32 65535, void ()* @test3, i8* null },
{ i32, void ()* } { i32 65535, void ()* @test4 }, { i32, void ()*, i8* } { i32 65535, void ()* @test4, i8* null },
{ i32, void ()* } { i32 65535, void ()* @test5 }, { i32, void ()*, i8* } { i32 65535, void ()* @test5, i8* null },
{ i32, void ()* } { i32 65535, void ()* @test6 }] { i32, void ()*, i8* } { i32 65535, void ()* @test6, i8* null }]

View File

@@ -2,12 +2,12 @@
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32" target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
target triple = "i386-apple-darwin9.8" target triple = "i386-apple-darwin9.8"
%0 = type { i32, void ()* } %0 = type { i32, void ()*, i8* }
%struct.btSimdScalar = type { %"union.btSimdScalar::$_14" } %struct.btSimdScalar = type { %"union.btSimdScalar::$_14" }
%"union.btSimdScalar::$_14" = type { <4 x float> } %"union.btSimdScalar::$_14" = type { <4 x float> }
@_ZL6vTwist = global %struct.btSimdScalar zeroinitializer ; <%struct.btSimdScalar*> [#uses=1] @_ZL6vTwist = global %struct.btSimdScalar zeroinitializer ; <%struct.btSimdScalar*> [#uses=1]
@llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @_GLOBAL__I__ZN21btConeTwistConstraintC2Ev }] ; <[12 x %0]*> [#uses=0] @llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @_GLOBAL__I__ZN21btConeTwistConstraintC2Ev, i8* null }] ; <[12 x %0]*> [#uses=0]
define internal void @_GLOBAL__I__ZN21btConeTwistConstraintC2Ev() nounwind section "__TEXT,__StaticInit,regular,pure_instructions" { define internal void @_GLOBAL__I__ZN21btConeTwistConstraintC2Ev() nounwind section "__TEXT,__StaticInit,regular,pure_instructions" {
entry: entry:

View File

@@ -2,7 +2,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-darwin10.0.0" target triple = "x86_64-apple-darwin10.0.0"
%0 = type { i32, void ()* } %0 = type { i32, void ()*, i8* }
%struct.foo = type { i32* } %struct.foo = type { i32* }
%struct.bar = type { i128 } %struct.bar = type { i128 }
@@ -10,7 +10,7 @@ target triple = "x86_64-apple-darwin10.0.0"
@H = global i32 0, align 4 @H = global i32 0, align 4
@X = global %struct.foo zeroinitializer, align 8 @X = global %struct.foo zeroinitializer, align 8
@X2 = global %struct.bar zeroinitializer, align 8 @X2 = global %struct.bar zeroinitializer, align 8
@llvm.global_ctors = appending global [2 x %0] [%0 { i32 65535, void ()* @init1 }, %0 { i32 65535, void ()* @init2 }] @llvm.global_ctors = appending global [2 x %0] [%0 { i32 65535, void ()* @init1, i8* null }, %0 { i32 65535, void ()* @init2, i8* null }]
; PR8710 - GlobalOpt shouldn't change the global's initializer to have this ; PR8710 - GlobalOpt shouldn't change the global's initializer to have this
; arbitrary constant expression, the code generator can't handle it. ; arbitrary constant expression, the code generator can't handle it.

View File

@@ -6,7 +6,7 @@
; CHECK: @H = local_unnamed_addr global i32 2 ; CHECK: @H = local_unnamed_addr global i32 2
; CHECK: @I = local_unnamed_addr global i32 2 ; CHECK: @I = local_unnamed_addr global i32 2
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @CTOR } ] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [ { i32, void ()*, i8* } { i32 65535, void ()* @CTOR, i8* null } ]
@addr = external global i32 @addr = external global i32
@G = internal global [6 x [5 x i32]] zeroinitializer @G = internal global [6 x [5 x i32]] zeroinitializer
@H = global i32 80 @H = global i32 80

View File

@@ -1,12 +1,12 @@
; RUN: opt < %s -S -passes='cgscc(inline),function(early-cse),globalopt' | FileCheck %s ; RUN: opt < %s -S -passes='cgscc(inline),function(early-cse),globalopt' | FileCheck %s
%0 = type { i32, void ()* } %0 = type { i32, void ()*, i8* }
%struct.A = type { i8 } %struct.A = type { i8 }
%struct.B = type { } %struct.B = type { }
@a = global %struct.A zeroinitializer, align 1 @a = global %struct.A zeroinitializer, align 1
@__dso_handle = external global i8* @__dso_handle = external global i8*
@llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @_GLOBAL__I_a }] @llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @_GLOBAL__I_a, i8* null }]
; CHECK-NOT: call i32 @__cxa_atexit ; CHECK-NOT: call i32 @__cxa_atexit

View File

@@ -9,7 +9,7 @@
@"\01L_OBJC_METH_VAR_NAME_40" = internal global [7 x i8] c"print:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 @"\01L_OBJC_METH_VAR_NAME_40" = internal global [7 x i8] c"print:\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@"\01L_OBJC_SELECTOR_REFERENCES_41" = internal externally_initialized global i8* getelementptr inbounds ([7 x i8], [7 x i8]* @"\01L_OBJC_METH_VAR_NAME_40", i32 0, i32 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" @"\01L_OBJC_SELECTOR_REFERENCES_41" = internal externally_initialized global i8* getelementptr inbounds ([7 x i8], [7 x i8]* @"\01L_OBJC_METH_VAR_NAME_40", i32 0, i32 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip"
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }]
@llvm.used = appending global [2 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @"\01L_OBJC_METH_VAR_NAME_40", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_41" to i8*)] @llvm.used = appending global [2 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @"\01L_OBJC_METH_VAR_NAME_40", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_41" to i8*)]
define internal void @__cxx_global_var_init() section "__TEXT,__StaticInit,regular,pure_instructions" { define internal void @__cxx_global_var_init() section "__TEXT,__StaticInit,regular,pure_instructions" {

View File

@@ -6,7 +6,7 @@
declare void @llvm.sideeffect() declare void @llvm.sideeffect()
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @ctor } ] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [ { i32, void ()*, i8* } { i32 65535, void ()* @ctor, i8* null } ]
@G = global i32 0 @G = global i32 0
define internal void @ctor() { define internal void @ctor() {

View File

@@ -13,5 +13,5 @@ define void @ctor1() {
} }
@llvm.global_ctors = appending constant @llvm.global_ctors = appending constant
[1 x { i32, void ()* }] [1 x { i32, void ()*, i8* }]
[ { i32, void ()* } { i32 65535, void ()* @ctor1 } ] [ { i32, void ()*, i8* } { i32 65535, void ()* @ctor1, i8* null } ]

View File

@@ -11,7 +11,7 @@
@tmp3 = global i32 0 @tmp3 = global i32 0
@ptrToTmp3 = global i32* null @ptrToTmp3 = global i32* null
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }]
define i32 @TheAnswerToLifeTheUniverseAndEverything() { define i32 @TheAnswerToLifeTheUniverseAndEverything() {
ret i32 42 ret i32 42

View File

@@ -52,8 +52,8 @@ define void @ctor4() {
@llvm.global_ctors = appending constant @llvm.global_ctors = appending constant
[4 x { i32, void ()* }] [4 x { i32, void ()*, i8* }]
[ { i32, void ()* } { i32 65535, void ()* @ctor1 }, [ { i32, void ()*, i8* } { i32 65535, void ()* @ctor1, i8* null },
{ i32, void ()* } { i32 65535, void ()* @ctor2 }, { i32, void ()*, i8* } { i32 65535, void ()* @ctor2, i8* null },
{ i32, void ()* } { i32 65535, void ()* @ctor3 }, { i32, void ()*, i8* } { i32 65535, void ()* @ctor3, i8* null },
{ i32, void ()* } { i32 65535, void ()* @ctor4 } ] { i32, void ()*, i8* } { i32 65535, void ()* @ctor4, i8* null } ]

View File

@@ -4,7 +4,7 @@
; Globalopt should be able to evaluate an invoke. ; Globalopt should be able to evaluate an invoke.
; CHECK: @tmp = local_unnamed_addr global i32 1 ; CHECK: @tmp = local_unnamed_addr global i32 1
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }]
@tmp = global i32 0 @tmp = global i32 0
define i32 @one() { define i32 @one() {

View File

@@ -1,12 +1,12 @@
; RUN: opt -globalopt -S < %s | FileCheck %s ; RUN: opt -globalopt -S < %s | FileCheck %s
; PR10047 ; PR10047
%0 = type { i32, void ()* } %0 = type { i32, void ()*, i8* }
%struct.A = type { [100 x i32] } %struct.A = type { [100 x i32] }
; CHECK: @a ; CHECK: @a
@a = global %struct.A zeroinitializer, align 4 @a = global %struct.A zeroinitializer, align 4
@llvm.global_ctors = appending global [2 x %0] [%0 { i32 65535, void ()* @_GLOBAL__I_a }, %0 { i32 65535, void ()* @_GLOBAL__I_b }] @llvm.global_ctors = appending global [2 x %0] [%0 { i32 65535, void ()* @_GLOBAL__I_a, i8* null }, %0 { i32 65535, void ()* @_GLOBAL__I_b, i8* null }]
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) nounwind declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) nounwind

View File

@@ -1,7 +1,7 @@
; RUN: opt < %s -globalopt -S | FileCheck %s ; RUN: opt < %s -globalopt -S | FileCheck %s
; CHECK-NOT: store ; CHECK-NOT: store
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__Z3foov } ] ; <[1 x { i32, void ()* }]*> [#uses=0] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [ { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I__Z3foov, i8* null } ] ; <[1 x { i32, void ()*, i8* }]*> [#uses=0]
@X.0 = internal global i32 undef ; <i32*> [#uses=2] @X.0 = internal global i32 undef ; <i32*> [#uses=2]
define i32 @_Z3foov() { define i32 @_Z3foov() {

View File

@@ -1,7 +1,7 @@
; RUN: opt -S -objc-arc-apelim < %s | FileCheck %s ; RUN: opt -S -objc-arc-apelim < %s | FileCheck %s
; rdar://10227311 ; rdar://10227311
@llvm.global_ctors = appending global [2 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_x }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_y }] @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_x, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_y, i8* null }]
@x = global i32 0 @x = global i32 0

View File

@@ -2,7 +2,7 @@
; See PR26774 ; See PR26774
@llvm.global_ctors = appending global [2 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_x }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_y }] @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_x, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_y, i8* null }]
@x = global i32 0 @x = global i32 0

View File

@@ -9,7 +9,7 @@
; BCA-NOT: <GLOBALVAL_SUMMARY_BLOCK ; BCA-NOT: <GLOBALVAL_SUMMARY_BLOCK
; CHECK: @llvm.global_ctors = appending global ; CHECK: @llvm.global_ctors = appending global
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @f }] @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* null }]
; CHECK: @g = internal global i8 42, !type !0 ; CHECK: @g = internal global i8 42, !type !0
@g = internal global i8 42, !type !0 @g = internal global i8 42, !type !0

View File

@@ -0,0 +1,6 @@
; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
@llvm.global_ctors = appending global [1 x { i32, void()* } ] [
{ i32, void()* } { i32 65535, void ()* null }
]
; CHECK: the third field of the element type is mandatory, specify i8* null to migrate from the obsoleted 2-field form