@@ -122,7 +122,7 @@ StringRef getStringLiteralArg(const CallInst *CI, unsigned ArgNo,
122122 V = ASC->getPointerOperand ()->stripPointerCasts ();
123123 using namespace PatternMatch ;
124124 Value *X;
125- if (match (V, m_IntToPtr ( m_Add ( m_PtrToInt ( m_Value (X)), m_ConstantInt () ))))
125+ if (match (V, m_PtrAdd ( m_Value (X), m_Constant ( ))))
126126 V = X;
127127 return isa<AllocaInst>(V);
128128 };
@@ -541,7 +541,8 @@ Instruction *emitCall(Type *RetTy, StringRef BaseFunctionName,
541541 // types? Is it necessary?
542542
543543 FunctionCallee FC = M->getOrInsertFunction (FunctionName, FT);
544- auto *Call = CallInst::Create (FT, FC.getCallee (), Args, " " , InsertBefore);
544+ auto *Call = CallInst::Create (FT, FC.getCallee (), Args, " " ,
545+ InsertBefore->getIterator ());
545546 if (IsSPIROrSPIRV) {
546547 cast<Function>(FC.getCallee ())->setCallingConv (CallingConv::SPIR_FUNC);
547548 Call->setCallingConv (CallingConv::SPIR_FUNC);
@@ -724,9 +725,8 @@ Value *createLoadFromBuffer(CallInst *InsertBefore, Value *Buffer,
724725 if (SCType->isIntegerTy (1 )) // No bitcast to i1 before load
725726 BitCast = GEP;
726727 else
727- BitCast =
728- new BitCastInst (GEP, PointerType::get (SCType, GEP->getAddressSpace ()),
729- " bc" , InsertBefore->getIterator ());
728+ BitCast = new BitCastInst (GEP, PointerType::get (C, GEP->getAddressSpace ()),
729+ " bc" , InsertBefore->getIterator ());
730730
731731 // When we encounter i1 spec constant, we still load the whole byte
732732 Value *Load = new LoadInst (SCType->isIntegerTy (1 ) ? Int8Ty : SCType, BitCast,
@@ -831,8 +831,8 @@ void updatePaddingInLastMDNode(LLVMContext &Ctx,
831831// / type.
832832void createStoreInstructionIntoSpecConstValue (Value *Dst, Value *V,
833833 CallInst *InsertBefore) {
834- Type *PointerType =
835- PointerType::get ( V->getType (), Dst->getType ()->getPointerAddressSpace ());
834+ Type *PointerType = PointerType::get (
835+ V->getContext (), Dst->getType ()->getPointerAddressSpace ());
836836 IRBuilder B (InsertBefore);
837837 Value *Bitcast = B.CreateBitCast (Dst, PointerType);
838838 B.CreateStore (V, Bitcast);
0 commit comments