summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/AutoUpgrade.cpp
diff options
context:
space:
mode:
authorErik Pilkington <erik.pilkington@gmail.com>2019-02-12 21:55:38 +0000
committerErik Pilkington <erik.pilkington@gmail.com>2019-02-12 21:55:38 +0000
commit4ecd7a90a604a48c41dce94d53a94dc79872b767 (patch)
treecf71973ea0b7e20833f27a099bba687516266321 /llvm/lib/IR/AutoUpgrade.cpp
parentcf3a906fb49edf2ae38c5672870d25aaf531c4ae (diff)
downloadbcm5719-llvm-4ecd7a90a604a48c41dce94d53a94dc79872b767.tar.gz
bcm5719-llvm-4ecd7a90a604a48c41dce94d53a94dc79872b767.zip
Fix auto-upgrade for the new parameter to llvm.objectsize
r352664 added a 'dynamic' parameter to objectsize, but the AutoUpgrade changes were incomplete. Also, fix an off-by-one error I made in the upgrade logic that is now no longer unreachable. Differential revision: https://reviews.llvm.org/D58071 llvm-svn: 353884
Diffstat (limited to 'llvm/lib/IR/AutoUpgrade.cpp')
-rw-r--r--llvm/lib/IR/AutoUpgrade.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index fbbb5240017..8ebe55a1ea3 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -743,7 +743,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
// address space.
if (Name.startswith("objectsize.")) {
Type *Tys[2] = { F->getReturnType(), F->arg_begin()->getType() };
- if (F->arg_size() == 2 ||
+ if (F->arg_size() == 2 || F->arg_size() == 3 ||
F->getName() != Intrinsic::getName(Intrinsic::objectsize, Tys)) {
rename(F);
NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::objectsize,
@@ -3461,7 +3461,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
? Builder.getFalse()
: CI->getArgOperand(2);
Value *Dynamic =
- CI->getNumArgOperands() < 3 ? Builder.getFalse() : CI->getArgOperand(3);
+ CI->getNumArgOperands() < 4 ? Builder.getFalse() : CI->getArgOperand(3);
NewCall = Builder.CreateCall(
NewFn, {CI->getArgOperand(0), CI->getArgOperand(1), NullIsUnknownSize, Dynamic});
break;
OpenPOWER on IntegriCloud