diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp --- a/clang/lib/CodeGen/CGCleanup.cpp +++ b/clang/lib/CodeGen/CGCleanup.cpp @@ -309,7 +309,8 @@ static llvm::LoadInst *createLoadInstBefore(Address addr, const Twine &name, llvm::Instruction *beforeInst) { - auto load = new llvm::LoadInst(addr.getPointer(), name, beforeInst); + auto load = new llvm::LoadInst(addr.getElementType(), addr.getPointer(), + name, beforeInst); load->setAlignment(addr.getAlignment().getAsAlign()); return load; } diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h --- a/llvm/include/llvm/IR/IRBuilder.h +++ b/llvm/include/llvm/IR/IRBuilder.h @@ -1093,28 +1093,6 @@ NormalDest, UnwindDest, Args, Name); } - // Deprecated [opaque pointer types] - InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest, - BasicBlock *UnwindDest, ArrayRef Args, - ArrayRef OpBundles, - const Twine &Name = "") { - return CreateInvoke( - cast( - cast(Callee->getType())->getElementType()), - Callee, NormalDest, UnwindDest, Args, OpBundles, Name); - } - - // Deprecated [opaque pointer types] - InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest, - BasicBlock *UnwindDest, - ArrayRef Args = None, - const Twine &Name = "") { - return CreateInvoke( - cast( - cast(Callee->getType())->getElementType()), - Callee, NormalDest, UnwindDest, Args, Name); - } - /// \brief Create a callbr instruction. CallBrInst *CreateCallBr(FunctionType *Ty, Value *Callee, BasicBlock *DefaultDest, @@ -2522,23 +2500,6 @@ OpBundles, Name, FPMathTag); } - // Deprecated [opaque pointer types] - CallInst *CreateCall(Value *Callee, ArrayRef Args = None, - const Twine &Name = "", MDNode *FPMathTag = nullptr) { - return CreateCall( - cast(Callee->getType()->getPointerElementType()), Callee, - Args, Name, FPMathTag); - } - - // Deprecated [opaque pointer types] - CallInst *CreateCall(Value *Callee, ArrayRef Args, - ArrayRef OpBundles, - const Twine &Name = "", MDNode *FPMathTag = nullptr) { - return CreateCall( - cast(Callee->getType()->getPointerElementType()), Callee, - Args, OpBundles, Name, FPMathTag); - } - CallInst *CreateConstrainedFPCall( Function *Callee, ArrayRef Args, const Twine &Name = "", Optional Rounding = None, diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h --- a/llvm/include/llvm/IR/Instructions.h +++ b/llvm/include/llvm/IR/Instructions.h @@ -199,40 +199,6 @@ MaybeAlign Align, AtomicOrdering Order, SyncScope::ID SSID, BasicBlock *InsertAtEnd); - // Deprecated [opaque pointer types] - explicit LoadInst(Value *Ptr, const Twine &NameStr = "", - Instruction *InsertBefore = nullptr) - : LoadInst(Ptr->getType()->getPointerElementType(), Ptr, NameStr, - InsertBefore) {} - LoadInst(Value *Ptr, const Twine &NameStr, BasicBlock *InsertAtEnd) - : LoadInst(Ptr->getType()->getPointerElementType(), Ptr, NameStr, - InsertAtEnd) {} - LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, - Instruction *InsertBefore = nullptr) - : LoadInst(Ptr->getType()->getPointerElementType(), Ptr, NameStr, - isVolatile, InsertBefore) {} - LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, - BasicBlock *InsertAtEnd) - : LoadInst(Ptr->getType()->getPointerElementType(), Ptr, NameStr, - isVolatile, InsertAtEnd) {} - LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, MaybeAlign Align, - Instruction *InsertBefore = nullptr) - : LoadInst(Ptr->getType()->getPointerElementType(), Ptr, NameStr, - isVolatile, Align, InsertBefore) {} - LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, MaybeAlign Align, - BasicBlock *InsertAtEnd) - : LoadInst(Ptr->getType()->getPointerElementType(), Ptr, NameStr, - isVolatile, Align, InsertAtEnd) {} - LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, MaybeAlign Align, - AtomicOrdering Order, SyncScope::ID SSID = SyncScope::System, - Instruction *InsertBefore = nullptr) - : LoadInst(Ptr->getType()->getPointerElementType(), Ptr, NameStr, - isVolatile, Align, Order, SSID, InsertBefore) {} - LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile, MaybeAlign Align, - AtomicOrdering Order, SyncScope::ID SSID, BasicBlock *InsertAtEnd) - : LoadInst(Ptr->getType()->getPointerElementType(), Ptr, NameStr, - isVolatile, Align, Order, SSID, InsertAtEnd) {} - /// Return true if this is a load from a volatile memory location. bool isVolatile() const { return getSubclassDataFromInstruction() & 1; } @@ -1536,58 +1502,6 @@ NameStr, InsertAtEnd); } - // Deprecated [opaque pointer types] - static CallInst *Create(Value *Func, const Twine &NameStr = "", - Instruction *InsertBefore = nullptr) { - return Create(cast( - cast(Func->getType())->getElementType()), - Func, NameStr, InsertBefore); - } - - // Deprecated [opaque pointer types] - static CallInst *Create(Value *Func, ArrayRef Args, - const Twine &NameStr, - Instruction *InsertBefore = nullptr) { - return Create(cast( - cast(Func->getType())->getElementType()), - Func, Args, NameStr, InsertBefore); - } - - // Deprecated [opaque pointer types] - static CallInst *Create(Value *Func, ArrayRef Args, - ArrayRef Bundles = None, - const Twine &NameStr = "", - Instruction *InsertBefore = nullptr) { - return Create(cast( - cast(Func->getType())->getElementType()), - Func, Args, Bundles, NameStr, InsertBefore); - } - - // Deprecated [opaque pointer types] - static CallInst *Create(Value *Func, const Twine &NameStr, - BasicBlock *InsertAtEnd) { - return Create(cast( - cast(Func->getType())->getElementType()), - Func, NameStr, InsertAtEnd); - } - - // Deprecated [opaque pointer types] - static CallInst *Create(Value *Func, ArrayRef Args, - const Twine &NameStr, BasicBlock *InsertAtEnd) { - return Create(cast( - cast(Func->getType())->getElementType()), - Func, Args, NameStr, InsertAtEnd); - } - - // Deprecated [opaque pointer types] - static CallInst *Create(Value *Func, ArrayRef Args, - ArrayRef Bundles, - const Twine &NameStr, BasicBlock *InsertAtEnd) { - return Create(cast( - cast(Func->getType())->getElementType()), - Func, Args, Bundles, NameStr, InsertAtEnd); - } - /// Create a clone of \p CI with a different set of operand bundles and /// insert it before \p InsertPt. /// @@ -3785,49 +3699,6 @@ IfException, Args, Bundles, NameStr, InsertAtEnd); } - // Deprecated [opaque pointer types] - static InvokeInst *Create(Value *Func, BasicBlock *IfNormal, - BasicBlock *IfException, ArrayRef Args, - const Twine &NameStr, - Instruction *InsertBefore = nullptr) { - return Create(cast( - cast(Func->getType())->getElementType()), - Func, IfNormal, IfException, Args, None, NameStr, - InsertBefore); - } - - // Deprecated [opaque pointer types] - static InvokeInst *Create(Value *Func, BasicBlock *IfNormal, - BasicBlock *IfException, ArrayRef Args, - ArrayRef Bundles = None, - const Twine &NameStr = "", - Instruction *InsertBefore = nullptr) { - return Create(cast( - cast(Func->getType())->getElementType()), - Func, IfNormal, IfException, Args, Bundles, NameStr, - InsertBefore); - } - - // Deprecated [opaque pointer types] - static InvokeInst *Create(Value *Func, BasicBlock *IfNormal, - BasicBlock *IfException, ArrayRef Args, - const Twine &NameStr, BasicBlock *InsertAtEnd) { - return Create(cast( - cast(Func->getType())->getElementType()), - Func, IfNormal, IfException, Args, NameStr, InsertAtEnd); - } - - // Deprecated [opaque pointer types] - static InvokeInst *Create(Value *Func, BasicBlock *IfNormal, - BasicBlock *IfException, ArrayRef Args, - ArrayRef Bundles, - const Twine &NameStr, BasicBlock *InsertAtEnd) { - return Create(cast( - cast(Func->getType())->getElementType()), - Func, IfNormal, IfException, Args, Bundles, NameStr, - InsertAtEnd); - } - /// Create a clone of \p II with a different set of operand bundles and /// insert it before \p InsertPt. /// diff --git a/llvm/tools/llvm-stress/llvm-stress.cpp b/llvm/tools/llvm-stress/llvm-stress.cpp --- a/llvm/tools/llvm-stress/llvm-stress.cpp +++ b/llvm/tools/llvm-stress/llvm-stress.cpp @@ -343,7 +343,8 @@ void Act() override { // Try to use predefined pointers. If non-exist, use undef pointer value; Value *Ptr = getRandomPointerValue(); - Value *V = new LoadInst(Ptr, "L", BB->getTerminator()); + Value *V = new LoadInst(Ptr->getType()->getPointerElementType(), Ptr, "L", + BB->getTerminator()); PT->push_back(V); } }; diff --git a/polly/include/polly/CodeGen/LoopGenerators.h b/polly/include/polly/CodeGen/LoopGenerators.h --- a/polly/include/polly/CodeGen/LoopGenerators.h +++ b/polly/include/polly/CodeGen/LoopGenerators.h @@ -188,7 +188,7 @@ /// @param LB The lower bound for the loop we parallelize. /// @param UB The upper bound for the loop we parallelize. /// @param Stride The stride of the loop we parallelize. - virtual void deployParallelExecution(Value *SubFn, Value *SubFnParam, + virtual void deployParallelExecution(Function *SubFn, Value *SubFnParam, Value *LB, Value *UB, Value *Stride) = 0; /// Prepare the definition of the parallel subfunction. diff --git a/polly/include/polly/CodeGen/LoopGeneratorsGOMP.h b/polly/include/polly/CodeGen/LoopGeneratorsGOMP.h --- a/polly/include/polly/CodeGen/LoopGeneratorsGOMP.h +++ b/polly/include/polly/CodeGen/LoopGeneratorsGOMP.h @@ -45,7 +45,7 @@ void createCallSpawnThreads(Value *SubFn, Value *SubFnParam, Value *LB, Value *UB, Value *Stride); - void deployParallelExecution(Value *SubFn, Value *SubFnParam, Value *LB, + void deployParallelExecution(Function *SubFn, Value *SubFnParam, Value *LB, Value *UB, Value *Stride) override; virtual Function *prepareSubFnDefinition(Function *F) const override; diff --git a/polly/include/polly/CodeGen/LoopGeneratorsKMP.h b/polly/include/polly/CodeGen/LoopGeneratorsKMP.h --- a/polly/include/polly/CodeGen/LoopGeneratorsKMP.h +++ b/polly/include/polly/CodeGen/LoopGeneratorsKMP.h @@ -69,7 +69,7 @@ void createCallSpawnThreads(Value *SubFn, Value *SubFnParam, Value *LB, Value *UB, Value *Stride); - void deployParallelExecution(Value *SubFn, Value *SubFnParam, Value *LB, + void deployParallelExecution(Function *SubFn, Value *SubFnParam, Value *LB, Value *UB, Value *Stride) override; virtual Function *prepareSubFnDefinition(Function *F) const override; diff --git a/polly/lib/CodeGen/LoopGeneratorsGOMP.cpp b/polly/lib/CodeGen/LoopGeneratorsGOMP.cpp --- a/polly/lib/CodeGen/LoopGeneratorsGOMP.cpp +++ b/polly/lib/CodeGen/LoopGeneratorsGOMP.cpp @@ -47,7 +47,7 @@ Builder.CreateCall(F, Args); } -void ParallelLoopGeneratorGOMP::deployParallelExecution(Value *SubFn, +void ParallelLoopGeneratorGOMP::deployParallelExecution(Function *SubFn, Value *SubFnParam, Value *LB, Value *UB, Value *Stride) { diff --git a/polly/lib/CodeGen/LoopGeneratorsKMP.cpp b/polly/lib/CodeGen/LoopGeneratorsKMP.cpp --- a/polly/lib/CodeGen/LoopGeneratorsKMP.cpp +++ b/polly/lib/CodeGen/LoopGeneratorsKMP.cpp @@ -59,7 +59,7 @@ Builder.CreateCall(F, Args); } -void ParallelLoopGeneratorKMP::deployParallelExecution(Value *SubFn, +void ParallelLoopGeneratorKMP::deployParallelExecution(Function *SubFn, Value *SubFnParam, Value *LB, Value *UB, Value *Stride) { diff --git a/polly/lib/Transform/RewriteByReferenceParameters.cpp b/polly/lib/Transform/RewriteByReferenceParameters.cpp --- a/polly/lib/Transform/RewriteByReferenceParameters.cpp +++ b/polly/lib/Transform/RewriteByReferenceParameters.cpp @@ -66,11 +66,12 @@ std::string InstName = Alloca->getName().str(); auto NewAlloca = - new AllocaInst(Alloca->getType()->getElementType(), 0, + new AllocaInst(Alloca->getAllocatedType(), 0, "polly_byref_alloca_" + InstName, &*Entry->begin()); auto *LoadedVal = - new LoadInst(Alloca, "polly_byref_load_" + InstName, &Inst); + new LoadInst(Alloca->getAllocatedType(), Alloca, + "polly_byref_load_" + InstName, &Inst); new StoreInst(LoadedVal, NewAlloca, &Inst); auto *NewBitCast = new BitCastInst(NewAlloca, BitCast->getType(),