[LLVMdev] Puzzles on DenseMap
maxs
xtxwy.ustc at gmail.com
Sun Aug 25 05:09:13 PDT 2013
I wrote some program using DensMap like this:
===============================
SmallDenseMap<Value*, StringRef, 4> OpResult;
Value *VP = GEP->getPointerOperand();
OpResult[VP] = parseVariable(VP);
for(User::op_iterator sId = GEP->idx_begin(), eId = GEP->idx_end(); sId
!= eId; ++sId) {
Value *VI = *sId;
if(dyn_cast<ConstantInt>(*sId)) OpResult[VI] = parseConstant(VI);
else OpResult[VI] = parseVariable(VI);
}
....
===============================
When I visit OpResult like this:
=====================
std::string result = OpResult[VP];
=====================
And this statement changes the other data in DenseMap. Why?
More information about the llvm-dev
mailing list