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) { _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits