[llvm-commits] [llvm] r73220 - in /llvm/trunk: lib/Bitcode/Writer/BitcodeWriter.cpp lib/Bitcode/Writer/ValueEnumerator.cpp lib/Bitcode/Writer/ValueEnumerator.h test/Bitcode/2009-06-11-FirstClassAggregateConstant.ll
Nick Lewycky
nicholas at mxc.ca
Thu Jun 11 22:20:13 PDT 2009
Author: nicholas
Date: Fri Jun 12 00:20:12 2009
New Revision: 73220
URL: http://llvm.org/viewvc/llvm-project?rev=73220&view=rev
Log:
Don't remove aggregate-typed module level constants before encoding functions
since functions may contain aggregate constants too.
Added:
llvm/trunk/test/Bitcode/2009-06-11-FirstClassAggregateConstant.ll
Modified:
llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp
llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h
Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=73220&r1=73219&r2=73220&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Fri Jun 12 00:20:12 2009
@@ -1308,16 +1308,6 @@
// Emit constants.
WriteModuleConstants(VE, Stream);
- // If we have any aggregate values in the value table, purge them - these can
- // only be used to initialize global variables. Doing so makes the value
- // namespace smaller for code in functions.
- int NumNonAggregates = VE.PurgeAggregateValues();
- if (NumNonAggregates != -1) {
- SmallVector<unsigned, 1> Vals;
- Vals.push_back(NumNonAggregates);
- Stream.EmitRecord(bitc::MODULE_CODE_PURGEVALS, Vals);
- }
-
// Emit function bodies.
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
if (!I->isDeclaration())
Modified: llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp?rev=73220&r1=73219&r2=73220&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp Fri Jun 12 00:20:12 2009
@@ -277,22 +277,6 @@
}
-/// PurgeAggregateValues - If there are any aggregate values at the end of the
-/// value list, remove them and return the count of the remaining values. If
-/// there are none, return -1.
-int ValueEnumerator::PurgeAggregateValues() {
- // If there are no aggregate values at the end of the list, return -1.
- if (Values.empty() || Values.back().first->getType()->isSingleValueType())
- return -1;
-
- // Otherwise, remove aggregate values...
- while (!Values.empty() && !Values.back().first->getType()->isSingleValueType())
- Values.pop_back();
-
- // ... and return the new size.
- return Values.size();
-}
-
void ValueEnumerator::incorporateFunction(const Function &F) {
NumModuleValues = Values.size();
Modified: llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h?rev=73220&r1=73219&r2=73220&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h (original)
+++ llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h Fri Jun 12 00:20:12 2009
@@ -99,11 +99,6 @@
return Attributes;
}
- /// PurgeAggregateValues - If there are any aggregate values at the end of the
- /// value list, remove them and return the count of the remaining values. If
- /// there are none, return -1.
- int PurgeAggregateValues();
-
/// incorporateFunction/purgeFunction - If you'd like to deal with a function,
/// use these two methods to get its data into the ValueEnumerator!
///
Added: llvm/trunk/test/Bitcode/2009-06-11-FirstClassAggregateConstant.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/2009-06-11-FirstClassAggregateConstant.ll?rev=73220&view=auto
==============================================================================
--- llvm/trunk/test/Bitcode/2009-06-11-FirstClassAggregateConstant.ll (added)
+++ llvm/trunk/test/Bitcode/2009-06-11-FirstClassAggregateConstant.ll Fri Jun 12 00:20:12 2009
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llvm-dis -disable-output
+; PR4373
+
+ at foo = weak global { i32 } zeroinitializer
+ at bar = weak global i32 0
+
+define void @test() {
+entry:
+ store { i32 } zeroinitializer, { i32 }* @foo
+ store i32 1, i32* @bar
+ ret void
+}
More information about the llvm-commits
mailing list