Index: clang/lib/CodeGen/MicrosoftCXXABI.cpp =================================================================== --- clang/lib/CodeGen/MicrosoftCXXABI.cpp +++ clang/lib/CodeGen/MicrosoftCXXABI.cpp @@ -1844,7 +1844,7 @@ VFTablesMap[ID] = VFTable; VTable = VTableAliasIsRequred ? cast( - cast(VFTable)->getBaseObject()) + cast(VFTable)->getAliaseeObject()) : cast(VFTable); return VTable; } Index: llvm/include/llvm/IR/GlobalAlias.h =================================================================== --- llvm/include/llvm/IR/GlobalAlias.h +++ llvm/include/llvm/IR/GlobalAlias.h @@ -77,10 +77,10 @@ return getIndirectSymbol(); } - const GlobalObject *getBaseObject() const; - GlobalObject *getBaseObject() { + const GlobalObject *getAliaseeObject() const; + GlobalObject *getAliaseeObject() { return const_cast( - static_cast(this)->getBaseObject()); + static_cast(this)->getAliaseeObject()); } static bool isValidLinkage(LinkageTypes L) { Index: llvm/include/llvm/IR/GlobalIndirectSymbol.h =================================================================== --- llvm/include/llvm/IR/GlobalIndirectSymbol.h +++ llvm/include/llvm/IR/GlobalIndirectSymbol.h @@ -57,10 +57,10 @@ static_cast(this)->getIndirectSymbol()); } - const GlobalObject *getBaseObject() const; - GlobalObject *getBaseObject() { + const GlobalObject *getAliaseeObject() const; + GlobalObject *getAliaseeObject() { return const_cast( - static_cast(this)->getBaseObject()); + static_cast(this)->getAliaseeObject()); } // Methods for support type inquiry through isa, cast, and dyn_cast: Index: llvm/include/llvm/IR/GlobalValue.h =================================================================== --- llvm/include/llvm/IR/GlobalValue.h +++ llvm/include/llvm/IR/GlobalValue.h @@ -548,10 +548,10 @@ return !(isDeclarationForLinker() || isWeakForLinker()); } - const GlobalObject *getBaseObject() const; - GlobalObject *getBaseObject() { + const GlobalObject *getAliaseeObject() const; + GlobalObject *getAliaseeObject() { return const_cast( - static_cast(this)->getBaseObject()); + static_cast(this)->getAliaseeObject()); } /// Returns whether this is a reference to an absolute symbol. Index: llvm/lib/Analysis/ConstantFolding.cpp =================================================================== --- llvm/lib/Analysis/ConstantFolding.cpp +++ llvm/lib/Analysis/ConstantFolding.cpp @@ -873,7 +873,7 @@ Ptr = cast(Ptr->stripPointerCasts()); if (ForLoadOperand) { while (isa(Ptr) && !cast(Ptr)->isInterposable() && - !cast(Ptr)->getBaseObject()->isInterposable()) { + !cast(Ptr)->getAliaseeObject()->isInterposable()) { Ptr = cast(Ptr)->getAliasee(); } } Index: llvm/lib/Analysis/ModuleSummaryAnalysis.cpp =================================================================== --- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -336,7 +336,7 @@ // called aliasee for the checks below. if (auto *GA = dyn_cast(CalledValue)) { assert(!CalledFunction && "Expected null called function in callsite for alias"); - CalledFunction = dyn_cast(GA->getBaseObject()); + CalledFunction = dyn_cast(GA->getAliaseeObject()); } // Check if this is a direct call to a known function or a known // intrinsic, or an indirect call with profile data. @@ -637,7 +637,7 @@ /* Live = */ false, A.isDSOLocal(), A.hasLinkOnceODRLinkage() && A.hasGlobalUnnamedAddr()); auto AS = std::make_unique(Flags); - auto *Aliasee = A.getBaseObject(); + auto *Aliasee = A.getAliaseeObject(); auto AliaseeVI = Index.getValueInfo(Aliasee->getGUID()); assert(AliaseeVI && "Alias expects aliasee summary to be available"); assert(AliaseeVI.getSummaryList().size() == 1 && Index: llvm/lib/Analysis/StackSafetyAnalysis.cpp =================================================================== --- llvm/lib/Analysis/StackSafetyAnalysis.cpp +++ llvm/lib/Analysis/StackSafetyAnalysis.cpp @@ -685,7 +685,7 @@ const GlobalAlias *A = dyn_cast(GV); if (!A) return nullptr; - GV = A->getBaseObject(); + GV = A->getAliaseeObject(); if (GV == A) return nullptr; } Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp =================================================================== --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -4035,7 +4035,7 @@ FSModVTableRefsAbbrev); for (const GlobalAlias &A : M.aliases()) { - auto *Aliasee = A.getBaseObject(); + auto *Aliasee = A.getAliaseeObject(); if (!Aliasee->hasName()) // Nameless function don't have an entry in the summary, skip it. continue; Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1666,9 +1666,9 @@ // size of the alias symbol from the type of the alias. We don't do this in // other situations as the alias and aliasee having differing types but same // size may be intentional. - const GlobalObject *BaseObject = GA->getBaseObject(); + const GlobalObject *Aliasee = GA->getAliaseeObject(); if (MAI->hasDotTypeDotSizeDirective() && GA->getValueType()->isSized() && - (!BaseObject || BaseObject->hasPrivateLinkage())) { + (!Aliasee || Aliasee->hasPrivateLinkage())) { const DataLayout &DL = M.getDataLayout(); uint64_t Size = DL.getTypeAllocSize(GA->getValueType()); OutStreamer->emitELFSize(Name, MCConstantExpr::create(Size, OutContext)); Index: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp =================================================================== --- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1495,7 +1495,7 @@ SmallVectorImpl &OutName, const GlobalValue *GV, const TargetMachine &TM) const { bool CannotUsePrivateLabel = true; - if (auto *GO = GV->getBaseObject()) { + if (auto *GO = GV->getAliaseeObject()) { SectionKind GOKind = TargetLoweringObjectFile::getKindForGlobal(GO, TM); const MCSection *TheSection = SectionForGlobal(GO, GOKind, TM); CannotUsePrivateLabel = @@ -1566,7 +1566,7 @@ if (const Comdat *C = GV->getComdat()) { const GlobalValue *ComdatKey = getComdatGVForCOFF(GV); if (const auto *GA = dyn_cast(ComdatKey)) - ComdatKey = GA->getBaseObject(); + ComdatKey = GA->getAliaseeObject(); if (ComdatKey == GV) { switch (C->getSelectionKind()) { case Comdat::Any: @@ -2490,12 +2490,12 @@ MCSymbol *TargetLoweringObjectFileXCOFF::getFunctionEntryPointSymbol( const GlobalValue *Func, const TargetMachine &TM) const { - assert( - (isa(Func) || - (isa(Func) && - isa_and_nonnull(cast(Func)->getBaseObject()))) && - "Func must be a function or an alias which has a function as base " - "object."); + assert((isa(Func) || + (isa(Func) && + isa_and_nonnull( + cast(Func)->getAliaseeObject()))) && + "Func must be a function or an alias which has a function as base " + "object."); SmallString<128> NameStr; NameStr.push_back('.'); Index: llvm/lib/IR/Globals.cpp =================================================================== --- llvm/lib/IR/Globals.cpp +++ llvm/lib/IR/Globals.cpp @@ -162,7 +162,7 @@ StringRef GlobalValue::getSection() const { if (auto *GA = dyn_cast(this)) { // In general we cannot compute this at the IR level, but we try. - if (const GlobalObject *GO = GA->getBaseObject()) + if (const GlobalObject *GO = GA->getAliaseeObject()) return GO->getSection(); return ""; } @@ -172,7 +172,7 @@ const Comdat *GlobalValue::getComdat() const { if (auto *GA = dyn_cast(this)) { // In general we cannot compute this at the IR level, but we try. - if (const GlobalObject *GO = GA->getBaseObject()) + if (const GlobalObject *GO = GA->getAliaseeObject()) return const_cast(GO)->getComdat(); return nullptr; } @@ -280,11 +280,11 @@ return true; } -const GlobalObject *GlobalValue::getBaseObject() const { +const GlobalObject *GlobalValue::getAliaseeObject() const { if (auto *GO = dyn_cast(this)) return GO; if (auto *GA = dyn_cast(this)) - return GA->getBaseObject(); + return GA->getAliaseeObject(); return nullptr; } @@ -519,7 +519,7 @@ setIndirectSymbol(Aliasee); } -const GlobalObject *GlobalAlias::getBaseObject() const { +const GlobalObject *GlobalAlias::getAliaseeObject() const { DenseSet Aliases; return findBaseObject(getOperand(0), Aliases); } Index: llvm/lib/LTO/LTO.cpp =================================================================== --- llvm/lib/LTO/LTO.cpp +++ llvm/lib/LTO/LTO.cpp @@ -733,7 +733,7 @@ DenseSet AliasedGlobals; for (auto &GA : M.aliases()) - if (GlobalObject *GO = GA.getBaseObject()) + if (GlobalObject *GO = GA.getAliaseeObject()) AliasedGlobals.insert(GO); // In this function we need IR GlobalValues matching the symbols in Syms Index: llvm/lib/Linker/LinkModules.cpp =================================================================== --- llvm/lib/Linker/LinkModules.cpp +++ llvm/lib/Linker/LinkModules.cpp @@ -133,7 +133,7 @@ const GlobalVariable *&GVar) { const GlobalValue *GVal = M.getNamedValue(ComdatName); if (const auto *GA = dyn_cast_or_null(GVal)) { - GVal = GA->getBaseObject(); + GVal = GA->getAliaseeObject(); if (!GVal) // We cannot resolve the size of the aliasee yet. return emitError("Linking COMDATs named '" + ComdatName + Index: llvm/lib/Object/IRSymtab.cpp =================================================================== --- llvm/lib/Object/IRSymtab.cpp +++ llvm/lib/Object/IRSymtab.cpp @@ -283,15 +283,15 @@ Uncommon().CommonAlign = GVar->getAlignment(); } - const GlobalObject *Base = GV->getBaseObject(); - if (!Base) { + const GlobalObject *GO = GV->getAliaseeObject(); + if (!GO) { if (isa(GV)) - Base = cast(GV)->getResolverFunction(); - if (!Base) + GO = cast(GV)->getResolverFunction(); + if (!GO) return make_error("Unable to determine comdat of alias!", inconvertibleErrorCode()); } - if (const Comdat *C = Base->getComdat()) { + if (const Comdat *C = GO->getComdat()) { Expected ComdatIndexOrErr = getComdatIndex(C, GV->getParent()); if (!ComdatIndexOrErr) return ComdatIndexOrErr.takeError(); @@ -316,8 +316,8 @@ } } - if (!Base->getSection().empty()) - setStr(Uncommon().SectionName, Saver.save(Base->getSection())); + if (!GO->getSection().empty()) + setStr(Uncommon().SectionName, Saver.save(GO->getSection())); return Error::success(); } Index: llvm/lib/Object/ModuleSymbolTable.cpp =================================================================== --- llvm/lib/Object/ModuleSymbolTable.cpp +++ llvm/lib/Object/ModuleSymbolTable.cpp @@ -204,7 +204,7 @@ if (GVar->isConstant()) Res |= BasicSymbolRef::SF_Const; } - if (isa_and_nonnull(GV->getBaseObject()) || isa(GV)) + if (isa_and_nonnull(GV->getAliaseeObject()) || isa(GV)) Res |= BasicSymbolRef::SF_Executable; if (isa(GV)) Res |= BasicSymbolRef::SF_Indirect; Index: llvm/lib/Target/ARM/ARMISelLowering.cpp =================================================================== --- llvm/lib/Target/ARM/ARMISelLowering.cpp +++ llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -3801,7 +3801,7 @@ bool ARMTargetLowering::isReadOnly(const GlobalValue *GV) const { if (const GlobalAlias *GA = dyn_cast(GV)) - if (!(GV = GA->getBaseObject())) + if (!(GV = GA->getAliaseeObject())) return false; if (const auto *V = dyn_cast(GV)) return V->isConstant(); Index: llvm/lib/Target/Hexagon/HexagonISelLowering.cpp =================================================================== --- llvm/lib/Target/Hexagon/HexagonISelLowering.cpp +++ llvm/lib/Target/Hexagon/HexagonISelLowering.cpp @@ -1231,7 +1231,7 @@ if (RM == Reloc::Static) { SDValue GA = DAG.getTargetGlobalAddress(GV, dl, PtrVT, Offset); - const GlobalObject *GO = GV->getBaseObject(); + const GlobalObject *GO = GV->getAliaseeObject(); if (GO && Subtarget.useSmallData() && HLOF.isGlobalInSmallSection(GO, HTM)) return DAG.getNode(HexagonISD::CONST32_GP, dl, PtrVT, GA); return DAG.getNode(HexagonISD::CONST32, dl, PtrVT, GA); Index: llvm/lib/Target/Lanai/LanaiISelLowering.cpp =================================================================== --- llvm/lib/Target/Lanai/LanaiISelLowering.cpp +++ llvm/lib/Target/Lanai/LanaiISelLowering.cpp @@ -1176,7 +1176,7 @@ // If the code model is small or global variable will be placed in the small // section, then assume address will fit in 21-bits. - const GlobalObject *GO = GV->getBaseObject(); + const GlobalObject *GO = GV->getAliaseeObject(); if (TLOF->isGlobalInSmallSection(GO, getTargetMachine())) { SDValue Small = DAG.getTargetGlobalAddress( GV, DL, getPointerTy(DAG.getDataLayout()), Offset, LanaiII::MO_NO_FLAG); Index: llvm/lib/Target/Mips/MipsISelLowering.cpp =================================================================== --- llvm/lib/Target/Mips/MipsISelLowering.cpp +++ llvm/lib/Target/Mips/MipsISelLowering.cpp @@ -2076,7 +2076,7 @@ const MipsTargetObjectFile *TLOF = static_cast( getTargetMachine().getObjFileLowering()); - const GlobalObject *GO = GV->getBaseObject(); + const GlobalObject *GO = GV->getAliaseeObject(); if (GO && TLOF->IsGlobalInSmallSection(GO, getTargetMachine())) // %gp_rel relocation return getAddrGPRel(N, SDLoc(N), Ty, DAG, ABI.IsN64()); Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp =================================================================== --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -2528,7 +2528,7 @@ // Construct an aliasing list for each GlobalObject. for (const auto &Alias : M.aliases()) { - const GlobalObject *Base = Alias.getBaseObject(); + const GlobalObject *Base = Alias.getAliaseeObject(); if (!Base) report_fatal_error( "alias without a base object is not yet supported on AIX"); Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp =================================================================== --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -4654,7 +4654,7 @@ // If we have an Alias we can try to get the function from there. if (Alias) { - const GlobalObject *GlobalObj = Alias->getBaseObject(); + const GlobalObject *GlobalObj = Alias->getAliaseeObject(); F = dyn_cast(GlobalObj); } Index: llvm/lib/Transforms/IPO/FunctionImport.cpp =================================================================== --- llvm/lib/Transforms/IPO/FunctionImport.cpp +++ llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -1154,7 +1154,7 @@ /// Make alias a clone of its aliasee. static Function *replaceAliasWithAliasee(Module *SrcModule, GlobalAlias *GA) { - Function *Fn = cast(GA->getBaseObject()); + Function *Fn = cast(GA->getAliaseeObject()); ValueToValueMapTy VMap; Function *NewFn = CloneFunction(Fn, VMap); @@ -1260,12 +1260,12 @@ if (Error Err = GA.materialize()) return std::move(Err); // Import alias as a copy of its aliasee. - GlobalObject *Base = GA.getBaseObject(); - if (Error Err = Base->materialize()) + GlobalObject *GO = GA.getAliaseeObject(); + if (Error Err = GO->materialize()) return std::move(Err); auto *Fn = replaceAliasWithAliasee(SrcModule.get(), &GA); - LLVM_DEBUG(dbgs() << "Is importing aliasee fn " << Base->getGUID() - << " " << Base->getName() << " from " + LLVM_DEBUG(dbgs() << "Is importing aliasee fn " << GO->getGUID() << " " + << GO->getName() << " from " << SrcModule->getSourceFileName() << "\n"); if (EnableImportMetadata) { // Add 'thinlto_src_module' metadata for statistics and debugging. Index: llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp =================================================================== --- llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp +++ llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp @@ -323,7 +323,8 @@ return true; if (auto *F = dyn_cast(GV)) return EligibleVirtualFns.count(F); - if (auto *GVar = dyn_cast_or_null(GV->getBaseObject())) + if (auto *GVar = + dyn_cast_or_null(GV->getAliaseeObject())) return HasTypeMetadata(GVar); return false; })); @@ -352,7 +353,7 @@ // Remove all globals with type metadata, globals with comdats that live in // MergedM, and aliases pointing to such globals from the thin LTO module. filterModule(&M, [&](const GlobalValue *GV) { - if (auto *GVar = dyn_cast_or_null(GV->getBaseObject())) + if (auto *GVar = dyn_cast_or_null(GV->getAliaseeObject())) if (HasTypeMetadata(GVar)) return false; if (const auto *C = GV->getComdat()) Index: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp =================================================================== --- llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -1430,7 +1430,7 @@ ++AI; // Don't stop on weak. We assume people aren't playing games with the // instrumentedness of overridden weak aliases. - auto *F = dyn_cast(GA->getBaseObject()); + auto *F = dyn_cast(GA->getAliaseeObject()); if (!F) continue; Index: llvm/lib/Transforms/Utils/SplitModule.cpp =================================================================== --- llvm/lib/Transforms/Utils/SplitModule.cpp +++ llvm/lib/Transforms/Utils/SplitModule.cpp @@ -126,8 +126,8 @@ // For aliases we should not separate them from their aliasees regardless // of linkage. if (auto *GIS = dyn_cast(&GV)) { - if (const GlobalObject *Base = GIS->getBaseObject()) - GVtoClusterMap.unionSets(&GV, Base); + if (const GlobalObject *Aliasee = GIS->getAliaseeObject()) + GVtoClusterMap.unionSets(&GV, Aliasee); } else if (auto *GIS = dyn_cast(&GV)) { GVtoClusterMap.unionSets(&GV, GIS->getResolverFunction()); } @@ -228,7 +228,7 @@ // Returns whether GV should be in partition (0-based) I of N. static bool isInPartition(const GlobalValue *GV, unsigned I, unsigned N) { if (auto *GIS = dyn_cast(GV)) { - if (const GlobalObject *Base = GIS->getBaseObject()) + if (const GlobalObject *Base = GIS->getAliaseeObject()) GV = Base; } else if (auto *GIS = dyn_cast(GV)) { GV = GIS->getResolverFunction(); Index: llvm/tools/bugpoint/CrashDebugger.cpp =================================================================== --- llvm/tools/bugpoint/CrashDebugger.cpp +++ llvm/tools/bugpoint/CrashDebugger.cpp @@ -269,7 +269,7 @@ std::vector ToRemove; // First, remove aliases to functions we're about to purge. for (GlobalAlias &Alias : M->aliases()) { - GlobalObject *Root = Alias.getBaseObject(); + GlobalObject *Root = Alias.getAliaseeObject(); Function *F = dyn_cast_or_null(Root); if (F) { if (Functions.count(F))