mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-29 10:44:58 +01:00
Include spliced inst value in fingerprint while lowering. (#7739)
This prevents different template instantiations from getting over-eagerly merged. Unfortunately we don't have a good middle-ground yet, and this effectively disables all merging for templates. We may be able to find some smart way to fingerprint spliced instructions so that we can still merge template instantiations, but for now this change is just fixing the wrong-code bug.
This commit is contained in:
@@ -472,6 +472,21 @@ auto FunctionContext::AddTypeToCurrentFingerprint(llvm::Type* type) -> void {
|
||||
current_fingerprint_.common_fingerprint.update(os.TakeStr());
|
||||
}
|
||||
|
||||
auto FunctionContext::AddInstToCurrentFingerprint(SemIR::InstId inst_id)
|
||||
-> void {
|
||||
if (!function_fingerprint_) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Add some support for fingerprinting spliced instructions so that at
|
||||
// least in easy cases we can deduplicate templates.
|
||||
|
||||
// TODO: Replace indexes with info that is translation unit independent.
|
||||
RawStringOstream os;
|
||||
os << "inst_id" << inst_id.index << "\n";
|
||||
current_fingerprint_.common_fingerprint.update(os.TakeStr());
|
||||
}
|
||||
|
||||
auto FunctionContext::AddGlobalToCurrentFingerprint(llvm::Value* global)
|
||||
-> void {
|
||||
if (!function_fingerprint_ || !global) {
|
||||
|
||||
Reference in New Issue
Block a user