summaryrefslogtreecommitdiff
path: root/tools/bugpoint-passes
diff options
context:
space:
mode:
authorJF Bastien <jfb@google.com>2015-04-20 23:42:22 +0000
committerJF Bastien <jfb@google.com>2015-04-20 23:42:22 +0000
commit7b862ec88e743a6f5f28b143d5a37eff00865451 (patch)
treeadcaf910f3068a995844c171aae9b49fcc4eff30 /tools/bugpoint-passes
parentaf337cd20ed59f01f118e685ac6fd48b93604e34 (diff)
bugpoint Enhancement.
Summary: This patch adds two flags to `bugpoint`: "-replace-funcs-with-null" and "-disable-pass-list-reduction". When "-replace-funcs-with-null" is specified, bugpoint will, instead of simply deleting function bodies, replace all uses of functions and then will delete functions completely from the test module, correctly handling aliasing and @llvm.used && @llvm.compiler.used. This part was conceived while trying to debug the PNaCl IR simplification passes, which don't allow undefined functions (ie no declarations). With "-disable-pass-list-reduction", bugpoint won't try to reduce the set of passes causing the "crash". This is needed in cases where one is trying to debug an issue inside the PNaCl IR simplification passes which is causing an PNaCl ABI verification error, for example. Reviewers: jfb Reviewed By: jfb Subscribers: jfb, llvm-commits Differential Revision: http://reviews.llvm.org/D8555 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235362 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint-passes')
-rw-r--r--tools/bugpoint-passes/TestPasses.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/tools/bugpoint-passes/TestPasses.cpp b/tools/bugpoint-passes/TestPasses.cpp
index ed54e9f8dfc..6979d0345ee 100644
--- a/tools/bugpoint-passes/TestPasses.cpp
+++ b/tools/bugpoint-passes/TestPasses.cpp
@@ -68,8 +68,32 @@ namespace {
}
};
}
-
+
char DeleteCalls::ID = 0;
static RegisterPass<DeleteCalls>
Y("bugpoint-deletecalls",
"BugPoint Test Pass - Intentionally 'misoptimize' CallInsts");
+
+namespace {
+ /// CrashOnDeclFunc - This pass is used to test bugpoint. It intentionally
+ /// crash if the module has an undefined function (ie a function that is
+ /// defined in an external module).
+ class CrashOnDeclFunc : public ModulePass {
+ public:
+ static char ID; // Pass ID, replacement for typeid
+ CrashOnDeclFunc() : ModulePass(ID) {}
+ private:
+ bool runOnModule(Module &M) override {
+ for (auto &F : M.functions()) {
+ if (F.isDeclaration())
+ abort();
+ }
+ return false;
+ }
+ };
+}
+
+char CrashOnDeclFunc::ID = 0;
+static RegisterPass<CrashOnDeclFunc>
+ Z("bugpoint-crash-decl-funcs",
+ "BugPoint Test Pass - Intentionally crash on declared functions");