revert my previous patches that introduced an additional parameter to the objectsize intrinsic.

After a lot of discussion, we realized it's not the best option for run-time bounds checking

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157255 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nuno Lopes
2012-05-22 15:25:31 +00:00
parent 76ff741836
commit 23e75da7e0
15 changed files with 105 additions and 276 deletions

View File

@@ -52,20 +52,6 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
}
break;
}
case 'o': {
// FIXME: remove in LLVM 3.3
if (Name.startswith("objectsize.") && F->arg_size() == 2) {
Type *Tys[] = {F->getReturnType(),
F->arg_begin()->getType(),
Type::getInt1Ty(F->getContext()),
Type::getInt32Ty(F->getContext())};
NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::objectsize,
Tys);
NewFn->takeName(F);
return true;
}
break;
}
case 'x': {
if (Name.startswith("x86.sse2.pcmpeq.") ||
Name.startswith("x86.sse2.pcmpgt.") ||
@@ -209,7 +195,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
llvm_unreachable("Unknown function for CallInst upgrade.");
case Intrinsic::ctlz:
case Intrinsic::cttz: {
case Intrinsic::cttz:
assert(CI->getNumArgOperands() == 1 &&
"Mismatch between function args and call args");
StringRef Name = CI->getName();
@@ -219,16 +205,6 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
CI->eraseFromParent();
return;
}
case Intrinsic::objectsize: {
StringRef Name = CI->getName();
CI->setName(Name + ".old");
CI->replaceAllUsesWith(Builder.CreateCall3(NewFn, CI->getArgOperand(0),
CI->getArgOperand(1),
Builder.getInt32(0), Name));
CI->eraseFromParent();
return;
}
}
}
// This tests each Function to determine if it needs upgrading. When we find