[llvm-commits] CVS: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Nov 5 15:44:05 PST 2003
Changes in directory llvm/lib/Transforms/IPO:
DeadArgumentElimination.cpp updated: 1.10 -> 1.11
---
Log message:
Split behavior into two pieces
---
Diffs of the changes: (+13 -13)
Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.10 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.11
--- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.10 Sat Nov 1 20:06:27 2003
+++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Wed Nov 5 15:43:02 2003
@@ -39,10 +39,6 @@
/// DAE - The dead argument elimination pass.
///
class DAE : public Pass {
- /// DeleteFromExternalFunctions - Bugpoint sets this flag to indicate that
- /// it is safe to hack apart functions without internal linkage.
- bool DeleteFromExternalFunctions;
-
/// Liveness enum - During our initial pass over the program, we determine
/// that things are either definately alive, definately dead, or in need of
/// interprocedural analysis (MaybeLive).
@@ -79,9 +75,10 @@
std::multimap<Function*, CallSite> CallSites;
public:
- DAE(bool DFEF = false) : DeleteFromExternalFunctions(DFEF) {}
bool run(Module &M);
+ virtual bool ShouldHackArguments() const { return false; }
+
private:
Liveness getArgumentLiveness(const Argument &A);
bool isMaybeLiveArgumentNowLive(Argument *Arg);
@@ -95,17 +92,20 @@
void RemoveDeadArgumentsFromFunction(Function *F);
};
RegisterOpt<DAE> X("deadargelim", "Dead Argument Elimination");
+
+ /// DAH - DeadArgumentHacking pass - Same as dead argument elimination, but
+ /// deletes arguments to functions which are external. This is only for use
+ /// by bugpoint.
+ struct DAH : public DAE {
+ virtual bool ShouldHackArguments() const { return true; }
+ };
}
/// createDeadArgEliminationPass - This pass removes arguments from functions
-/// which are not used by the body of the function. If
-/// DeleteFromExternalFunctions is true, the pass will modify functions that
-/// have external linkage, which is not usually safe (this is used by bugpoint
-/// to reduce testcases).
+/// which are not used by the body of the function.
///
-Pass *createDeadArgEliminationPass(bool DeleteFromExternalFunctions) {
- return new DAE(DeleteFromExternalFunctions);
-}
+Pass *createDeadArgEliminationPass() { return new DAE(); }
+Pass *createDeadArgHackingPass() { return new DAH(); }
static inline bool CallPassesValueThoughVararg(Instruction *Call,
const Value *Arg) {
@@ -163,7 +163,7 @@
bool FunctionIntrinsicallyLive = false;
Liveness RetValLiveness = F.getReturnType() == Type::VoidTy ? Live : Dead;
- if (!F.hasInternalLinkage() && !DeleteFromExternalFunctions)
+ if (!F.hasInternalLinkage() && !ShouldHackArguments())
FunctionIntrinsicallyLive = true;
else
for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) {
More information about the llvm-commits
mailing list