diff options
author | Karl Schimpf <kschimpf@google.com> | 2013-08-30 08:52:20 -0700 |
---|---|---|
committer | Karl Schimpf <kschimpf@google.com> | 2013-08-30 08:52:20 -0700 |
commit | 2302e5d39e2302962d1a0e45d60e00ed47b9b061 (patch) | |
tree | 1a121361ee62714d76c916ac4e203a091a747601 /lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp | |
parent | 215d7de42d1ada5ca44bd6bc03789b2ea81ce865 (diff) |
Remove generating STRUCT_ANON records in PNaCl bitcode files.
Don't generate types for elided cast instructions, since they
are never put into the bitcode file. In addition, do not generate
a type id for the types of global variables, because they are never
needed. Don't allow and STRUCT records in bitcode files
when PNaClVersion==2.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3648
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/23431008
Diffstat (limited to 'lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp')
-rw-r--r-- | lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp b/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp index 8cfdf13240..8e35f59909 100644 --- a/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp +++ b/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp @@ -89,6 +89,10 @@ NaClValueEnumerator::NaClValueEnumerator(const Module *M, uint32_t PNaClVersion) for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB) for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E;++I){ + // Don't generate types for elided pointer casts! + if (I == ElideCasts(I)) + continue; + for (User::const_op_iterator OI = I->op_begin(), E = I->op_end(); OI != E; ++OI) { EnumerateOperandType(*OI); @@ -356,6 +360,11 @@ void NaClValueEnumerator::EnumerateType(Type *Ty, bool InsideOptimizeTypes) { // Enumerate the types for the specified value. If the value is a constant, // walk through it, enumerating the types of the constant. void NaClValueEnumerator::EnumerateOperandType(const Value *V) { + // Note: We intentionally don't create a type id for global variables, + // since the type is automatically generated by the reader before any + // use of the global variable. + if (isa<GlobalVariable>(V)) return; + EnumerateType(V->getType()); if (const Constant *C = dyn_cast<Constant>(V)) { |