[llvm] Fix: Distinguish CFI Metadata Checks in MergeFunctions Pass (PR #65963)

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 21:38:57 PDT 2023


================
@@ -375,9 +375,35 @@ bool MergeFunctions::doFunctionalCheck(std::vector<WeakTrackingVH> &Worklist) {
 }
 #endif
 
+// This function iterates over two functions and compares their
+// metadata to make sure we aren't merging functions which have
+// distinct metadata that is different. We don't care about
+// debug data here, it shouldn't change MIR like CFI would.
----------------
dexonsmith wrote:

I think the "debug" thing should be commented only in the function, if at all. Note that one of debug info's primary design goals is to avoid affecting the results of optimizations (should get identical code with or without `-g`)—that's why the `instructionsWithDebug()` API exists—so it might be evident enough without a comment.

For CFI, it might be worth having a full sentence explaining the motivating llvm.type.test example? I'd also be fine with not mentioning CFI here.

https://github.com/llvm/llvm-project/pull/65963


More information about the llvm-commits mailing list