From: Fangrui Song Date: Wed, 15 May 2019 02:35:32 +0000 (+0000) Subject: [IR] Disallow llvm.global_ctors and llvm.global_dtors of the 2-field form in textual... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d7a1a7be424d4437453b109ce2c1ee82e7277a20;p=llvm [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360742 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/LangRef.rst b/docs/LangRef.rst index 0c1d87bc915..f9232e0b483 100644 --- a/docs/LangRef.rst +++ b/docs/LangRef.rst @@ -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 }] 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 of priority (i.e. lowest first) when the module is loaded. The 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 initializer function will only run if the associated 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 }] 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 order of priority (i.e. highest first) when the module is unloaded. The 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 data from the current module is not discarded. diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst index 60058fd8590..95fd43940b7 100644 --- a/docs/ReleaseNotes.rst +++ b/docs/ReleaseNotes.rst @@ -62,6 +62,10 @@ Changes to the LLVM IR parameter is required to be a simple constant. This annotation must 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 -------------------------- diff --git a/include/llvm/IR/AutoUpgrade.h b/include/llvm/IR/AutoUpgrade.h index 9900319336a..017ad93d8a2 100644 --- a/include/llvm/IR/AutoUpgrade.h +++ b/include/llvm/IR/AutoUpgrade.h @@ -46,9 +46,9 @@ namespace llvm { /// so that it can update all calls to the old function. void UpgradeCallsToIntrinsic(Function* F); - /// This checks for global variables which should be upgraded. It returns true - /// if it requires upgrading. - bool UpgradeGlobalVariable(GlobalVariable *GV); + /// This checks for global variables which should be upgraded. It it requires + /// upgrading, returns a pointer to the upgraded variable. + GlobalVariable *UpgradeGlobalVariable(GlobalVariable *GV); /// This checks for module flags which should be upgraded. It returns true if /// module is modified. diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index d3b8c4da5f4..28872566863 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2794,8 +2794,14 @@ Error BitcodeReader::globalCleanup() { } // Look for global variables which need to be renamed. + std::vector> UpgradedVariables; 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 // want lazy deserialization. diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index be874aca6d4..3d2e5e5ea00 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1966,7 +1966,7 @@ struct Structor { /// priority. void AsmPrinter::EmitXXStructorList(const DataLayout &DL, const Constant *List, 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. if (!isa(List)) return; @@ -1974,12 +1974,10 @@ void AsmPrinter::EmitXXStructorList(const DataLayout &DL, const Constant *List, const ConstantArray *InitList = dyn_cast(List); if (!InitList) return; // Not an array! StructType *ETy = dyn_cast(InitList->getType()->getElementType()); - // FIXME: Only allow the 3-field form in LLVM 4.0. - if (!ETy || ETy->getNumElements() < 2 || ETy->getNumElements() > 3) - return; // Not an array of two or three elements! - if (!isa(ETy->getTypeAtIndex(0U)) || - !isa(ETy->getTypeAtIndex(1U))) return; // Not (int, ptr). - if (ETy->getNumElements() == 3 && !isa(ETy->getTypeAtIndex(2U))) + if (!ETy || ETy->getNumElements() != 3 || + !isa(ETy->getTypeAtIndex(0U)) || + !isa(ETy->getTypeAtIndex(1U)) || + !isa(ETy->getTypeAtIndex(2U))) return; // Not (int, ptr, ptr). // 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(); S.Priority = Priority->getLimitedValue(65535); S.Func = CS->getOperand(1); - if (ETy->getNumElements() == 3 && !CS->getOperand(2)->isNullValue()) + if (!CS->getOperand(2)->isNullValue()) S.ComdatKey = dyn_cast(CS->getOperand(2)->stripPointerCasts()); } diff --git a/lib/IR/AutoUpgrade.cpp b/lib/IR/AutoUpgrade.cpp index c0fd3cd7cbd..e6a096a8855 100644 --- a/lib/IR/AutoUpgrade.cpp +++ b/lib/IR/AutoUpgrade.cpp @@ -805,9 +805,35 @@ bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn) { return Upgraded; } -bool llvm::UpgradeGlobalVariable(GlobalVariable *GV) { - // Nothing to do yet. - return false; +GlobalVariable *llvm::UpgradeGlobalVariable(GlobalVariable *GV) { + if (!(GV->hasName() && (GV->getName() == "llvm.global_ctors" || + GV->getName() == "llvm.global_dtors")) || + !GV->hasInitializer()) + return nullptr; + ArrayType *ATy = dyn_cast(GV->getValueType()); + if (!ATy) + return nullptr; + StructType *STy = dyn_cast(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 NewCtors(N); + for (unsigned i = 0; i != N; ++i) { + auto Ctor = cast(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 diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index 1ba64f33380..f7004cf4eae 100644 --- a/lib/IR/Verifier.cpp +++ b/lib/IR/Verifier.cpp @@ -641,18 +641,18 @@ void Verifier::visitGlobalVariable(const GlobalVariable &GV) { PointerType *FuncPtrTy = FunctionType::get(Type::getVoidTy(Context), false)-> getPointerTo(DL.getProgramAddressSpace()); - // FIXME: Reject the 2-field form in LLVM 4.0. Assert(STy && (STy->getNumElements() == 2 || STy->getNumElements() == 3) && STy->getTypeAtIndex(0u)->isIntegerTy(32) && STy->getTypeAtIndex(1) == FuncPtrTy, "wrong type for intrinsic global variable", &GV); - if (STy->getNumElements() == 3) { - Type *ETy = STy->getTypeAtIndex(2); - Assert(ETy->isPointerTy() && - cast(ETy)->getElementType()->isIntegerTy(8), - "wrong type for intrinsic global variable", &GV); - } + Assert(STy->getNumElements() == 3, + "the third field of the element type is mandatory, " + "specify i8* null to migrate from the obsoleted 2-field form"); + Type *ETy = STy->getTypeAtIndex(2); + Assert(ETy->isPointerTy() && + cast(ETy)->getElementType()->isIntegerTy(8), + "wrong type for intrinsic global variable", &GV); } } diff --git a/lib/Transforms/Utils/ModuleUtils.cpp b/lib/Transforms/Utils/ModuleUtils.cpp index b076e7503c6..c84beceee19 100644 --- a/lib/Transforms/Utils/ModuleUtils.cpp +++ b/lib/Transforms/Utils/ModuleUtils.cpp @@ -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 // to the list. SmallVector CurrentCtors; - StructType *EltTy; + StructType *EltTy = StructType::get( + IRB.getInt32Ty(), PointerType::getUnqual(FnTy), IRB.getInt8PtrTy()); if (GlobalVariable *GVCtor = M.getNamedGlobal(Array)) { - ArrayType *ATy = cast(GVCtor->getValueType()); - StructType *OldEltTy = cast(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()) { unsigned n = Init->getNumOperands(); CurrentCtors.reserve(n + 1); - for (unsigned i = 0; i != n; ++i) { - auto Ctor = cast(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); - } + for (unsigned i = 0; i != n; ++i) + CurrentCtors.push_back(cast(Init->getOperand(i))); } 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]; CSVals[0] = IRB.getInt32(Priority); CSVals[1] = F; - // FIXME: Drop support for the two element form in LLVM 4.0. - if (EltTy->getNumElements() >= 3) - CSVals[2] = Data ? ConstantExpr::getPointerCast(Data, IRB.getInt8PtrTy()) - : Constant::getNullValue(IRB.getInt8PtrTy()); + CSVals[2] = Data ? ConstantExpr::getPointerCast(Data, IRB.getInt8PtrTy()) + : Constant::getNullValue(IRB.getInt8PtrTy()); Constant *RuntimeCtorInit = ConstantStruct::get(EltTy, makeArrayRef(CSVals, EltTy->getNumElements())); diff --git a/test/Bitcode/metadata-2.ll b/test/Bitcode/metadata-2.ll index e9065261043..040087a9a4e 100644 --- a/test/Bitcode/metadata-2.ll +++ b/test/Bitcode/metadata-2.ll @@ -2,7 +2,7 @@ ; RUN: verify-uselistorder < %s %0 = type { %object.ModuleInfo.__vtbl*, i8*, %"byte[]", %1, %"ClassInfo[]", i32, void ()*, void ()*, void ()*, i8*, void ()* } ; type %0 %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** } %"Interface[]" = type { i64, %object.Interface* } %"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] @_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] -@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 { entry: diff --git a/test/Bitcode/upgrade-global-ctors.ll b/test/Bitcode/upgrade-global-ctors.ll index d7afcdd0c18..372b4646498 100644 --- a/test/Bitcode/upgrade-global-ctors.ll +++ b/test/Bitcode/upgrade-global-ctors.ll @@ -1,5 +1,5 @@ ; RUN: llvm-dis < %s.bc| FileCheck %s ; RUN: verify-uselistorder < %s.bc -; Global constructors should no longer be upgraded when reading bitcode. -; CHECK: @llvm.global_ctors = appending global [0 x { i32, void ()* }] zeroinitializer +; The 2-field form @llvm.global_ctors will be upgraded when reading bitcode. +; CHECK: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer diff --git a/test/Bitcode/upgrade-global-dtors.ll b/test/Bitcode/upgrade-global-dtors.ll new file mode 100644 index 00000000000..a0879bd1b8b --- /dev/null +++ b/test/Bitcode/upgrade-global-dtors.ll @@ -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 }] diff --git a/test/Bitcode/upgrade-global-dtors.ll.bc b/test/Bitcode/upgrade-global-dtors.ll.bc new file mode 100644 index 00000000000..39a6b3a52ff Binary files /dev/null and b/test/Bitcode/upgrade-global-dtors.ll.bc differ diff --git a/test/CodeGen/AArch64/init-array.ll b/test/CodeGen/AArch64/init-array.ll index a275e7ecc57..825f1ad0b23 100644 --- a/test/CodeGen/AArch64/init-array.ll +++ b/test/CodeGen/AArch64/init-array.ll @@ -5,6 +5,6 @@ define internal void @_GLOBAL__I_a() section ".text.startup" { 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 diff --git a/test/CodeGen/ARM/ctor_order.ll b/test/CodeGen/ARM/ctor_order.ll index 0cf87d7a97b..ca14b3ac3f1 100644 --- a/test/CodeGen/ARM/ctor_order.ll +++ b/test/CodeGen/ARM/ctor_order.ll @@ -21,7 +21,7 @@ ; 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() { entry: diff --git a/test/CodeGen/ARM/ctors_dtors.ll b/test/CodeGen/ARM/ctors_dtors.ll index c097ade3c84..1320ee22851 100644 --- a/test/CodeGen/ARM/ctors_dtors.ll +++ b/test/CodeGen/ARM/ctors_dtors.ll @@ -11,8 +11,8 @@ ; GNUEABI: .section .init_array,"aw",%init_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_dtors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @__mf_fini } ] ; <[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 ()*, i8* }] [ { i32, void ()*, i8* } { i32 65535, void ()* @__mf_fini, i8* null } ] ; <[1 x { i32, void ()*, i8* }]*> [#uses=0] define void @__mf_init() { entry: diff --git a/test/CodeGen/Mips/init-array.ll b/test/CodeGen/Mips/init-array.ll index 1ca182dae7a..1f1b4a050d2 100644 --- a/test/CodeGen/Mips/init-array.ll +++ b/test/CodeGen/Mips/init-array.ll @@ -2,7 +2,7 @@ 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: .init_array ; CHECK-NOT: .ctors diff --git a/test/CodeGen/PowerPC/pr17354.ll b/test/CodeGen/PowerPC/pr17354.ll index 5160d836a26..9b5f52aeed8 100644 --- a/test/CodeGen/PowerPC/pr17354.ll +++ b/test/CodeGen/PowerPC/pr17354.ll @@ -10,7 +10,7 @@ target triple = "powerpc64-unknown-linux-gnu" %struct.CS = type { i32 } @_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" { entry: diff --git a/test/CodeGen/RISCV/init-array.ll b/test/CodeGen/RISCV/init-array.ll index 1927eeb6d11..a2d176f2276 100644 --- a/test/CodeGen/RISCV/init-array.ll +++ b/test/CodeGen/RISCV/init-array.ll @@ -20,7 +20,7 @@ define internal void @_GLOBAL__I_a() section ".text.startup" { 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-NOT: .section .ctors diff --git a/test/CodeGen/SPARC/2008-10-10-InlineAsmMemoryOperand.ll b/test/CodeGen/SPARC/2008-10-10-InlineAsmMemoryOperand.ll index 07e250b3c98..32ebc02ce20 100644 --- a/test/CodeGen/SPARC/2008-10-10-InlineAsmMemoryOperand.ll +++ b/test/CodeGen/SPARC/2008-10-10-InlineAsmMemoryOperand.ll @@ -2,7 +2,7 @@ ; 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" -@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 { entry: diff --git a/test/CodeGen/X86/2007-06-04-X86-64-CtorAsmBugs.ll b/test/CodeGen/X86/2007-06-04-X86-64-CtorAsmBugs.ll index 1291dc9e6ed..7cba4c2531c 100644 --- a/test/CodeGen/X86/2007-06-04-X86-64-CtorAsmBugs.ll +++ b/test/CodeGen/X86/2007-06-04-X86-64-CtorAsmBugs.ll @@ -3,7 +3,7 @@ %struct.A = type { [1024 x i8] } @_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" { entry: diff --git a/test/CodeGen/X86/2011-08-29-InitOrder.ll b/test/CodeGen/X86/2011-08-29-InitOrder.ll index b278ad67415..2af7b1109f4 100644 --- a/test/CodeGen/X86/2011-08-29-InitOrder.ll +++ b/test/CodeGen/X86/2011-08-29-InitOrder.ll @@ -2,7 +2,7 @@ ; RUN: llc < %s -mtriple=i386-apple-darwin | FileCheck %s --check-prefix=CHECK-DARWIN ; 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: .long construct_1 ; CHECK-DEFAULT: .section .ctors.63535,"aw",@progbits @@ -14,7 +14,7 @@ ; CHECK-DARWIN-NEXT: .long _construct_2 ; 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: .long destruct_1 ; CHECK-DEFAULT: .section .dtors.63535,"aw",@progbits diff --git a/test/CodeGen/X86/init-priority.ll b/test/CodeGen/X86/init-priority.ll index 85ef5475cf2..30e94841f79 100644 --- a/test/CodeGen/X86/init-priority.ll +++ b/test/CodeGen/X86/init-priority.ll @@ -16,7 +16,7 @@ @c1 = global %class.C 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) { entry: diff --git a/test/CodeGen/X86/negate-add-zero.ll b/test/CodeGen/X86/negate-add-zero.ll index beb87e3e903..78a4cf89a7e 100644 --- a/test/CodeGen/X86/negate-add-zero.ll +++ b/test/CodeGen/X86/negate-add-zero.ll @@ -188,7 +188,6 @@ target triple = "i386-apple-darwin7" @"\01LC28" = external constant [15 x i8] ; <[15 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] -@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" diff --git a/test/DebugInfo/COFF/asan-module-ctor.ll b/test/DebugInfo/COFF/asan-module-ctor.ll index 8d1f811ad72..83b27305f3f 100644 --- a/test/DebugInfo/COFF/asan-module-ctor.ll +++ b/test/DebugInfo/COFF/asan-module-ctor.ll @@ -21,7 +21,7 @@ target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32" 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 define i32 @foo() #0 !dbg !4 { diff --git a/test/DebugInfo/COFF/asan-module-without-functions.ll b/test/DebugInfo/COFF/asan-module-without-functions.ll index 9e3c25e80a8..f009e301558 100644 --- a/test/DebugInfo/COFF/asan-module-without-functions.ll +++ b/test/DebugInfo/COFF/asan-module-without-functions.ll @@ -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" @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_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 }] -@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() { call void @__asan_init_v3() diff --git a/test/DebugInfo/Generic/incorrect-variable-debugloc.ll b/test/DebugInfo/Generic/incorrect-variable-debugloc.ll index c6143a53649..e8a50d067ba 100644 --- a/test/DebugInfo/Generic/incorrect-variable-debugloc.ll +++ b/test/DebugInfo/Generic/incorrect-variable-debugloc.ll @@ -52,7 +52,7 @@ %struct.B = type { i32 } %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_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 diff --git a/test/DebugInfo/X86/cu-ranges-odr.ll b/test/DebugInfo/X86/cu-ranges-odr.ll index 4582cc29d43..896fae71522 100644 --- a/test/DebugInfo/X86/cu-ranges-odr.ll +++ b/test/DebugInfo/X86/cu-ranges-odr.ll @@ -23,7 +23,7 @@ source_filename = "test/DebugInfo/X86/cu-ranges-odr.ll" %class.A = type { i32 } @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 { entry: diff --git a/test/DebugInfo/X86/dbg_value_direct.ll b/test/DebugInfo/X86/dbg_value_direct.ll index e95fa7b28a4..f9e3d766723 100644 --- a/test/DebugInfo/X86/dbg_value_direct.ll +++ b/test/DebugInfo/X86/dbg_value_direct.ll @@ -19,7 +19,7 @@ target triple = "x86_64-unknown-linux-gnu" @__asan_mapping_offset = linkonce_odr constant i64 2147450880 @__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 ; Function Attrs: sanitize_address uwtable diff --git a/test/DebugInfo/X86/debug-ranges-offset.ll b/test/DebugInfo/X86/debug-ranges-offset.ll index 6a601716dc3..ce74406a1c6 100644 --- a/test/DebugInfo/X86/debug-ranges-offset.ll +++ b/test/DebugInfo/X86/debug-ranges-offset.ll @@ -6,7 +6,7 @@ ; low_pc for the compile unit. ; 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" @__msan_retval_tls = external thread_local(initialexec) global [8 x i64] @__msan_retval_origin_tls = external thread_local(initialexec) global i32 diff --git a/test/DebugInfo/X86/generate-odr-hash.ll b/test/DebugInfo/X86/generate-odr-hash.ll index e1d3df4e5cd..af905c37605 100644 --- a/test/DebugInfo/X86/generate-odr-hash.ll +++ b/test/DebugInfo/X86/generate-odr-hash.ll @@ -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 @w = internal global %"struct.::walrus" zeroinitializer, align 1, !dbg !16 @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 define void @_Z3foov() #0 !dbg !40 { diff --git a/test/Feature/global_pv.ll b/test/Feature/global_pv.ll index 34b9a7df882..f1a7b7fd356 100644 --- a/test/Feature/global_pv.ll +++ b/test/Feature/global_pv.ll @@ -3,8 +3,8 @@ @G1 = global i32 zeroinitializer @G2 = global i32 zeroinitializer @g = global <2 x i32*> zeroinitializer -%0 = type { i32, void ()* } -@llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @test }] +%0 = type { i32, void ()*, i8* } +@llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @test, i8* null }] define internal void @test() { %A = insertelement <2 x i32*> undef, i32* @G1, i32 0 %B = insertelement <2 x i32*> %A, i32* @G2, i32 1 diff --git a/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll b/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll index 16e9ea04f09..d392662efc7 100644 --- a/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll +++ b/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll @@ -26,7 +26,7 @@ entry: 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" { entry: diff --git a/test/Instrumentation/MemorySanitizer/global_ctors_2to3.ll b/test/Instrumentation/MemorySanitizer/global_ctors_2to3.ll deleted file mode 100644 index d841c6c05c9..00000000000 --- a/test/Instrumentation/MemorySanitizer/global_ctors_2to3.ll +++ /dev/null @@ -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 { diff --git a/test/Linker/ctors5.ll b/test/Linker/ctors5.ll deleted file mode 100644 index 99124061bb3..00000000000 --- a/test/Linker/ctors5.ll +++ /dev/null @@ -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 -} diff --git a/test/Linker/global_ctors.ll b/test/Linker/global_ctors.ll deleted file mode 100644 index cc28471df59..00000000000 --- a/test/Linker/global_ctors.ll +++ /dev/null @@ -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: ] diff --git a/test/MC/ARM/cxx-global-constructor.ll b/test/MC/ARM/cxx-global-constructor.ll index 4afd1e19ad4..02324338908 100644 --- a/test/MC/ARM/cxx-global-constructor.ll +++ b/test/MC/ARM/cxx-global-constructor.ll @@ -2,7 +2,7 @@ ; 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() { ret void diff --git a/test/Transforms/GlobalDCE/global_ctors.ll b/test/Transforms/GlobalDCE/global_ctors.ll index bd1a97e6ec2..37d1c8d37c8 100644 --- a/test/Transforms/GlobalDCE/global_ctors.ll +++ b/test/Transforms/GlobalDCE/global_ctors.ll @@ -1,12 +1,12 @@ ; RUN: opt -S -globaldce < %s | FileCheck %s ; 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 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 diff --git a/test/Transforms/GlobalDCE/global_ctors_integration.ll b/test/Transforms/GlobalDCE/global_ctors_integration.ll index f7f702a980d..47a1d0d1ab5 100644 --- a/test/Transforms/GlobalDCE/global_ctors_integration.ll +++ b/test/Transforms/GlobalDCE/global_ctors_integration.ll @@ -9,7 +9,7 @@ @foo = global %class.Foo zeroinitializer, align 4 @_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" { %1 = load i32, i32* @_ZN3Bar18LINKER_INITIALIZEDE, align 4 diff --git a/test/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll b/test/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll index 419ae101966..a8531964fb1 100644 --- a/test/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll +++ b/test/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll @@ -16,7 +16,7 @@ target triple = "i686-pc-linux-gnu" %"struct.std::vector >" = type { %"struct.std::_Vector_base >" } @registry_lock = external global %struct..0FileDescriptor ; <%struct..0FileDescriptor*> [#uses=0] @_ZN61FLAG__foo_int32_44FLAGS_E = external global %"struct.FlagRegisterer" ; <%"struct.FlagRegisterer"*> [#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() diff --git a/test/Transforms/GlobalOpt/2007-06-04-PackedStruct.ll b/test/Transforms/GlobalOpt/2007-06-04-PackedStruct.ll index f6e0bb70d63..0c9927f680b 100644 --- a/test/Transforms/GlobalOpt/2007-06-04-PackedStruct.ll +++ b/test/Transforms/GlobalOpt/2007-06-04-PackedStruct.ll @@ -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::map,std::allocator > >" = type { %"struct.std::_Rb_tree,std::_Select1st >,std::less,std::allocator > >" } @someMap = global %"struct.std::map,std::allocator > >" zeroinitializer ; <%"struct.std::map,std::allocator > >"*> [#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_dtors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__D_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 ()*, i8* }] [ { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__D_someMap, i8* null } ] ; <[1 x { i32, void ()*, i8* }]*> [#uses=0] define void @_GLOBAL__I_someMap() { entry: diff --git a/test/Transforms/GlobalOpt/2010-10-19-WeakOdr.ll b/test/Transforms/GlobalOpt/2010-10-19-WeakOdr.ll index c88dc1c2d12..f09ab9a2018 100644 --- a/test/Transforms/GlobalOpt/2010-10-19-WeakOdr.ll +++ b/test/Transforms/GlobalOpt/2010-10-19-WeakOdr.ll @@ -6,7 +6,7 @@ @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() { store i32 23, i32* @SomeVar diff --git a/test/Transforms/GlobalOpt/2011-04-09-EmptyGlobalCtors.ll b/test/Transforms/GlobalOpt/2011-04-09-EmptyGlobalCtors.ll index 321a487cc82..42818d6ccc2 100644 --- a/test/Transforms/GlobalOpt/2011-04-09-EmptyGlobalCtors.ll +++ b/test/Transforms/GlobalOpt/2011-04-09-EmptyGlobalCtors.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -globalopt -disable-output -%0 = type { i32, void ()* } +%0 = type { i32, void ()*, i8* } @llvm.global_ctors = appending global [0 x %0] zeroinitializer diff --git a/test/Transforms/GlobalOpt/assume.ll b/test/Transforms/GlobalOpt/assume.ll index b15106bc83a..cb41b67e346 100644 --- a/test/Transforms/GlobalOpt/assume.ll +++ b/test/Transforms/GlobalOpt/assume.ll @@ -2,7 +2,7 @@ ; 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 define i32 @TheAnswerToLifeTheUniverseAndEverything() { diff --git a/test/Transforms/GlobalOpt/constantfold-initializers.ll b/test/Transforms/GlobalOpt/constantfold-initializers.ll index 3c20353d157..9f57abcb16f 100644 --- a/test/Transforms/GlobalOpt/constantfold-initializers.ll +++ b/test/Transforms/GlobalOpt/constantfold-initializers.ll @@ -94,10 +94,10 @@ define internal void @test6() { } @llvm.global_ctors = appending constant - [6 x { i32, void ()* }] - [{ i32, void ()* } { i32 65535, void ()* @test1 }, - { i32, void ()* } { i32 65535, void ()* @test2 }, - { i32, void ()* } { i32 65535, void ()* @test3 }, - { i32, void ()* } { i32 65535, void ()* @test4 }, - { i32, void ()* } { i32 65535, void ()* @test5 }, - { i32, void ()* } { i32 65535, void ()* @test6 }] + [6 x { i32, void ()*, i8* }] + [{ i32, void ()*, i8* } { i32 65535, void ()* @test1, i8* null }, + { i32, void ()*, i8* } { i32 65535, void ()* @test2, i8* null }, + { i32, void ()*, i8* } { i32 65535, void ()* @test3, i8* null }, + { i32, void ()*, i8* } { i32 65535, void ()* @test4, i8* null }, + { i32, void ()*, i8* } { i32 65535, void ()* @test5, i8* null }, + { i32, void ()*, i8* } { i32 65535, void ()* @test6, i8* null }] diff --git a/test/Transforms/GlobalOpt/crash.ll b/test/Transforms/GlobalOpt/crash.ll index 8cfe9ea0570..e9ad7e0d043 100644 --- a/test/Transforms/GlobalOpt/crash.ll +++ b/test/Transforms/GlobalOpt/crash.ll @@ -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 triple = "i386-apple-darwin9.8" -%0 = type { i32, void ()* } +%0 = type { i32, void ()*, i8* } %struct.btSimdScalar = type { %"union.btSimdScalar::$_14" } %"union.btSimdScalar::$_14" = type { <4 x float> } @_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" { entry: diff --git a/test/Transforms/GlobalOpt/ctor-list-opt-constexpr.ll b/test/Transforms/GlobalOpt/ctor-list-opt-constexpr.ll index 0c3ff68a437..bc9ac5b7872 100644 --- a/test/Transforms/GlobalOpt/ctor-list-opt-constexpr.ll +++ b/test/Transforms/GlobalOpt/ctor-list-opt-constexpr.ll @@ -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 triple = "x86_64-apple-darwin10.0.0" -%0 = type { i32, void ()* } +%0 = type { i32, void ()*, i8* } %struct.foo = type { i32* } %struct.bar = type { i128 } @@ -10,7 +10,7 @@ target triple = "x86_64-apple-darwin10.0.0" @H = global i32 0, align 4 @X = global %struct.foo 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 ; arbitrary constant expression, the code generator can't handle it. diff --git a/test/Transforms/GlobalOpt/ctor-list-opt-inbounds.ll b/test/Transforms/GlobalOpt/ctor-list-opt-inbounds.ll index b969345710d..d581f535f89 100644 --- a/test/Transforms/GlobalOpt/ctor-list-opt-inbounds.ll +++ b/test/Transforms/GlobalOpt/ctor-list-opt-inbounds.ll @@ -6,7 +6,7 @@ ; CHECK: @H = 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 @G = internal global [6 x [5 x i32]] zeroinitializer @H = global i32 80 diff --git a/test/Transforms/GlobalOpt/cxx-dtor.ll b/test/Transforms/GlobalOpt/cxx-dtor.ll index c43a8e2be2e..50d9ff77b54 100644 --- a/test/Transforms/GlobalOpt/cxx-dtor.ll +++ b/test/Transforms/GlobalOpt/cxx-dtor.ll @@ -1,12 +1,12 @@ ; 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.B = type { } @a = global %struct.A zeroinitializer, align 1 @__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 diff --git a/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll b/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll index 2e22ff06444..21603f47101 100644 --- a/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll +++ b/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll @@ -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_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*)] define internal void @__cxx_global_var_init() section "__TEXT,__StaticInit,regular,pure_instructions" { diff --git a/test/Transforms/GlobalOpt/int_sideeffect.ll b/test/Transforms/GlobalOpt/int_sideeffect.ll index 59c3a8aa4ba..49198cf695a 100644 --- a/test/Transforms/GlobalOpt/int_sideeffect.ll +++ b/test/Transforms/GlobalOpt/int_sideeffect.ll @@ -6,7 +6,7 @@ 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 define internal void @ctor() { diff --git a/test/Transforms/GlobalOpt/invariant-nodatalayout.ll b/test/Transforms/GlobalOpt/invariant-nodatalayout.ll index d1fbe46257d..bb0b9e9143a 100644 --- a/test/Transforms/GlobalOpt/invariant-nodatalayout.ll +++ b/test/Transforms/GlobalOpt/invariant-nodatalayout.ll @@ -13,5 +13,5 @@ define void @ctor1() { } @llvm.global_ctors = appending constant - [1 x { i32, void ()* }] - [ { i32, void ()* } { i32 65535, void ()* @ctor1 } ] + [1 x { i32, void ()*, i8* }] + [ { i32, void ()*, i8* } { i32 65535, void ()* @ctor1, i8* null } ] diff --git a/test/Transforms/GlobalOpt/invariant.group.ll b/test/Transforms/GlobalOpt/invariant.group.ll index 8a090cbd0d3..dc6fbdbd5e2 100644 --- a/test/Transforms/GlobalOpt/invariant.group.ll +++ b/test/Transforms/GlobalOpt/invariant.group.ll @@ -11,7 +11,7 @@ @tmp3 = global i32 0 @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() { ret i32 42 diff --git a/test/Transforms/GlobalOpt/invariant.ll b/test/Transforms/GlobalOpt/invariant.ll index 02ffe2bc424..309562b17ff 100644 --- a/test/Transforms/GlobalOpt/invariant.ll +++ b/test/Transforms/GlobalOpt/invariant.ll @@ -52,8 +52,8 @@ define void @ctor4() { @llvm.global_ctors = appending constant - [4 x { i32, void ()* }] - [ { i32, void ()* } { i32 65535, void ()* @ctor1 }, - { i32, void ()* } { i32 65535, void ()* @ctor2 }, - { i32, void ()* } { i32 65535, void ()* @ctor3 }, - { i32, void ()* } { i32 65535, void ()* @ctor4 } ] + [4 x { i32, void ()*, i8* }] + [ { i32, void ()*, i8* } { i32 65535, void ()* @ctor1, i8* null }, + { i32, void ()*, i8* } { i32 65535, void ()* @ctor2, i8* null }, + { i32, void ()*, i8* } { i32 65535, void ()* @ctor3, i8* null }, + { i32, void ()*, i8* } { i32 65535, void ()* @ctor4, i8* null } ] diff --git a/test/Transforms/GlobalOpt/invoke.ll b/test/Transforms/GlobalOpt/invoke.ll index a3019939735..c54c7aad924 100644 --- a/test/Transforms/GlobalOpt/invoke.ll +++ b/test/Transforms/GlobalOpt/invoke.ll @@ -4,7 +4,7 @@ ; Globalopt should be able to evaluate an invoke. ; 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 define i32 @one() { diff --git a/test/Transforms/GlobalOpt/memset-null.ll b/test/Transforms/GlobalOpt/memset-null.ll index 32bd21cfc58..fb2c5104a6c 100644 --- a/test/Transforms/GlobalOpt/memset-null.ll +++ b/test/Transforms/GlobalOpt/memset-null.ll @@ -1,12 +1,12 @@ ; RUN: opt -globalopt -S < %s | FileCheck %s ; PR10047 -%0 = type { i32, void ()* } +%0 = type { i32, void ()*, i8* } %struct.A = type { [100 x i32] } ; CHECK: @a @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 diff --git a/test/Transforms/GlobalOpt/undef-init.ll b/test/Transforms/GlobalOpt/undef-init.ll index 71fad343e56..421a0657ec7 100644 --- a/test/Transforms/GlobalOpt/undef-init.ll +++ b/test/Transforms/GlobalOpt/undef-init.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -globalopt -S | FileCheck %s ; 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 ; [#uses=2] define i32 @_Z3foov() { diff --git a/test/Transforms/ObjCARC/apelim.ll b/test/Transforms/ObjCARC/apelim.ll index da3a1f42654..d79fa061fe1 100644 --- a/test/Transforms/ObjCARC/apelim.ll +++ b/test/Transforms/ObjCARC/apelim.ll @@ -1,7 +1,7 @@ ; RUN: opt -S -objc-arc-apelim < %s | FileCheck %s ; 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 diff --git a/test/Transforms/ObjCARC/comdat-ipo.ll b/test/Transforms/ObjCARC/comdat-ipo.ll index 44d7b101049..d7d1d6de097 100644 --- a/test/Transforms/ObjCARC/comdat-ipo.ll +++ b/test/Transforms/ObjCARC/comdat-ipo.ll @@ -2,7 +2,7 @@ ; 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 diff --git a/test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll b/test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll index 46c87bc4e1f..72848bfff5f 100644 --- a/test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll +++ b/test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll @@ -9,7 +9,7 @@ ; BCA-NOT: &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