Skip to content

Commit fb8ed43

Browse files
author
Dan Gohman
committed
Make bugpoint dead-argument-hacking actually work, and actually test it.
llvm-svn: 105551
1 parent 34a2249 commit fb8ed43

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,14 @@ namespace {
120120

121121
typedef SmallVector<RetOrArg, 5> UseVector;
122122

123+
protected:
124+
// DAH uses this to specify a different ID.
125+
explicit DAE(void *ID) : ModulePass(ID) {}
126+
123127
public:
124128
static char ID; // Pass identification, replacement for typeid
125129
DAE() : ModulePass(&ID) {}
130+
126131
bool runOnModule(Module &M);
127132

128133
virtual bool ShouldHackArguments() const { return false; }
@@ -155,6 +160,8 @@ namespace {
155160
/// by bugpoint.
156161
struct DAH : public DAE {
157162
static char ID;
163+
DAH() : DAE(&ID) {}
164+
158165
virtual bool ShouldHackArguments() const { return true; }
159166
};
160167
}

llvm/test/BugPoint/remove_arguments_test.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
; RUN: bugpoint %s -output-prefix %t -bugpoint-crashcalls -silence-passes
2+
; RUN: llvm-dis remove_arguments_test.ll.tmp-reduced-simplified.bc -o - | FileCheck %s
23

34
; Test to make sure that arguments are removed from the function if they are
45
; unnecessary.
56

67
declare i32 @test2()
78

9+
; CHECK: define void @test() {
810
define i32 @test(i32 %A, i32 %B, float %C) {
911
call i32 @test2()
1012
ret i32 %1

0 commit comments

Comments
 (0)