Skip to content

Revert "[Metadata] Preserve MD_prof when merging instructions when one is missing." #134200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions llvm/lib/Transforms/Utils/Local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3355,10 +3355,9 @@ static void combineMetadata(Instruction *K, const Instruction *J,
case LLVMContext::MD_invariant_group:
// Preserve !invariant.group in K.
break;
// Keep empty cases for prof, mmra, memprof, and callsite to prevent them
// from being removed as unknown metadata. The actual merging is handled
// Keep empty cases for mmra, memprof, and callsite to prevent them from
// being removed as unknown metadata. The actual merging is handled
// separately below.
case LLVMContext::MD_prof:
case LLVMContext::MD_mmra:
case LLVMContext::MD_memprof:
case LLVMContext::MD_callsite:
Expand Down Expand Up @@ -3387,6 +3386,10 @@ static void combineMetadata(Instruction *K, const Instruction *J,
if (!AAOnly)
K->setMetadata(Kind, JMD);
break;
case LLVMContext::MD_prof:
if (!AAOnly && DoesKMove)
K->setMetadata(Kind, MDNode::getMergedProfMetadata(KMD, JMD, K, J));
break;
case LLVMContext::MD_noalias_addrspace:
if (DoesKMove)
K->setMetadata(Kind,
Expand Down Expand Up @@ -3433,16 +3436,6 @@ static void combineMetadata(Instruction *K, const Instruction *J,
K->setMetadata(LLVMContext::MD_callsite,
MDNode::getMergedCallsiteMetadata(KCallSite, JCallSite));
}

// Merge prof metadata.
// Handle separately to support cases where only one instruction has the
// metadata.
auto *JProf = J->getMetadata(LLVMContext::MD_prof);
auto *KProf = K->getMetadata(LLVMContext::MD_prof);
if (!AAOnly && (JProf || KProf)) {
K->setMetadata(LLVMContext::MD_prof,
MDNode::getMergedProfMetadata(KProf, JProf, K, J));
}
}

void llvm::combineMetadataForCSE(Instruction *K, const Instruction *J,
Expand Down

This file was deleted.

This file was deleted.

Loading