[llvm-commits] [llvm] r149356 - in /llvm/trunk: include/llvm/Analysis/ValueTracking.h lib/Analysis/ValueTracking.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Chris Lattner sabre at nondot.org
Mon Jan 30 21:09:17 PST 2012


Author: lattner
Date: Mon Jan 30 23:09:17 2012
New Revision: 149356

URL: http://llvm.org/viewvc/llvm-project?rev=149356&view=rev
Log:
remove the last vestiges of llvm::GetConstantStringInfo, in CodeGen.

Modified:
    llvm/trunk/include/llvm/Analysis/ValueTracking.h
    llvm/trunk/lib/Analysis/ValueTracking.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Modified: llvm/trunk/include/llvm/Analysis/ValueTracking.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ValueTracking.h?rev=149356&r1=149355&r2=149356&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ValueTracking.h (original)
+++ llvm/trunk/include/llvm/Analysis/ValueTracking.h Mon Jan 30 23:09:17 2012
@@ -132,8 +132,8 @@
                              uint64_t Offset = 0);
 
   // FIXME: Remove this.
-  bool GetConstantStringInfo(const Value *V, std::string &Str,
-                             uint64_t Offset = 0);
+ // bool GetConstantStringInfo(const Value *V, std::string &Str,
+ //                            uint64_t Offset = 0);
 
   /// GetStringLength - If we can compute the length of the string pointed to by
   /// the specified pointer, return 'len+1'.  If we can't, return 0.

Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=149356&r1=149355&r2=149356&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Mon Jan 30 23:09:17 2012
@@ -1603,16 +1603,6 @@
 }
 
 
-// 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.

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=149356&r1=149355&r2=149356&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jan 30 23:09:17 2012
@@ -3299,7 +3299,7 @@
 /// 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 @@
 
 /// 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 @@
     return false;
 
   if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(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 @@
   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);





More information about the llvm-commits mailing list