@@ -951,8 +951,7 @@ bool GenXLowering::splitGatherScatter(CallInst *CI, unsigned IID) {
951951 if (IdxMax != NONEED)
952952 Tys.push_back (Args[IdxMax]->getType ());
953953
954- auto Decl = GenXIntrinsic::getAnyDeclaration (
955- CI->getParent ()->getParent ()->getParent (), IID, Tys);
954+ auto Decl = GenXIntrinsic::getAnyDeclaration (CI->getModule (), IID, Tys);
956955 auto *Gather = CallInst::Create (Decl, Args, CI->getName () + " .split" , CI);
957956 Gather->setDebugLoc (DL);
958957 if (IsNewLoad) {
@@ -992,8 +991,7 @@ bool GenXLowering::splitGatherScatter(CallInst *CI, unsigned IID) {
992991 // Create the target-wide scatter instructions.
993992 Type *Tys[] = {Args[PredIdx]->getType (), Args[AddrIdx]->getType (),
994993 Args[DataIdx]->getType ()};
995- auto Decl = GenXIntrinsic::getAnyDeclaration (
996- CI->getParent ()->getParent ()->getParent (), IID, Tys);
994+ auto Decl = GenXIntrinsic::getAnyDeclaration (CI->getModule (), IID, Tys);
997995 auto NewInst = CallInst::Create (Decl, Args, " " , CI);
998996 NewInst->setDebugLoc (DL);
999997 }
@@ -2997,7 +2995,7 @@ bool LoadStoreResolver::emitGather() {
29972995
29982996 // Overload with return type, predicate type and element offset type
29992997 Type *Tys[] = {OldVal->getType (), Args[0 ]->getType (), EltOffsetTy};
3000- Module *M = Inst->getParent ()-> getParent ()-> getParent ();
2998+ Module *M = Inst->getModule ();
30012999 auto Fn = GenXIntrinsic::getGenXDeclaration (M, GenXIntrinsic::genx_gather_scaled, Tys);
30023000
30033001 Value *NewVal = Builder.CreateCall (Fn, Args);
@@ -3058,7 +3056,7 @@ bool LoadStoreResolver::emitScatter() {
30583056
30593057 // Overload with predicate type, element offset type, value to write type.
30603058 Type *Tys[] = {Args[0 ]->getType (), EltOffsetTy, Val->getType ()};
3061- Module *M = Inst->getParent ()-> getParent ()-> getParent ();
3059+ Module *M = Inst->getModule ();
30623060 auto Fn = GenXIntrinsic::getGenXDeclaration (M, GenXIntrinsic::genx_scatter_scaled, Tys);
30633061 Builder.CreateCall (Fn, Args);
30643062 return true ;
@@ -3114,7 +3112,7 @@ bool LoadStoreResolver::emitSVMGather() {
31143112
31153113 // Overload with return type, predicate type and address vector type
31163114 Type *Tys[] = {OldVal->getType (), Args[0 ]->getType (), Addr->getType ()};
3117- Module *M = Inst->getParent ()-> getParent ()-> getParent ();
3115+ Module *M = Inst->getModule ();
31183116 auto Fn = GenXIntrinsic::getGenXDeclaration (M, GenXIntrinsic::genx_svm_gather, Tys);
31193117
31203118 Value *NewVal = Builder.CreateCall (Fn, Args);
@@ -3161,7 +3159,7 @@ bool LoadStoreResolver::emitSVMScatter() {
31613159
31623160 // Overload with predicate type, address vector type, and data type
31633161 Type *Tys[] = {Args[0 ]->getType (), Addr->getType (), Val->getType ()};
3164- Module *M = Inst->getParent ()-> getParent ()-> getParent ();
3162+ Module *M = Inst->getModule ();
31653163 auto Fn = GenXIntrinsic::getGenXDeclaration (M, GenXIntrinsic::genx_svm_scatter, Tys);
31663164
31673165 Builder.CreateCall (Fn, Args);
0 commit comments