efriedma created this revision. efriedma added reviewers: nhaehnle, t.p.northover, dblaikie. Herald added a reviewer: bollu. Herald added subscribers: cfe-commits, jfb. Herald added a project: clang.
Removes deprecated overloads of LoadInst constructor, CallInst::Create, InvokeInst::Create, IRBuilder::CreateCall, IRBuilder::CreateInvoke. (Leaving around deprecated IRBuilder::CreateLoad for now.) Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D76269 Files: clang/lib/CodeGen/CGCleanup.cpp llvm/include/llvm/IR/IRBuilder.h llvm/include/llvm/IR/Instructions.h llvm/tools/llvm-stress/llvm-stress.cpp polly/include/polly/CodeGen/LoopGenerators.h polly/include/polly/CodeGen/LoopGeneratorsGOMP.h polly/include/polly/CodeGen/LoopGeneratorsKMP.h polly/lib/CodeGen/LoopGeneratorsGOMP.cpp polly/lib/CodeGen/LoopGeneratorsKMP.cpp polly/lib/Transform/RewriteByReferenceParameters.cpp
Index: polly/lib/Transform/RewriteByReferenceParameters.cpp =================================================================== --- polly/lib/Transform/RewriteByReferenceParameters.cpp +++ 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(), Index: polly/lib/CodeGen/LoopGeneratorsKMP.cpp =================================================================== --- polly/lib/CodeGen/LoopGeneratorsKMP.cpp +++ 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) { Index: polly/lib/CodeGen/LoopGeneratorsGOMP.cpp =================================================================== --- polly/lib/CodeGen/LoopGeneratorsGOMP.cpp +++ 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) { Index: polly/include/polly/CodeGen/LoopGeneratorsKMP.h =================================================================== --- polly/include/polly/CodeGen/LoopGeneratorsKMP.h +++ 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; Index: polly/include/polly/CodeGen/LoopGeneratorsGOMP.h =================================================================== --- polly/include/polly/CodeGen/LoopGeneratorsGOMP.h +++ 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; Index: polly/include/polly/CodeGen/LoopGenerators.h =================================================================== --- polly/include/polly/CodeGen/LoopGenerators.h +++ 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. Index: llvm/tools/llvm-stress/llvm-stress.cpp =================================================================== --- llvm/tools/llvm-stress/llvm-stress.cpp +++ 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); } }; Index: llvm/include/llvm/IR/Instructions.h =================================================================== --- llvm/include/llvm/IR/Instructions.h +++ 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<FunctionType>( - cast<PointerType>(Func->getType())->getElementType()), - Func, NameStr, InsertBefore); - } - - // Deprecated [opaque pointer types] - static CallInst *Create(Value *Func, ArrayRef<Value *> Args, - const Twine &NameStr, - Instruction *InsertBefore = nullptr) { - return Create(cast<FunctionType>( - cast<PointerType>(Func->getType())->getElementType()), - Func, Args, NameStr, InsertBefore); - } - - // Deprecated [opaque pointer types] - static CallInst *Create(Value *Func, ArrayRef<Value *> Args, - ArrayRef<OperandBundleDef> Bundles = None, - const Twine &NameStr = "", - Instruction *InsertBefore = nullptr) { - return Create(cast<FunctionType>( - cast<PointerType>(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<FunctionType>( - cast<PointerType>(Func->getType())->getElementType()), - Func, NameStr, InsertAtEnd); - } - - // Deprecated [opaque pointer types] - static CallInst *Create(Value *Func, ArrayRef<Value *> Args, - const Twine &NameStr, BasicBlock *InsertAtEnd) { - return Create(cast<FunctionType>( - cast<PointerType>(Func->getType())->getElementType()), - Func, Args, NameStr, InsertAtEnd); - } - - // Deprecated [opaque pointer types] - static CallInst *Create(Value *Func, ArrayRef<Value *> Args, - ArrayRef<OperandBundleDef> Bundles, - const Twine &NameStr, BasicBlock *InsertAtEnd) { - return Create(cast<FunctionType>( - cast<PointerType>(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<Value *> Args, - const Twine &NameStr, - Instruction *InsertBefore = nullptr) { - return Create(cast<FunctionType>( - cast<PointerType>(Func->getType())->getElementType()), - Func, IfNormal, IfException, Args, None, NameStr, - InsertBefore); - } - - // Deprecated [opaque pointer types] - static InvokeInst *Create(Value *Func, BasicBlock *IfNormal, - BasicBlock *IfException, ArrayRef<Value *> Args, - ArrayRef<OperandBundleDef> Bundles = None, - const Twine &NameStr = "", - Instruction *InsertBefore = nullptr) { - return Create(cast<FunctionType>( - cast<PointerType>(Func->getType())->getElementType()), - Func, IfNormal, IfException, Args, Bundles, NameStr, - InsertBefore); - } - - // Deprecated [opaque pointer types] - static InvokeInst *Create(Value *Func, BasicBlock *IfNormal, - BasicBlock *IfException, ArrayRef<Value *> Args, - const Twine &NameStr, BasicBlock *InsertAtEnd) { - return Create(cast<FunctionType>( - cast<PointerType>(Func->getType())->getElementType()), - Func, IfNormal, IfException, Args, NameStr, InsertAtEnd); - } - - // Deprecated [opaque pointer types] - static InvokeInst *Create(Value *Func, BasicBlock *IfNormal, - BasicBlock *IfException, ArrayRef<Value *> Args, - ArrayRef<OperandBundleDef> Bundles, - const Twine &NameStr, BasicBlock *InsertAtEnd) { - return Create(cast<FunctionType>( - cast<PointerType>(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. /// Index: llvm/include/llvm/IR/IRBuilder.h =================================================================== --- llvm/include/llvm/IR/IRBuilder.h +++ 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<Value *> Args, - ArrayRef<OperandBundleDef> OpBundles, - const Twine &Name = "") { - return CreateInvoke( - cast<FunctionType>( - cast<PointerType>(Callee->getType())->getElementType()), - Callee, NormalDest, UnwindDest, Args, OpBundles, Name); - } - - // Deprecated [opaque pointer types] - InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest, - BasicBlock *UnwindDest, - ArrayRef<Value *> Args = None, - const Twine &Name = "") { - return CreateInvoke( - cast<FunctionType>( - cast<PointerType>(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<Value *> Args = None, - const Twine &Name = "", MDNode *FPMathTag = nullptr) { - return CreateCall( - cast<FunctionType>(Callee->getType()->getPointerElementType()), Callee, - Args, Name, FPMathTag); - } - - // Deprecated [opaque pointer types] - CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args, - ArrayRef<OperandBundleDef> OpBundles, - const Twine &Name = "", MDNode *FPMathTag = nullptr) { - return CreateCall( - cast<FunctionType>(Callee->getType()->getPointerElementType()), Callee, - Args, OpBundles, Name, FPMathTag); - } - CallInst *CreateConstrainedFPCall( Function *Callee, ArrayRef<Value *> Args, const Twine &Name = "", Optional<fp::RoundingMode> Rounding = None, Index: clang/lib/CodeGen/CGCleanup.cpp =================================================================== --- clang/lib/CodeGen/CGCleanup.cpp +++ 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; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits