From f0e1053a63f5522ecfe1df8fe3ea07b24cb6b193 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 31 Jan 2012 05:09:17 +0000 Subject: remove the last vestiges of llvm::GetConstantStringInfo, in CodeGen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149356 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ValueTracking.cpp | 10 ---------- lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 11 ++++------- 2 files changed, 4 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index d51d7f20ca..4c18bdf1e5 100644 --- a/lib/Analysis/ValueTracking.cpp +++ b/lib/Analysis/ValueTracking.cpp @@ -1603,16 +1603,6 @@ Value *llvm::GetPointerBaseWithConstantOffset(Value *Ptr, int64_t &Offset, } -// FIXME: Remove this. -bool llvm::GetConstantStringInfo(const Value *V, std::string &Str, - uint64_t Offset) { - StringRef Tmp; - if (!getConstantStringInfo(V, Tmp, Offset)) - return false; - Str = Tmp.str(); - return true; -} - /// getConstantStringInfo - This function computes the length of a /// null-terminated C string pointed to by V. If successful, it returns true /// and returns the string in Str. If unsuccessful, it returns false. diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 6b6f7bf10d..fe1a86131c 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -3299,7 +3299,7 @@ static SDValue getMemsetValue(SDValue Value, EVT VT, SelectionDAG &DAG, /// string ptr. static SDValue getMemsetStringVal(EVT VT, DebugLoc dl, SelectionDAG &DAG, const TargetLowering &TLI, - std::string &Str, unsigned Offset) { + StringRef Str, unsigned Offset) { // Handle vector with all elements zero. if (Str.empty()) { if (VT.isInteger()) @@ -3343,7 +3343,7 @@ static SDValue getMemBasePlusOffset(SDValue Base, unsigned Offset, /// isMemSrcFromString - Returns true if memcpy source is a string constant. /// -static bool isMemSrcFromString(SDValue Src, std::string &Str) { +static bool isMemSrcFromString(SDValue Src, StringRef &Str) { unsigned SrcDelta = 0; GlobalAddressSDNode *G = NULL; if (Src.getOpcode() == ISD::GlobalAddress) @@ -3358,11 +3358,8 @@ static bool isMemSrcFromString(SDValue Src, std::string &Str) { return false; if (const GlobalVariable *GV = dyn_cast(G->getGlobal())) - if (GetConstantStringInfo(GV, Str, SrcDelta)) { - // The nul can also be read. - Str.push_back(0); + if (getConstantStringInfo(GV, Str, SrcDelta)) return true; - } return false; } @@ -3467,7 +3464,7 @@ static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, DebugLoc dl, unsigned SrcAlign = DAG.InferPtrAlignment(Src); if (Align > SrcAlign) SrcAlign = Align; - std::string Str; + StringRef Str; bool CopyFromStr = isMemSrcFromString(Src, Str); bool isZeroStr = CopyFromStr && Str.empty(); unsigned Limit = AlwaysInline ? ~0U : TLI.getMaxStoresPerMemcpy(OptSize); -- cgit v1.2.3-18-g5258