[llvm] Fix: Distinguish CFI Metadata Checks in MergeFunctions Pass (PR #65963)
Oskar Wirga via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 21 11:27:25 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.
+static bool hasDistinctMetadataIntrinsic(const Function &F) {
+ for (const BasicBlock &BB : F) {
+ for (const Instruction &I : BB.instructionsWithoutDebug()) {
+ if (!isa<IntrinsicInst>(&I))
+ continue; // Only intrinsics can reference metadata.
+
+ // Iterate through operands, and return true if you find a distinct
+ // metadata operand.
+ for (unsigned i = 0, e = I.getNumOperands(); i != e;
+ ++i) { // Replaced InstLIt with I
+ MetadataAsValue *MDL = dyn_cast<MetadataAsValue>(
+ I.getOperand(i)); // Replaced InstLIt with I
----------------
oskarwirga wrote:
I can check for specific distinct metadata as well. I will do my best to make a test for FP intrinsics.
https://github.com/llvm/llvm-project/pull/65963
More information about the llvm-commits
mailing list