Index: lib/Transforms/NaCl/FlattenGlobals.cpp |
diff --git a/lib/Transforms/NaCl/FlattenGlobals.cpp b/lib/Transforms/NaCl/FlattenGlobals.cpp |
index 6f9ceb35961d760be9676bf7641ecf902bd9ec61..dadd5195b86631b7d6b18198a9b57a1e85d104f0 100644 |
--- a/lib/Transforms/NaCl/FlattenGlobals.cpp |
+++ b/lib/Transforms/NaCl/FlattenGlobals.cpp |
@@ -136,6 +136,9 @@ static void ExpandConstant(DataLayout *DL, Constant *Val, |
SmallVector<Value *, 8> Indexes(CE->op_begin() + 1, CE->op_end()); |
*ResultOffset += DL->getIndexedOffset(CE->getOperand(0)->getType(), |
Indexes); |
+ } else if (CE->getOpcode() == Instruction::Add && |
+ isa<ConstantInt>(CE->getOperand(1))) { |
+ *ResultOffset += cast<ConstantInt>(CE->getOperand(1))->getZExtValue(); |
} else if (CE->getOpcode() == Instruction::BitCast || |
CE->getOpcode() == Instruction::IntToPtr) { |
// Nothing more to do. |