llvm.org GIT mirror llvm / 3cb9626
Move the bugpoint test passes to a plugin in preparation for having bugpoint use opt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110520 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 9 years ago
5 changed file(s) with 80 addition(s) and 78 deletion(s). Raw diff Collapse all Expand all
0 ; Test that bugpoint can narrow down the testcase to the important function
1 ; FIXME: This likely fails on windows
12 ;
2 ; RUN: bugpoint %s -output-prefix %t -bugpoint-crashcalls -silence-passes > /dev/null
3 ; RUN: bugpoint -load %llvmlibsdir/BugpointPasses.so %s -output-prefix %t -bugpoint-crashcalls -silence-passes > /dev/null
34
45 define i32 @foo() { ret i32 1 }
56
None ; RUN: bugpoint %s -output-prefix %t -bugpoint-crashcalls -silence-passes
0 ; FIXME: This likely fails on windows
1 ; RUN: bugpoint -load %llvmlibsdir/BugpointPasses.so %s -output-prefix %t -bugpoint-crashcalls -silence-passes
12 ; RUN: llvm-dis %t-reduced-simplified.bc -o - | FileCheck %s
23
34 ; Test to make sure that arguments are removed from the function if they are
1919 llc llvm-ranlib llvm-ar llvm-nm \
2020 llvm-ld llvm-prof llvm-link \
2121 lli llvm-extract llvm-mc \
22 bugpoint llvm-bcanalyzer llvm-stub \
22 bugpoint bugpoint-passes llvm-bcanalyzer llvm-stub \
2323 llvmc
2424
2525 # Let users override the set of tools to build from the command line.
+0
-75
tools/bugpoint/TestPasses.cpp less more
None //===- TestPasses.cpp - "buggy" passes used to test bugpoint --------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains "buggy" passes that are used to test bugpoint, to check
10 // that it is narrowing down testcases correctly.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "llvm/BasicBlock.h"
15 #include "llvm/Constant.h"
16 #include "llvm/Instructions.h"
17 #include "llvm/Pass.h"
18 #include "llvm/Type.h"
19 #include "llvm/Support/InstVisitor.h"
20
21 using namespace llvm;
22
23 namespace {
24 /// CrashOnCalls - This pass is used to test bugpoint. It intentionally
25 /// crashes on any call instructions.
26 class CrashOnCalls : public BasicBlockPass {
27 public:
28 static char ID; // Pass ID, replacement for typeid
29 CrashOnCalls() : BasicBlockPass(ID) {}
30 private:
31 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
32 AU.setPreservesAll();
33 }
34
35 bool runOnBasicBlock(BasicBlock &BB) {
36 for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
37 if (isa(*I))
38 abort();
39
40 return false;
41 }
42 };
43
44 char CrashOnCalls::ID = 0;
45 RegisterPass
46 X("bugpoint-crashcalls",
47 "BugPoint Test Pass - Intentionally crash on CallInsts");
48 }
49
50 namespace {
51 /// DeleteCalls - This pass is used to test bugpoint. It intentionally
52 /// deletes some call instructions, "misoptimizing" the program.
53 class DeleteCalls : public BasicBlockPass {
54 public:
55 static char ID; // Pass ID, replacement for typeid
56 DeleteCalls() : BasicBlockPass(ID) {}
57 private:
58 bool runOnBasicBlock(BasicBlock &BB) {
59 for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
60 if (CallInst *CI = dyn_cast(I)) {
61 if (!CI->use_empty())
62 CI->replaceAllUsesWith(Constant::getNullValue(CI->getType()));
63 CI->getParent()->getInstList().erase(CI);
64 break;
65 }
66 return false;
67 }
68 };
69
70 char DeleteCalls::ID = 0;
71 RegisterPass
72 Y("bugpoint-deletecalls",
73 "BugPoint Test Pass - Intentionally 'misoptimize' CallInsts");
74 }
0 //===- TestPasses.cpp - "buggy" passes used to test bugpoint --------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains "buggy" passes that are used to test bugpoint, to check
10 // that it is narrowing down testcases correctly.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "llvm/BasicBlock.h"
15 #include "llvm/Constant.h"
16 #include "llvm/Instructions.h"
17 #include "llvm/Pass.h"
18 #include "llvm/Type.h"
19 #include "llvm/Support/InstVisitor.h"
20
21 using namespace llvm;
22
23 namespace {
24 /// CrashOnCalls - This pass is used to test bugpoint. It intentionally
25 /// crashes on any call instructions.
26 class CrashOnCalls : public BasicBlockPass {
27 public:
28 static char ID; // Pass ID, replacement for typeid
29 CrashOnCalls() : BasicBlockPass(ID) {}
30 private:
31 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
32 AU.setPreservesAll();
33 }
34
35 bool runOnBasicBlock(BasicBlock &BB) {
36 for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
37 if (isa(*I))
38 abort();
39
40 return false;
41 }
42 };
43
44 char CrashOnCalls::ID = 0;
45 RegisterPass
46 X("bugpoint-crashcalls",
47 "BugPoint Test Pass - Intentionally crash on CallInsts");
48 }
49
50 namespace {
51 /// DeleteCalls - This pass is used to test bugpoint. It intentionally
52 /// deletes some call instructions, "misoptimizing" the program.
53 class DeleteCalls : public BasicBlockPass {
54 public:
55 static char ID; // Pass ID, replacement for typeid
56 DeleteCalls() : BasicBlockPass(ID) {}
57 private:
58 bool runOnBasicBlock(BasicBlock &BB) {
59 for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
60 if (CallInst *CI = dyn_cast(I)) {
61 if (!CI->use_empty())
62 CI->replaceAllUsesWith(Constant::getNullValue(CI->getType()));
63 CI->getParent()->getInstList().erase(CI);
64 break;
65 }
66 return false;
67 }
68 };
69
70 char DeleteCalls::ID = 0;
71 RegisterPass
72 Y("bugpoint-deletecalls",
73 "BugPoint Test Pass - Intentionally 'misoptimize' CallInsts");
74 }