[PATCH] D154119: Fix: Distinguish CFI Metadata Checks in MergeFunctions Pass

Oskar Wirga via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 30 17:40:54 PDT 2023


oskarwirga added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/FunctionComparator.cpp:858
+          auto *MDR = cast<MetadataAsValue>(OpR);
+          if (MDL->getMetadata() != MDR->getMetadata())
+            return -1;
----------------
smeenai wrote:
> Is it correct to just check for pointer equality here? https://llvm.org/docs/LangRef.html#metadata mentions `!unique` for avoiding content-baed metadata merging, but it wasn't clear if that merging would otherwise always take place.
Yeah you know what maybe what we need to do is add !unique to type test metadata checks because this is too broad and its failing to merge functions with differing debug metadata. We need some way to prevent the CFI metadata as part of the cfi checks from getting merged but we need identical debug metadata (and perhaps other metadata) to get merged. 


================
Comment at: llvm/test/Transforms/MergeFunc/cfi-function-merging.ll:40
+!21 = !{i64 16, !22}
+!22 = distinct !{}
+!47 = !{}
----------------
@smeenai  @nikic This metadata is pretty generic and I am not entirely sure how CFI knows to populate it later with the correct vtable entry


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154119/new/

https://reviews.llvm.org/D154119



More information about the llvm-commits mailing list