aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp')
-rw-r--r--lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp9
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)) {