summaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine/InstCombineCalls.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-11-20 19:09:04 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-11-20 19:09:04 +0000
commit173862e5468fbcf4b022b9088d2c81b25c2d60c5 (patch)
tree7e5397de7252f267c99878bc8176abc1bfb0fdd2 /lib/Transforms/InstCombine/InstCombineCalls.cpp
parent742e5cf61298e9d7a0672d0cd79708c4939da489 (diff)
downloadllvm-173862e5468fbcf4b022b9088d2c81b25c2d60c5.tar.gz
llvm-173862e5468fbcf4b022b9088d2c81b25c2d60c5.tar.bz2
llvm-173862e5468fbcf4b022b9088d2c81b25c2d60c5.tar.xz
Refactor code to use new attribute getters on CallSite for NoCapture and ByVal.
Suggested in code review by Eli. That code in InstCombine looks kinda suspicious. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145013 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineCalls.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstCombineCalls.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp
index c7b3ff8504..e8136ab77f 100644
--- a/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -760,7 +760,7 @@ static bool isSafeToEliminateVarargsCast(const CallSite CS,
// The size of ByVal arguments is derived from the type, so we
// can't change to a type with a different size. If the size were
// passed explicitly we could avoid this check.
- if (!CS.paramHasAttr(ix, Attribute::ByVal))
+ if (!CS.isByValArgument(ix))
return true;
Type* SrcTy =
@@ -960,7 +960,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
PointerType *PTy = cast<PointerType>(Callee->getType());
FunctionType *FTy = cast<FunctionType>(PTy->getElementType());
if (FTy->isVarArg()) {
- int ix = FTy->getNumParams() + (isa<InvokeInst>(Callee) ? 3 : 1);
+ int ix = FTy->getNumParams() + (isa<InvokeInst>(Callee) ? 2 : 0);
// See if we can optimize any arguments passed through the varargs area of
// the call.
for (CallSite::arg_iterator I = CS.arg_begin()+FTy->getNumParams(),