[PATCH] D120124: [LegacyPassManager] Check Changed status returned by MachineFunctionPasses
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 18 05:48:56 PST 2022
foad created this revision.
foad added reviewers: serge-sans-paille, piotr, nikic, jdoerfert.
Herald added a subscriber: hiraditya.
foad requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
With EXPENSIVE_CHECKS, hash MachineFunctions before and
after running each MachineFunctionPass to detect passes
which modify the MachineFunction but return Changed = false.
FIXME: This causes thousands of failures in the lit test
suite.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D120124
Files:
llvm/include/llvm/CodeGen/MachineFunctionPass.h
llvm/lib/CodeGen/MachineFunctionPass.cpp
Index: llvm/lib/CodeGen/MachineFunctionPass.cpp
===================================================================
--- llvm/lib/CodeGen/MachineFunctionPass.cpp
+++ llvm/lib/CodeGen/MachineFunctionPass.cpp
@@ -22,10 +22,15 @@
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"
+#include "llvm/CodeGen/MachineStableHash.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
+#ifdef EXPENSIVE_CHECKS
+#include "llvm/IR/StructuralHash.h"
+#endif
+
using namespace llvm;
using namespace ore;
@@ -121,3 +126,14 @@
FunctionPass::getAnalysisUsage(AU);
}
+
+#ifdef EXPENSIVE_CHECKS
+uint64_t MachineFunctionPass::structuralHash(Function &F) const {
+ uint64_t Hash = StructuralHash(F);
+ MachineModuleInfo &MMI = getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
+ MachineFunction *MF = MMI.getMachineFunction(F);
+ if (MF)
+ Hash = stable_hash_combine(Hash, stableHashValue(*MF));
+ return Hash;
+}
+#endif
Index: llvm/include/llvm/CodeGen/MachineFunctionPass.h
===================================================================
--- llvm/include/llvm/CodeGen/MachineFunctionPass.h
+++ llvm/include/llvm/CodeGen/MachineFunctionPass.h
@@ -73,6 +73,10 @@
const std::string &Banner) const override;
bool runOnFunction(Function &F) override;
+
+#ifdef EXPENSIVE_CHECKS
+ uint64_t structuralHash(Function &F) const override;
+#endif
};
} // End llvm namespace
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120124.409913.patch
Type: text/x-patch
Size: 1553 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220218/fff3caf1/attachment.bin>
More information about the llvm-commits
mailing list