[llvm-commits] [124167] refactor
clattner at apple.com
clattner at apple.com
Wed Feb 21 20:26:08 PST 2007
Revision: 124167
Author: clattner
Date: 2007-02-21 20:26:05 -0800 (Wed, 21 Feb 2007)
Log Message:
-----------
refactor
Modified Paths:
--------------
apple-local/branches/llvm/gcc/llvm-convert.cpp
Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-02-22 03:28:53 UTC (rev 124166)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-02-22 04:26:05 UTC (rev 124167)
@@ -5233,18 +5233,23 @@
// Support -fwritable-strings.
bool StringIsConstant = !flag_writable_strings;
+ GlobalVariable **SlotP = 0;
+
if (StringIsConstant) {
// Cache the string constants to avoid making obvious duplicate strings that
// have to be folded by the optimizer.
static std::map<Constant*, GlobalVariable*> StringCSTCache;
GlobalVariable *&Slot = StringCSTCache[Init];
if (Slot) return Slot;
+ SlotP = &Slot;
}
// Create a new string global.
- return Slot = new GlobalVariable(Init->getType(), StringIsConstant,
- GlobalVariable::InternalLinkage,
- Init, "str", TheModule);
+ GlobalVariable *GV = new GlobalVariable(Init->getType(), StringIsConstant,
+ GlobalVariable::InternalLinkage,
+ Init, "str", TheModule);
+ if (SlotP) *SlotP = GV;
+ return GV;
}
Constant *TreeConstantToLLVM::EmitLV_ARRAY_REF(tree exp) {
More information about the llvm-commits
mailing list