diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-03-01 00:33:47 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-03-01 00:33:47 +0000 |
commit | f291ab2fbaa5ed1cfa20ca47e8dece1040a5065b (patch) | |
tree | 6596b38d6c2f6a98965eed89eb30ae77c596d5f7 | |
parent | d3e768ecabf76859e2224f4509a94325ec5ab7c7 (diff) | |
download | external_llvm-f291ab2fbaa5ed1cfa20ca47e8dece1040a5065b.zip external_llvm-f291ab2fbaa5ed1cfa20ca47e8dece1040a5065b.tar.gz external_llvm-f291ab2fbaa5ed1cfa20ca47e8dece1040a5065b.tar.bz2 |
Add an obvious missing safety check to DAE::RemoveDeadArgumentsFromCallers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126720 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/IPO/DeadArgumentElimination.cpp | 2 | ||||
-rw-r--r-- | test/Transforms/DeadArgElim/deadexternal.ll | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp index b423221..4d1f7ab 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -294,7 +294,7 @@ bool DAE::DeleteDeadVarargs(Function &Fn) { /// instead. bool DAE::RemoveDeadArgumentsFromCallers(Function &Fn) { - if (Fn.isDeclaration()) + if (Fn.isDeclaration() || Fn.mayBeOverridden()) return false; // Functions with local linkage should already have been handled. diff --git a/test/Transforms/DeadArgElim/deadexternal.ll b/test/Transforms/DeadArgElim/deadexternal.ll index 5a80aba..8409261 100644 --- a/test/Transforms/DeadArgElim/deadexternal.ll +++ b/test/Transforms/DeadArgElim/deadexternal.ll @@ -37,3 +37,16 @@ entry: call void @f(i32 %tmp) ret void } + +; Check that callers are not transformed for weak definitions. +define weak i32 @weak_f(i32 %x) nounwind { +entry: + ret i32 0 +} +define void @weak_f_caller() nounwind { +entry: +; CHECK: call i32 @weak_f(i32 10) + %call = tail call i32 @weak_f(i32 10) + ret void +} + |