summaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/ValueTracking.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-02-05 02:29:43 +0000
committerChris Lattner <sabre@nondot.org>2012-02-05 02:29:43 +0000
commit18c7f80b3e83ab584bd8572695a3cde8bafd9d3c (patch)
tree93b57cd1b5fb8fa1e48c06e4bef7571f02603243 /include/llvm/Analysis/ValueTracking.h
parenteea723fe02edba0a1215fa235ba425ae93202dc9 (diff)
downloadllvm-18c7f80b3e83ab584bd8572695a3cde8bafd9d3c.tar.gz
llvm-18c7f80b3e83ab584bd8572695a3cde8bafd9d3c.tar.bz2
llvm-18c7f80b3e83ab584bd8572695a3cde8bafd9d3c.tar.xz
reapply the patches reverted in r149470 that reenable ConstantDataArray,
but with a critical fix to the SelectionDAG code that optimizes copies from strings into immediate stores: the previous code was stopping reading string data at the first nul. Address this by adding a new argument to llvm::getConstantStringInfo, preserving the behavior before the patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149800 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/ValueTracking.h')
-rw-r--r--include/llvm/Analysis/ValueTracking.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h
index 300f51df37..dfd774b916 100644
--- a/include/llvm/Analysis/ValueTracking.h
+++ b/include/llvm/Analysis/ValueTracking.h
@@ -17,14 +17,13 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/DataTypes.h"
-#include <string>
namespace llvm {
- template <typename T> class SmallVectorImpl;
class Value;
class Instruction;
class APInt;
class TargetData;
+ class StringRef;
/// ComputeMaskedBits - Determine which of the bits specified in Mask are
/// known to be either zero or one and return them in the KnownZero/KnownOne
@@ -125,16 +124,15 @@ namespace llvm {
return GetPointerBaseWithConstantOffset(const_cast<Value*>(Ptr), Offset,TD);
}
- /// GetConstantStringInfo - This function computes the length of a
+ /// 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. If
- /// StopAtNul is set to true (the default), the returned string is truncated
- /// by a nul character in the global. If StopAtNul is false, the nul
- /// character is included in the result string.
- bool GetConstantStringInfo(const Value *V, std::string &Str,
- uint64_t Offset = 0,
- bool StopAtNul = true);
-
+ /// and returns the string in Str. If unsuccessful, it returns false. This
+ /// does not include the trailing nul character by default. If TrimAtNul is
+ /// set to false, then this returns any trailing nul characters as well as any
+ /// other characters that come after it.
+ bool getConstantStringInfo(const Value *V, StringRef &Str,
+ uint64_t Offset = 0, bool TrimAtNul = true);
+
/// 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.
uint64_t GetStringLength(Value *V);