Avoid unnecessary copying of map data during visitation
PiperOrigin-RevId: 158141962
This commit is contained in:
parent
2e7e1d57bd
commit
9184726ed0
@ -236,10 +236,8 @@ llvm::Value* IrArray::EmitReadArrayElement(const Index& index,
|
|||||||
llvm::LoadInst* load = ir_builder->CreateLoad(element_address);
|
llvm::LoadInst* load = ir_builder->CreateLoad(element_address);
|
||||||
llvm_ir::SetTbaaForInstruction(load, GetShape(),
|
llvm_ir::SetTbaaForInstruction(load, GetShape(),
|
||||||
/*is_pointer_to=*/false);
|
/*is_pointer_to=*/false);
|
||||||
for (const std::pair<int, llvm::MDNode*>& kind_md_pair : metadata_) {
|
for (const auto& kind_md_pair : metadata_) {
|
||||||
int kind = kind_md_pair.first;
|
load->setMetadata(kind_md_pair.first, kind_md_pair.second);
|
||||||
llvm::MDNode* md = kind_md_pair.second;
|
|
||||||
load->setMetadata(kind, md);
|
|
||||||
}
|
}
|
||||||
return load;
|
return load;
|
||||||
}
|
}
|
||||||
@ -250,11 +248,9 @@ void IrArray::EmitWriteArrayElement(const Index& index, llvm::Value* value,
|
|||||||
llvm::StoreInst* store = ir_builder->CreateStore(value, element_address);
|
llvm::StoreInst* store = ir_builder->CreateStore(value, element_address);
|
||||||
llvm_ir::SetTbaaForInstruction(store, GetShape(),
|
llvm_ir::SetTbaaForInstruction(store, GetShape(),
|
||||||
/*is_pointer_to=*/false);
|
/*is_pointer_to=*/false);
|
||||||
for (const std::pair<int, llvm::MDNode*>& kind_md_pair : metadata_) {
|
for (const auto& kind_md_pair : metadata_) {
|
||||||
int kind = kind_md_pair.first;
|
CHECK_NE(kind_md_pair.first, llvm::LLVMContext::MD_invariant_load);
|
||||||
CHECK_NE(kind, llvm::LLVMContext::MD_invariant_load);
|
store->setMetadata(kind_md_pair.first, kind_md_pair.second);
|
||||||
llvm::MDNode* md = kind_md_pair.second;
|
|
||||||
store->setMetadata(kind, md);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user