LLVM 2.8 changed llvm.mem{cpy,move,set}.* to take 5 arguments.

Use AutoUpgrade to upgrade these calls.
Intrinsic::getDeclaration can't be used because in 2.7 it needs 1 type,
in 2.8 it needs 2/3, and there is no function to query how many it needs.
This commit is contained in:
Török Edvin 2010-08-04 15:26:50 +03:00
parent e3a5450335
commit 744c40d142

View file

@ -38,6 +38,7 @@
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/AutoUpgrade.h"
#include "llvm/CallingConv.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
@ -133,6 +134,14 @@ namespace {
static sys::ThreadLocal<const jmp_buf> ExceptionReturn;
static void UpgradeCall(CallInst *&C, Function *Intr)
{
Function *New;
if (!UpgradeIntrinsicFunction(Intr, New) || New == Intr)
return;
UpgradeIntrinsicCall(C, New);
}
void do_shutdown() {
llvm_shutdown();
}
@ -1288,6 +1297,7 @@ public:
ConstantInt::get(Type::getInt32Ty(Context), 1));
c->setTailCall(true);
c->setDoesNotThrow();
UpgradeCall(c, CF->FMemset);
break;
}
case OP_BC_MEMCPY:
@ -1301,6 +1311,7 @@ public:
ConstantInt::get(Type::getInt32Ty(Context), 1));
c->setTailCall(true);
c->setDoesNotThrow();
UpgradeCall(c, CF->FMemcpy);
break;
}
case OP_BC_MEMMOVE:
@ -1314,6 +1325,7 @@ public:
ConstantInt::get(Type::getInt32Ty(Context), 1));
c->setTailCall(true);
c->setDoesNotThrow();
UpgradeCall(c, CF->FMemmove);
break;
}
case OP_BC_MEMCMP: