summaryrefslogtreecommitdiff
path: root/lib/Bitcode
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 /lib/Bitcode
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 'lib/Bitcode')
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp26
-rw-r--r--lib/Bitcode/Writer/ValueEnumerator.cpp4
2 files changed, 0 insertions, 30 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index 81d5720126..475bb526f9 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -845,32 +845,6 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal,
} else {
assert (0 && "Unknown FP type!");
}
- } else if (isa<ConstantArray>(C) && cast<ConstantArray>(C)->isString()) {
- const ConstantArray *CA = cast<ConstantArray>(C);
- // Emit constant strings specially.
- unsigned NumOps = CA->getNumOperands();
- // If this is a null-terminated string, use the denser CSTRING encoding.
- if (CA->getOperand(NumOps-1)->isNullValue()) {
- Code = bitc::CST_CODE_CSTRING;
- --NumOps; // Don't encode the null, which isn't allowed by char6.
- } else {
- Code = bitc::CST_CODE_STRING;
- AbbrevToUse = String8Abbrev;
- }
- bool isCStr7 = Code == bitc::CST_CODE_CSTRING;
- bool isCStrChar6 = Code == bitc::CST_CODE_CSTRING;
- for (unsigned i = 0; i != NumOps; ++i) {
- unsigned char V = cast<ConstantInt>(CA->getOperand(i))->getZExtValue();
- Record.push_back(V);
- isCStr7 &= (V & 128) == 0;
- if (isCStrChar6)
- isCStrChar6 = BitCodeAbbrevOp::isChar6(V);
- }
-
- if (isCStrChar6)
- AbbrevToUse = CString6Abbrev;
- else if (isCStr7)
- AbbrevToUse = CString7Abbrev;
} else if (isa<ConstantDataSequential>(C) &&
cast<ConstantDataSequential>(C)->isString()) {
const ConstantDataSequential *Str = cast<ConstantDataSequential>(C);
diff --git a/lib/Bitcode/Writer/ValueEnumerator.cpp b/lib/Bitcode/Writer/ValueEnumerator.cpp
index 1c4d670b27..1ed9004eb5 100644
--- a/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -321,10 +321,6 @@ void ValueEnumerator::EnumerateValue(const Value *V) {
if (const Constant *C = dyn_cast<Constant>(V)) {
if (isa<GlobalValue>(C)) {
// Initializers for globals are handled explicitly elsewhere.
- } else if (isa<ConstantArray>(C) && cast<ConstantArray>(C)->isString()) {
- // Do not enumerate the initializers for an array of simple characters.
- // The initializers just pollute the value table, and we emit the strings
- // specially.
} else if (C->getNumOperands()) {
// If a constant has operands, enumerate them. This makes sure that if a
// constant has uses (for example an array of const ints), that they are