From 6115b39ffdabcf375210bf4d32cbeadaedc0dbf4 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sun, 26 Jul 2009 09:48:23 +0000 Subject: [PATCH] Remove Value::getName{Start,End}, the last of the old Name APIs. llvm-svn: 77152 --- llvm/include/llvm/Value.h | 13 ---------- llvm/lib/Analysis/DebugInfo.cpp | 4 ++-- llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp | 2 +- llvm/lib/Analysis/SparsePropagation.cpp | 11 +++++---- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 2 +- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 3 +-- .../lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp | 6 ++--- llvm/lib/CodeGen/GCMetadata.cpp | 4 ++-- .../JIT/MacOSJITEventListener.cpp | 5 ++-- .../JIT/OProfileJITEventListener.cpp | 17 ++++++------- .../IPO/DeadArgumentElimination.cpp | 12 +++++----- llvm/lib/Transforms/IPO/StripSymbols.cpp | 11 ++++----- .../lib/Transforms/IPO/StructRetPromotion.cpp | 4 +++- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 2 +- .../Scalar/InstructionCombining.cpp | 4 ++-- llvm/lib/Transforms/Scalar/JumpThreading.cpp | 6 ++--- .../Transforms/Scalar/LoopStrengthReduce.cpp | 9 ++++--- .../lib/Transforms/Scalar/MemCpyOptimizer.cpp | 2 +- .../Scalar/SimplifyHalfPowrLibCalls.cpp | 3 +-- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 24 +++++++++---------- llvm/tools/lto/LTOModule.cpp | 4 ++-- 21 files changed, 67 insertions(+), 81 deletions(-) diff --git a/llvm/include/llvm/Value.h b/llvm/include/llvm/Value.h index b840531ce88b..7965ca572235 100644 --- a/llvm/include/llvm/Value.h +++ b/llvm/include/llvm/Value.h @@ -110,19 +110,6 @@ public: // All values can potentially be named... inline bool hasName() const { return Name != 0; } ValueName *getValueName() const { return Name; } - - /// getNameStart - Return a pointer to a null terminated string for this name. - /// Note that names can have null characters within the string as well as at - /// their end. This always returns a non-null pointer. - const char *getNameStart() const { - if (!Name) return ""; - return getName().begin(); - } - /// getNameEnd - Return a pointer to the end of the name. - const char *getNameEnd() const { - if (!Name) return ""; - return getName().end(); - } /// getName() - Return a constant reference to the value's name. This is cheap /// and guaranteed to return the same reference as long as the value is not diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp index aded6d8eee8c..61c9a4af3e15 100644 --- a/llvm/lib/Analysis/DebugInfo.cpp +++ b/llvm/lib/Analysis/DebugInfo.cpp @@ -329,7 +329,7 @@ bool DISubprogram::describes(const Function *F) { getLinkageName(Name); if (Name.empty()) getName(Name); - if (!Name.empty() && (strcmp(Name.c_str(), F->getNameStart()) == false)) + if (F->getName() == Name) return true; return false; } @@ -1057,7 +1057,7 @@ namespace llvm { for (Module::global_iterator GVI = M.global_begin(), E = M.global_end(); GVI != E; GVI++) { GlobalVariable *GV = GVI; - if (GV->hasName() && strncmp(GV->getNameStart(), "llvm.dbg", 8) == 0 + if (GV->hasName() && GV->getName().startswith("llvm.dbg") && GV->isConstant() && GV->hasInitializer()) { DICompileUnit C(GV); if (C.isNull() == false) { diff --git a/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp b/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp index 3880d0a10bb6..df2f0f8bd695 100644 --- a/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp +++ b/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp @@ -109,7 +109,7 @@ bool CGPassManager::runOnModule(Module &M) { for (unsigned i = 0, e = SCC.size(); i != e; ++i) { Function *F = SCC[i]->getFunction(); if (F) { - dumpPassInfo(P, EXECUTION_MSG, ON_FUNCTION_MSG, F->getNameStart()); + dumpPassInfo(P, EXECUTION_MSG, ON_FUNCTION_MSG, F->getName()); Changed |= FPP->runOnFunction(*F); } } diff --git a/llvm/lib/Analysis/SparsePropagation.cpp b/llvm/lib/Analysis/SparsePropagation.cpp index c1b39fe7d752..2522932e1263 100644 --- a/llvm/lib/Analysis/SparsePropagation.cpp +++ b/llvm/lib/Analysis/SparsePropagation.cpp @@ -19,6 +19,7 @@ #include "llvm/Instructions.h" #include "llvm/LLVMContext.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; //===----------------------------------------------------------------------===// @@ -88,7 +89,7 @@ void SparseSolver::UpdateState(Instruction &Inst, LatticeVal V) { /// MarkBlockExecutable - This method can be used by clients to mark all of /// the blocks that are known to be intrinsically live in the processed unit. void SparseSolver::MarkBlockExecutable(BasicBlock *BB) { - DOUT << "Marking Block Executable: " << BB->getNameStart() << "\n"; + DEBUG(errs() << "Marking Block Executable: " << BB->getName() << "\n"); BBExecutable.insert(BB); // Basic block is executable! BBWorkList.push_back(BB); // Add the block to the work list! } @@ -99,8 +100,8 @@ void SparseSolver::markEdgeExecutable(BasicBlock *Source, BasicBlock *Dest) { if (!KnownFeasibleEdges.insert(Edge(Source, Dest)).second) return; // This edge is already known to be executable! - DOUT << "Marking Edge Executable: " << Source->getNameStart() - << " -> " << Dest->getNameStart() << "\n"; + DEBUG(errs() << "Marking Edge Executable: " << Source->getName() + << " -> " << Dest->getName() << "\n"); if (BBExecutable.count(Dest)) { // The destination is already executable, but we just made an edge @@ -284,7 +285,7 @@ void SparseSolver::Solve(Function &F) { Instruction *I = InstWorkList.back(); InstWorkList.pop_back(); - DOUT << "\nPopped off I-WL: " << *I; + DEBUG(errs() << "\nPopped off I-WL: " << *I); // "I" got into the work list because it made a transition. See if any // users are both live and in need of updating. @@ -301,7 +302,7 @@ void SparseSolver::Solve(Function &F) { BasicBlock *BB = BBWorkList.back(); BBWorkList.pop_back(); - DOUT << "\nPopped off BBWL: " << *BB; + DEBUG(errs() << "\nPopped off BBWL: " << *BB); // Notify all instructions in this basic block that they are newly // executable. diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index c608f6e4447f..082bce565a39 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1611,7 +1611,7 @@ void AsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB, O << ':'; if (printComment && MBB->getBasicBlock()) O << '\t' << TAI->getCommentString() << ' ' - << MBB->getBasicBlock()->getNameStart(); + << MBB->getBasicBlock()->getNameStr(); } /// printPICJumpTableSetLabel - This method prints a set label for the diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 79d13291bacb..f26fb0d6fe9f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1120,9 +1120,8 @@ void DwarfDebug::ConstructFunctionDbgScope(DbgScope *RootScope, /// ConstructDefaultDbgScope - Construct a default scope for the subprogram. /// void DwarfDebug::ConstructDefaultDbgScope(MachineFunction *MF) { - const char *FnName = MF->getFunction()->getNameStart(); StringMap &Globals = ModuleCU->getGlobals(); - StringMap::iterator GI = Globals.find(FnName); + StringMap::iterator GI = Globals.find(MF->getFunction()->getName()); if (GI != Globals.end()) { DIE *SPDie = GI->second; diff --git a/llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp index 0d3a2780ba59..b9a674d3e0bc 100644 --- a/llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp @@ -118,7 +118,7 @@ void OcamlGCMetadataPrinter::finishAssembly(raw_ostream &OS, AsmPrinter &AP, if (FrameSize >= 1<<16) { std::string msg; raw_string_ostream Msg(msg); - Msg << "Function '" << FI.getFunction().getNameStart() + Msg << "Function '" << FI.getFunction().getName() << "' is too large for the ocaml GC! " << "Frame size " << FrameSize << " >= 65536.\n"; Msg << "(" << uintptr_t(&FI) << ")"; @@ -126,14 +126,14 @@ void OcamlGCMetadataPrinter::finishAssembly(raw_ostream &OS, AsmPrinter &AP, } OS << "\t" << TAI.getCommentString() << " live roots for " - << FI.getFunction().getNameStart() << "\n"; + << FI.getFunction().getName() << "\n"; for (GCFunctionInfo::iterator J = FI.begin(), JE = FI.end(); J != JE; ++J) { size_t LiveCount = FI.live_size(J); if (LiveCount >= 1<<16) { std::string msg; raw_string_ostream Msg(msg); - Msg << "Function '" << FI.getFunction().getNameStart() + Msg << "Function '" << FI.getFunction().getName() << "' is too large for the ocaml GC! " << "Live root count " << LiveCount << " >= 65536."; llvm_report_error(Msg.str()); // Very rude! diff --git a/llvm/lib/CodeGen/GCMetadata.cpp b/llvm/lib/CodeGen/GCMetadata.cpp index 3c2aaf4e0c88..cc8f82fbe531 100644 --- a/llvm/lib/CodeGen/GCMetadata.cpp +++ b/llvm/lib/CodeGen/GCMetadata.cpp @@ -153,12 +153,12 @@ bool Printer::runOnFunction(Function &F) { if (!F.hasGC()) { GCFunctionInfo *FD = &getAnalysis().getFunctionInfo(F); - OS << "GC roots for " << FD->getFunction().getNameStart() << ":\n"; + OS << "GC roots for " << FD->getFunction().getNameStr() << ":\n"; for (GCFunctionInfo::roots_iterator RI = FD->roots_begin(), RE = FD->roots_end(); RI != RE; ++RI) OS << "\t" << RI->Num << "\t" << RI->StackOffset << "[sp]\n"; - OS << "GC safe points for " << FD->getFunction().getNameStart() << ":\n"; + OS << "GC safe points for " << FD->getFunction().getNameStr() << ":\n"; for (GCFunctionInfo::iterator PI = FD->begin(), PE = FD->end(); PI != PE; ++PI) { diff --git a/llvm/lib/ExecutionEngine/JIT/MacOSJITEventListener.cpp b/llvm/lib/ExecutionEngine/JIT/MacOSJITEventListener.cpp index 3b8b84ce5bcb..53585b877b19 100644 --- a/llvm/lib/ExecutionEngine/JIT/MacOSJITEventListener.cpp +++ b/llvm/lib/ExecutionEngine/JIT/MacOSJITEventListener.cpp @@ -84,8 +84,7 @@ JITEventListener *createMacOSJITEventListener() { void MacOSJITEventListener::NotifyFunctionEmitted( const Function &F, void *FnStart, size_t FnSize, const EmittedFunctionDetails &) { - const char *const FnName = F.getNameStart(); - assert(FnName != 0 && FnStart != 0 && "Bad symbol to add"); + assert(F.hasName() && FnStart != 0 && "Bad symbol to add"); JITSymbolTable **SymTabPtrPtr = 0; SymTabPtrPtr = &__jitSymbolTable; @@ -120,7 +119,7 @@ void MacOSJITEventListener::NotifyFunctionEmitted( // Otherwise, we have enough space, just tack it onto the end of the array. JITSymbolEntry &Entry = SymTabPtr->Symbols[SymTabPtr->NumSymbols]; - Entry.FnName = strdup(FnName); + Entry.FnName = strdup(F.getName().data()); Entry.FnStart = FnStart; Entry.FnSize = FnSize; ++SymTabPtr->NumSymbols; diff --git a/llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp b/llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp index 888d83e0f296..71502e927cd7 100644 --- a/llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp +++ b/llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp @@ -107,13 +107,13 @@ static debug_line_info LineStartToOProfileFormat( void OProfileJITEventListener::NotifyFunctionEmitted( const Function &F, void *FnStart, size_t FnSize, const EmittedFunctionDetails &Details) { - const char *const FnName = F.getNameStart(); - assert(FnName != 0 && FnStart != 0 && "Bad symbol to add"); - if (op_write_native_code(Agent, FnName, + assert(F.hasName() && FnStart != 0 && "Bad symbol to add"); + if (op_write_native_code(Agent, F.getName().data(), reinterpret_cast(FnStart), FnStart, FnSize) == -1) { - DOUT << "Failed to tell OProfile about native function " << FnName - << " at [" << FnStart << "-" << ((char*)FnStart + FnSize) << "]\n"; + DEBUG(errs() << "Failed to tell OProfile about native function " + << Fn.getName() << " at [" + << FnStart << "-" << ((char*)FnStart + FnSize) << "]\n"); return; } @@ -139,9 +139,10 @@ void OProfileJITEventListener::NotifyFunctionEmitted( if (!LineInfo.empty()) { if (op_write_debug_line_info(Agent, FnStart, LineInfo.size(), &*LineInfo.begin()) == -1) { - DOUT << "Failed to tell OProfile about line numbers for native function " - << FnName << " at [" << FnStart << "-" << ((char*)FnStart + FnSize) - << "]\n"; + DEBUG(errs() + << "Failed to tell OProfile about line numbers for native function " + << F.getName() << " at [" + << FnStart << "-" << ((char*)FnStart + FnSize) << "]\n"); } } } diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp index 188cdbfdbf65..63210487c8e3 100644 --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -620,8 +620,8 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) { NewRetIdxs[i] = RetTypes.size() - 1; } else { ++NumRetValsEliminated; - DOUT << "DAE - Removing return value " << i << " from " - << F->getNameStart() << "\n"; + DEBUG(errs() << "DAE - Removing return value " << i << " from " + << F->getName() << "\n"); } } else @@ -630,8 +630,8 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) { RetTypes.push_back(RetTy); NewRetIdxs[0] = 0; } else { - DOUT << "DAE - Removing return value from " << F->getNameStart() - << "\n"; + DEBUG(errs() << "DAE - Removing return value from " << F->getName() + << "\n"); ++NumRetValsEliminated; } if (RetTypes.size() > 1) @@ -685,8 +685,8 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) { AttributesVec.push_back(AttributeWithIndex::get(Params.size(), Attrs)); } else { ++NumArgumentsEliminated; - DOUT << "DAE - Removing argument " << i << " (" << I->getNameStart() - << ") from " << F->getNameStart() << "\n"; + DEBUG(errs() << "DAE - Removing argument " << i << " (" << I->getName() + << ") from " << F->getName() << "\n"); } } diff --git a/llvm/lib/Transforms/IPO/StripSymbols.cpp b/llvm/lib/Transforms/IPO/StripSymbols.cpp index d584a906c571..f2b561da80a6 100644 --- a/llvm/lib/Transforms/IPO/StripSymbols.cpp +++ b/llvm/lib/Transforms/IPO/StripSymbols.cpp @@ -139,7 +139,7 @@ static void StripSymtab(ValueSymbolTable &ST, bool PreserveDbgInfo) { Value *V = VI->getValue(); ++VI; if (!isa(V) || cast(V)->hasLocalLinkage()) { - if (!PreserveDbgInfo || strncmp(V->getNameStart(), "llvm.dbg", 8)) + if (!PreserveDbgInfo || !V->getName().startswith("llvm.dbg")) // Set name to "", removing from symbol table! V->setName(""); } @@ -181,13 +181,13 @@ bool StripSymbolNames(Module &M, bool PreserveDbgInfo) { for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { if (I->hasLocalLinkage() && llvmUsedValues.count(I) == 0) - if (!PreserveDbgInfo || strncmp(I->getNameStart(), "llvm.dbg", 8)) + if (!PreserveDbgInfo || !I->getName().startswith("llvm.dbg")) I->setName(""); // Internal symbols can't participate in linkage } for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { if (I->hasLocalLinkage() && llvmUsedValues.count(I) == 0) - if (!PreserveDbgInfo || strncmp(I->getNameStart(), "llvm.dbg", 8)) + if (!PreserveDbgInfo || !I->getName().startswith("llvm.dbg")) I->setName(""); // Internal symbols can't participate in linkage StripSymtab(I->getValueSymbolTable(), PreserveDbgInfo); } @@ -231,7 +231,7 @@ bool StripDebugInfo(Module &M) { GlobalVariable *GV = dyn_cast(I); if (!GV) continue; if (!GV->use_empty() && llvmUsedValues.count(I) == 0) { - if (strncmp(GV->getNameStart(), "llvm.dbg", 8) == 0) { + if (GV->getName().startswith("llvm.dbg")) { GV->replaceAllUsesWith(M.getContext().getUndef(GV->getType())); } } @@ -410,8 +410,7 @@ bool StripDebugDeclare::runOnModule(Module &M) { I != E; ++I) { GlobalVariable *GV = dyn_cast(I); if (!GV) continue; - if (GV->use_empty() && GV->hasName() - && strncmp(GV->getNameStart(), "llvm.dbg.global_variable", 24) == 0) + if (GV->use_empty() && GV->getName().startswith("llvm.dbg.global_variable")) DeadConstants.push_back(GV); } diff --git a/llvm/lib/Transforms/IPO/StructRetPromotion.cpp b/llvm/lib/Transforms/IPO/StructRetPromotion.cpp index d55e3cce8829..8d6671dbb781 100644 --- a/llvm/lib/Transforms/IPO/StructRetPromotion.cpp +++ b/llvm/lib/Transforms/IPO/StructRetPromotion.cpp @@ -35,6 +35,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; STATISTIC(NumRejectedSRETUses , "Number of sret rejected due to unexpected uses"); @@ -90,7 +91,8 @@ bool SRETPromotion::PromoteReturn(CallGraphNode *CGN) { if (F->arg_size() == 0 || !F->hasStructRetAttr() || F->doesNotReturn()) return false; - DOUT << "SretPromotion: Looking at sret function " << F->getNameStart() << "\n"; + DEBUG(errs() << "SretPromotion: Looking at sret function " + << F->getName() << "\n"); assert (F->getReturnType() == Type::VoidTy && "Invalid function return type"); Function::arg_iterator AI = F->arg_begin(); diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index 1b650ec6dd64..a4b7da23d41b 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -733,7 +733,7 @@ void IndVarSimplify::HandleFloatingPointIV(Loop *L, PHINode *PH) { Value *LHS = (EVIndex == 1 ? NewPHI->getIncomingValue(1) : NewEV); Value *RHS = (EVIndex == 1 ? NewEV : NewPHI->getIncomingValue(1)); ICmpInst *NewEC = new ICmpInst(EC->getParent()->getTerminator(), - NewPred, LHS, RHS, EC->getNameStart()); + NewPred, LHS, RHS, EC->getName()); // In the following deltions, PH may become dead and may be deleted. // Use a WeakVH to observe whether this happens. diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 99c32ea59352..15daf3efb4a1 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -5537,7 +5537,7 @@ static Value *EvaluateGEPOffsetExpression(User *GEP, Instruction &I, // computation crosses zero. if (VariableIdx->getType()->getPrimitiveSizeInBits() > IntPtrWidth) VariableIdx = new TruncInst(VariableIdx, TD.getIntPtrType(), - VariableIdx->getNameStart(), &I); + VariableIdx->getName(), &I); return VariableIdx; } @@ -5561,7 +5561,7 @@ static Value *EvaluateGEPOffsetExpression(User *GEP, Instruction &I, if (VariableIdx->getType() != IntPtrTy) VariableIdx = CastInst::CreateIntegerCast(VariableIdx, IntPtrTy, true /*SExt*/, - VariableIdx->getNameStart(), &I); + VariableIdx->getName(), &I); Constant *OffsetVal = ConstantInt::get(IntPtrTy, NewOffs); return BinaryOperator::CreateAdd(VariableIdx, OffsetVal, "offset", &I); } diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index 9f8cce53ba66..a2925a6e5862 100644 --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp @@ -858,7 +858,7 @@ bool JumpThreading::ProcessBranchOnCompare(CmpInst *Cmp, BasicBlock *BB) { // See if the cost of duplicating this block is low enough. unsigned JumpThreadCost = getJumpThreadDuplicationCost(BB); if (JumpThreadCost > Threshold) { - DEBUG(errs() << " Not threading BB '" << BB->getNameStart() + DEBUG(errs() << " Not threading BB '" << BB->getName() << "' - Cost is too high: " << JumpThreadCost << "\n"); return false; } @@ -900,7 +900,7 @@ bool JumpThreading::ThreadEdge(BasicBlock *BB, BasicBlock *PredBB, // And finally, do it! DEBUG(errs() << " Threading edge from '" << PredBB->getName() << "' to '" - << SuccBB->getNameStart() << "' with cost: " << JumpThreadCost + << SuccBB->getName() << "' with cost: " << JumpThreadCost << ", across block:\n " << *BB << "\n"); @@ -933,7 +933,7 @@ bool JumpThreading::ThreadEdge(BasicBlock *BB, BasicBlock *PredBB, // mapping and using it to remap operands in the cloned instructions. for (; !isa(BI); ++BI) { Instruction *New = BI->clone(BI->getContext()); - New->setName(BI->getNameStart()); + New->setName(BI->getName()); NewBB->getInstList().push_back(New); ValueMapping[BI] = New; diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 4a6fe575f313..82ca81acc4b6 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -41,6 +41,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ValueHandle.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetLowering.h" #include using namespace llvm; @@ -2523,11 +2524,9 @@ bool LoopStrengthReduce::runOnLoop(Loop *L, LPPassManager &LPM) { Changed = false; if (!IU->IVUsesByStride.empty()) { -#ifndef NDEBUG - DOUT << "\nLSR on \"" << L->getHeader()->getParent()->getNameStart() - << "\" "; - DEBUG(L->dump()); -#endif + DEBUG(errs() << "\nLSR on \"" << L->getHeader()->getParent()->getName() + << "\" "; + L->dump()); // Sort the StrideOrder so we process larger strides first. std::stable_sort(IU->StrideOrder.begin(), IU->StrideOrder.end(), diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp index d93aaa262afa..f63a912d6ca1 100644 --- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -442,7 +442,7 @@ bool MemCpyOpt::processStore(StoreInst *SI, BasicBlock::iterator& BBI) { // Cast the start ptr to be i8* as memset requires. const Type *i8Ptr = SI->getContext().getPointerTypeUnqual(Type::Int8Ty); if (StartPtr->getType() != i8Ptr) - StartPtr = new BitCastInst(StartPtr, i8Ptr, StartPtr->getNameStart(), + StartPtr = new BitCastInst(StartPtr, i8Ptr, StartPtr->getName(), InsertPt); Value *Ops[] = { diff --git a/llvm/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp b/llvm/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp index 80eac87875dd..fb3d62e7adc7 100644 --- a/llvm/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp +++ b/llvm/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp @@ -135,8 +135,7 @@ bool SimplifyHalfPowrLibCalls::runOnFunction(Function &F) { Function *Callee = CI->getCalledFunction(); if (Callee && Callee->hasExternalLinkage()) { // Look for calls with well-known names. - const char *CalleeName = Callee->getNameStart(); - if (strcmp(CalleeName, "__half_powrf4") == 0) + if (Callee->getName() == "__half_powrf4") IsHalfPowr = true; } } diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index e66b8eba1ca2..b0643d60965a 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -86,8 +86,8 @@ static void AddPredecessorToBlock(BasicBlock *Succ, BasicBlock *NewPred, static bool CanPropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) { assert(*succ_begin(BB) == Succ && "Succ is not successor of BB!"); - DOUT << "Looking to fold " << BB->getNameStart() << " into " - << Succ->getNameStart() << "\n"; + DEBUG(errs() << "Looking to fold " << BB->getName() << " into " + << Succ->getName() << "\n"); // Shortcut, if there is only a single predecessor it must be BB and merging // is always safe if (Succ->getSinglePredecessor()) return true; @@ -128,10 +128,10 @@ static bool CanPropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) { PI != PE; PI++) { if (BBPN->getIncomingValueForBlock(*PI) != PN->getIncomingValueForBlock(*PI)) { - DOUT << "Can't fold, phi node " << *PN->getNameStart() << " in " - << Succ->getNameStart() << " is conflicting with " - << BBPN->getNameStart() << " with regard to common predecessor " - << (*PI)->getNameStart() << "\n"; + DEBUG(errs() << "Can't fold, phi node " << PN->getName() << " in " + << Succ->getName() << " is conflicting with " + << BBPN->getName() << " with regard to common predecessor " + << (*PI)->getName() << "\n"); return false; } } @@ -146,9 +146,9 @@ static bool CanPropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) { // one for BB, in which case this phi node will not prevent the merging // of the block. if (Val != PN->getIncomingValueForBlock(*PI)) { - DOUT << "Can't fold, phi node " << *PN->getNameStart() << " in " - << Succ->getNameStart() << " is conflicting with regard to common " - << "predecessor " << (*PI)->getNameStart() << "\n"; + DEBUG(errs() << "Can't fold, phi node " << PN->getName() << " in " + << Succ->getName() << " is conflicting with regard to common " + << "predecessor " << (*PI)->getName() << "\n"); return false; } } @@ -166,9 +166,9 @@ static bool CanPropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) { for (BlockSet::iterator PI = CommonPreds.begin(), PE = CommonPreds.end(); PI != PE; PI++) if (PN->getIncomingValueForBlock(*PI) != PN) { - DOUT << "Can't fold, phi node " << *PN->getNameStart() << " in " - << BB->getNameStart() << " is conflicting with regard to common " - << "predecessor " << (*PI)->getNameStart() << "\n"; + DEBUG(errs() << "Can't fold, phi node " << PN->getName() << " in " + << BB->getName() << " is conflicting with regard to common " + << "predecessor " << (*PI)->getName() << "\n"); return false; } } diff --git a/llvm/tools/lto/LTOModule.cpp b/llvm/tools/lto/LTOModule.cpp index 83dda0cdc6f1..9968d488ff46 100644 --- a/llvm/tools/lto/LTOModule.cpp +++ b/llvm/tools/lto/LTOModule.cpp @@ -327,7 +327,7 @@ void LTOModule::addDefinedSymbol(GlobalValue* def, Mangler &mangler, bool isFunction) { // ignore all llvm.* symbols - if ( strncmp(def->getNameStart(), "llvm.", 5) == 0 ) + if (def->getName().startswith("llvm.")) return; // string is owned by _defines @@ -397,7 +397,7 @@ void LTOModule::addAsmGlobalSymbol(const char *name) { void LTOModule::addPotentialUndefinedSymbol(GlobalValue* decl, Mangler &mangler) { // ignore all llvm.* symbols - if ( strncmp(decl->getNameStart(), "llvm.", 5) == 0 ) + if (decl->getName().startswith("llvm.")) return; // ignore all aliases