[llvm-commits] [llvm] r126720 - in /llvm/trunk: lib/Transforms/IPO/DeadArgumentElimination.cpp test/Transforms/DeadArgElim/deadexternal.ll
Eli Friedman
eli.friedman at gmail.com
Mon Feb 28 16:33:47 PST 2011
Author: efriedma
Date: Mon Feb 28 18:33:47 2011
New Revision: 126720
URL: http://llvm.org/viewvc/llvm-project?rev=126720&view=rev
Log:
Add an obvious missing safety check to DAE::RemoveDeadArgumentsFromCallers.
Modified:
llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm/trunk/test/Transforms/DeadArgElim/deadexternal.ll
Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=126720&r1=126719&r2=126720&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Mon Feb 28 18:33:47 2011
@@ -294,7 +294,7 @@
/// 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.
Modified: llvm/trunk/test/Transforms/DeadArgElim/deadexternal.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadArgElim/deadexternal.ll?rev=126720&r1=126719&r2=126720&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/DeadArgElim/deadexternal.ll (original)
+++ llvm/trunk/test/Transforms/DeadArgElim/deadexternal.ll Mon Feb 28 18:33:47 2011
@@ -37,3 +37,16 @@
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
+}
+
More information about the llvm-commits
mailing list