diff options
author | Chris Lattner <sabre@nondot.org> | 2012-02-05 02:29:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2012-02-05 02:29:43 +0000 |
commit | 18c7f80b3e83ab584bd8572695a3cde8bafd9d3c (patch) | |
tree | 93b57cd1b5fb8fa1e48c06e4bef7571f02603243 /tools | |
parent | eea723fe02edba0a1215fa235ba425ae93202dc9 (diff) | |
download | llvm-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 'tools')
-rw-r--r-- | tools/bugpoint/Miscompilation.cpp | 3 | ||||
-rw-r--r-- | tools/lto/LTOModule.cpp | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index 7ff16dbf95..82a3a862a2 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -820,7 +820,8 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, // Don't forward functions which are external in the test module too. if (TestFn && !TestFn->isDeclaration()) { // 1. Add a string constant with its name to the global file - Constant *InitArray = ConstantArray::get(F->getContext(), F->getName()); + Constant *InitArray = + ConstantDataArray::getString(F->getContext(), F->getName()); GlobalVariable *funcName = new GlobalVariable(*Safe, InitArray->getType(), true /*isConstant*/, GlobalValue::InternalLinkage, InitArray, diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp index af5a0a66f5..8ce8cd2f1a 100644 --- a/tools/lto/LTOModule.cpp +++ b/tools/lto/LTOModule.cpp @@ -190,9 +190,9 @@ bool LTOModule::objcClassNameFromExpression(Constant *c, std::string &name) { Constant *op = ce->getOperand(0); if (GlobalVariable *gvn = dyn_cast<GlobalVariable>(op)) { Constant *cn = gvn->getInitializer(); - if (ConstantArray *ca = dyn_cast<ConstantArray>(cn)) { + if (ConstantDataArray *ca = dyn_cast<ConstantDataArray>(cn)) { if (ca->isCString()) { - name = ".objc_class_name_" + ca->getAsCString(); + name = ".objc_class_name_" + ca->getAsCString().str(); return true; } } |