================
@@ -1678,6 +1680,8 @@ void 
Instruction::dropUnknownNonDebugMetadata(ArrayRef<unsigned> KnownIDs) {
 
   // A DIAssignID attachment is debug metadata, don't drop it.
   KnownSet.insert(LLVMContext::MD_DIAssignID);
+  if (!ProfcheckDisableMetadataFixes)
+    KnownSet.insert(LLVMContext::MD_prof);
----------------
nikic wrote:

In this function we don't really know anything about what transform we're 
performing, so we can't say whether preserving the metadata is correct or not.

In dropUBImplyingAttrsAndMetadata() we know (roughly) that we are doing a 
transform that unconditionally executes a previously conditionally executed 
instruction.

Whether preserving !prof in that case is correct or not is of course also 
debatable. The metadata may only be correct under the condition it was 
previously executed, and the value distribution might be completely different 
if speculated. But I'd guess that the distribution would stay the same more 
often than not...

https://github.com/llvm/llvm-project/pull/152420
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to