diff options
author | Chris Lattner <sabre@nondot.org> | 2006-06-27 21:05:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-06-27 21:05:04 +0000 |
commit | 92044ce4e93fead19e6a34485a506849d018565b (patch) | |
tree | 7638e6572171f92ce906e90a9ffba804b8615ef2 /lib/Transforms | |
parent | a60af3228771e1cca33950c4c1980ee7e6e63d21 (diff) | |
download | external_llvm-92044ce4e93fead19e6a34485a506849d018565b.zip external_llvm-92044ce4e93fead19e6a34485a506849d018565b.tar.gz external_llvm-92044ce4e93fead19e6a34485a506849d018565b.tar.bz2 |
Fix Transforms/DeadArgElim/2006-06-27-struct-ret.ll. -deadargelim should not
remove the struct return argument of a csret function, even if it is obviously
dead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28943 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/DeadArgumentElimination.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp index 37fb46d..e1feed9 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -19,15 +19,15 @@ #define DEBUG_TYPE "deadargelim" #include "llvm/Transforms/IPO.h" -#include "llvm/Module.h" -#include "llvm/Pass.h" -#include "llvm/DerivedTypes.h" +#include "llvm/CallingConv.h" #include "llvm/Constant.h" +#include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" +#include "llvm/Module.h" +#include "llvm/Pass.h" #include "llvm/Support/CallSite.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" -#include "llvm/ADT/iterator" #include <iostream> #include <set> using namespace llvm; @@ -128,7 +128,13 @@ static inline bool CallPassesValueThoughVararg(Instruction *Call, // (used in a computation), MaybeLive (only passed as an argument to a call), or // Dead (not used). DAE::Liveness DAE::getArgumentLiveness(const Argument &A) { - if (A.use_empty()) return Dead; // First check, directly dead? + // If this is the return value of a csret function, it's not really dead. + if (A.getParent()->getCallingConv() == CallingConv::CSRet && + &*A.getParent()->arg_begin() == &A) + return Live; + + if (A.use_empty()) // First check, directly dead? + return Dead; // Scan through all of the uses, looking for non-argument passing uses. for (Value::use_const_iterator I = A.use_begin(), E = A.use_end(); I!=E;++I) { |