mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-12-20 03:17:48 +00:00
[opaque pointer type] Verifier/AutoUpgrade: Remove a few uses of PointerType::getElementType
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235777 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1448,8 +1448,14 @@ public:
|
|||||||
}
|
}
|
||||||
CallInst *CreateCall2(Value *Callee, Value *Arg1, Value *Arg2,
|
CallInst *CreateCall2(Value *Callee, Value *Arg1, Value *Arg2,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
|
return CreateCall2(cast<FunctionType>(cast<PointerType>(Callee->getType())
|
||||||
|
->getElementType()),
|
||||||
|
Callee, Arg1, Arg2, Name);
|
||||||
|
}
|
||||||
|
CallInst *CreateCall2(FunctionType *Ty, Value *Callee, Value *Arg1,
|
||||||
|
Value *Arg2, const Twine &Name = "") {
|
||||||
Value *Args[] = { Arg1, Arg2 };
|
Value *Args[] = { Arg1, Arg2 };
|
||||||
return Insert(CallInst::Create(Callee, Args), Name);
|
return Insert(CallInst::Create(Ty, Callee, Args), Name);
|
||||||
}
|
}
|
||||||
CallInst *CreateCall3(Value *Callee, Value *Arg1, Value *Arg2, Value *Arg3,
|
CallInst *CreateCall3(Value *Callee, Value *Arg1, Value *Arg2, Value *Arg3,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
|
|||||||
@@ -767,16 +767,14 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
|||||||
// Old intrinsic, add bitcasts
|
// Old intrinsic, add bitcasts
|
||||||
Value *Arg1 = CI->getArgOperand(1);
|
Value *Arg1 = CI->getArgOperand(1);
|
||||||
|
|
||||||
Value *BC0 =
|
Type *NewVecTy = VectorType::get(Type::getInt64Ty(C), 2);
|
||||||
Builder.CreateBitCast(Arg0,
|
|
||||||
VectorType::get(Type::getInt64Ty(C), 2),
|
|
||||||
"cast");
|
|
||||||
Value *BC1 =
|
|
||||||
Builder.CreateBitCast(Arg1,
|
|
||||||
VectorType::get(Type::getInt64Ty(C), 2),
|
|
||||||
"cast");
|
|
||||||
|
|
||||||
CallInst* NewCall = Builder.CreateCall2(NewFn, BC0, BC1, Name);
|
Value *BC0 = Builder.CreateBitCast(Arg0, NewVecTy, "cast");
|
||||||
|
Value *BC1 = Builder.CreateBitCast(Arg1, NewVecTy, "cast");
|
||||||
|
|
||||||
|
Type *Ty[] = {NewVecTy, NewVecTy};
|
||||||
|
CallInst *NewCall = Builder.CreateCall2(
|
||||||
|
FunctionType::get(CI->getType(), Ty, false), NewFn, BC0, BC1, Name);
|
||||||
CI->replaceAllUsesWith(NewCall);
|
CI->replaceAllUsesWith(NewCall);
|
||||||
CI->eraseFromParent();
|
CI->eraseFromParent();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2243,12 +2243,8 @@ void Verifier::verifyMustTailCall(CallInst &CI) {
|
|||||||
// parameters or return types may differ in pointee type, but not
|
// parameters or return types may differ in pointee type, but not
|
||||||
// address space.
|
// address space.
|
||||||
Function *F = CI.getParent()->getParent();
|
Function *F = CI.getParent()->getParent();
|
||||||
auto GetFnTy = [](Value *V) {
|
FunctionType *CallerTy = F->getFunctionType();
|
||||||
return cast<FunctionType>(
|
FunctionType *CalleeTy = CI.getFunctionType();
|
||||||
cast<PointerType>(V->getType())->getElementType());
|
|
||||||
};
|
|
||||||
FunctionType *CallerTy = GetFnTy(F);
|
|
||||||
FunctionType *CalleeTy = GetFnTy(CI.getCalledValue());
|
|
||||||
Assert(CallerTy->getNumParams() == CalleeTy->getNumParams(),
|
Assert(CallerTy->getNumParams() == CalleeTy->getNumParams(),
|
||||||
"cannot guarantee tail call due to mismatched parameter counts", &CI);
|
"cannot guarantee tail call due to mismatched parameter counts", &CI);
|
||||||
Assert(CallerTy->isVarArg() == CalleeTy->isVarArg(),
|
Assert(CallerTy->isVarArg() == CalleeTy->isVarArg(),
|
||||||
@@ -2600,7 +2596,7 @@ void Verifier::visitAllocaInst(AllocaInst &AI) {
|
|||||||
Assert(PTy->getAddressSpace() == 0,
|
Assert(PTy->getAddressSpace() == 0,
|
||||||
"Allocation instruction pointer not in the generic address space!",
|
"Allocation instruction pointer not in the generic address space!",
|
||||||
&AI);
|
&AI);
|
||||||
Assert(PTy->getElementType()->isSized(&Visited),
|
Assert(AI.getAllocatedType()->isSized(&Visited),
|
||||||
"Cannot allocate unsized type", &AI);
|
"Cannot allocate unsized type", &AI);
|
||||||
Assert(AI.getArraySize()->getType()->isIntegerTy(),
|
Assert(AI.getArraySize()->getType()->isIntegerTy(),
|
||||||
"Alloca array size must have integer type", &AI);
|
"Alloca array size must have integer type", &AI);
|
||||||
|
|||||||
Reference in New Issue
Block a user