summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-02-03 20:42:49 +0000
committerReid Kleckner <reid@kleckner.net>2014-02-03 20:42:49 +0000
commit81558937d774db688a8d2b46264761e5b61ac473 (patch)
tree942cddb8ccb16742940faba485cfb285536dacde /lib
parent07786c2f091c5179719b56e74a51dfa8ba5e3dc4 (diff)
downloadllvm-81558937d774db688a8d2b46264761e5b61ac473.tar.gz
llvm-81558937d774db688a8d2b46264761e5b61ac473.tar.bz2
llvm-81558937d774db688a8d2b46264761e5b61ac473.tar.xz
inalloca: Don't remove dead arguments in the presence of inalloca args
It disturbs the layout of the parameters in memory and registers, leading to problems in the backend. The plan for optimizing internal inalloca functions going forward is to essentially SROA the argument memory and demote any captured arguments (things that aren't trivially written by a load or store) to an indirect pointer to a static alloca. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200717 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 81dbd329c4..d372ba22d6 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -531,6 +531,13 @@ DAE::Liveness DAE::SurveyUses(const Value *V, UseVector &MaybeLiveUses) {
// well as arguments to functions which have their "address taken".
//
void DAE::SurveyFunction(const Function &F) {
+ // Functions with inalloca parameters are expecting args in a particular
+ // register and memory layout.
+ if (F.getAttributes().hasAttrSomewhere(Attribute::InAlloca)) {
+ MarkLive(F);
+ return;
+ }
+
unsigned RetCount = NumRetVals(&F);
// Assume all return values are dead
typedef SmallVector<Liveness, 5> RetVals;