[llvm] r235777 - [opaque pointer type] Verifier/AutoUpgrade: Remove a few uses of PointerType::getElementType
David Blaikie
dblaikie at gmail.com
Fri Apr 24 14:16:07 PDT 2015
Author: dblaikie
Date: Fri Apr 24 16:16:07 2015
New Revision: 235777
URL: http://llvm.org/viewvc/llvm-project?rev=235777&view=rev
Log:
[opaque pointer type] Verifier/AutoUpgrade: Remove a few uses of PointerType::getElementType
Modified:
llvm/trunk/include/llvm/IR/IRBuilder.h
llvm/trunk/lib/IR/AutoUpgrade.cpp
llvm/trunk/lib/IR/Verifier.cpp
Modified: llvm/trunk/include/llvm/IR/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IRBuilder.h?rev=235777&r1=235776&r2=235777&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/IR/IRBuilder.h Fri Apr 24 16:16:07 2015
@@ -1448,8 +1448,14 @@ public:
}
CallInst *CreateCall2(Value *Callee, Value *Arg1, Value *Arg2,
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 };
- 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,
const Twine &Name = "") {
Modified: llvm/trunk/lib/IR/AutoUpgrade.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AutoUpgrade.cpp?rev=235777&r1=235776&r2=235777&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AutoUpgrade.cpp (original)
+++ llvm/trunk/lib/IR/AutoUpgrade.cpp Fri Apr 24 16:16:07 2015
@@ -767,16 +767,14 @@ void llvm::UpgradeIntrinsicCall(CallInst
// Old intrinsic, add bitcasts
Value *Arg1 = CI->getArgOperand(1);
- Value *BC0 =
- Builder.CreateBitCast(Arg0,
- VectorType::get(Type::getInt64Ty(C), 2),
- "cast");
- Value *BC1 =
- Builder.CreateBitCast(Arg1,
- VectorType::get(Type::getInt64Ty(C), 2),
- "cast");
+ Type *NewVecTy = VectorType::get(Type::getInt64Ty(C), 2);
- 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->eraseFromParent();
return;
Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=235777&r1=235776&r2=235777&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Fri Apr 24 16:16:07 2015
@@ -2243,12 +2243,8 @@ void Verifier::verifyMustTailCall(CallIn
// parameters or return types may differ in pointee type, but not
// address space.
Function *F = CI.getParent()->getParent();
- auto GetFnTy = [](Value *V) {
- return cast<FunctionType>(
- cast<PointerType>(V->getType())->getElementType());
- };
- FunctionType *CallerTy = GetFnTy(F);
- FunctionType *CalleeTy = GetFnTy(CI.getCalledValue());
+ FunctionType *CallerTy = F->getFunctionType();
+ FunctionType *CalleeTy = CI.getFunctionType();
Assert(CallerTy->getNumParams() == CalleeTy->getNumParams(),
"cannot guarantee tail call due to mismatched parameter counts", &CI);
Assert(CallerTy->isVarArg() == CalleeTy->isVarArg(),
@@ -2600,7 +2596,7 @@ void Verifier::visitAllocaInst(AllocaIns
Assert(PTy->getAddressSpace() == 0,
"Allocation instruction pointer not in the generic address space!",
&AI);
- Assert(PTy->getElementType()->isSized(&Visited),
+ Assert(AI.getAllocatedType()->isSized(&Visited),
"Cannot allocate unsized type", &AI);
Assert(AI.getArraySize()->getType()->isIntegerTy(),
"Alloca array size must have integer type", &AI);
More information about the llvm-commits
mailing list