summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/DeadArgumentElimination.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-01-06 18:27:01 +0000
committerDuncan Sands <baldrick@free.fr>2008-01-06 18:27:01 +0000
commitad9a9e15595bc9d5ba1ed752caf8572957f77a3d (patch)
tree1ff466f71bdde8cc209d51f581e13dc1654c7b10 /lib/Transforms/IPO/DeadArgumentElimination.cpp
parenta9d0c9dc58855a5f01dcc5c85c89fd3fc737d3e8 (diff)
downloadllvm-ad9a9e15595bc9d5ba1ed752caf8572957f77a3d.tar.gz
llvm-ad9a9e15595bc9d5ba1ed752caf8572957f77a3d.tar.bz2
llvm-ad9a9e15595bc9d5ba1ed752caf8572957f77a3d.tar.xz
The transform that tries to turn calls to bitcast functions into
direct calls bails out unless caller and callee have essentially equivalent parameter attributes. This is illogical - the callee's attributes should be of no relevance here. Rework the logic, which incidentally fixes a crash when removed arguments have attributes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45658 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/DeadArgumentElimination.cpp')
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 94ae404107..8e6a3b91c1 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -505,7 +505,7 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
const Type *RetTy = FTy->getReturnType();
if (DeadRetVal.count(F)) {
RetTy = Type::VoidTy;
- RAttrs &= ~ParamAttr::VoidTypeIncompatible;
+ RAttrs &= ~ParamAttr::incompatibleWithType(RetTy, RAttrs);
DeadRetVal.erase(F);
}
@@ -561,8 +561,7 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
// The call return attributes.
uint16_t RAttrs = PAL ? PAL->getParamAttrs(0) : 0;
// Adjust in case the function was changed to return void.
- if (NF->getReturnType() == Type::VoidTy)
- RAttrs &= ~ParamAttr::VoidTypeIncompatible;
+ RAttrs &= ~ParamAttr::incompatibleWithType(NF->getReturnType(), RAttrs);
if (RAttrs)
ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, RAttrs));