Skip to content

Commit 229c176

Browse files
[ESIMD][NFC] Do not take type for CreateLoad from pointer (#3567)
* [ESIMD][NFC] Do not take type for CreateLoad from pointer
1 parent c8544f1 commit 229c176

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

llvm/lib/SYCLLowerIR/LowerESIMD.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,8 +730,7 @@ static bool translateVLoad(CallInst &CI, SmallPtrSet<Type *, 4> &GVTS) {
730730
if (GVTS.find(CI.getType()) != GVTS.end())
731731
return false;
732732
IRBuilder<> Builder(&CI);
733-
auto *ElemT = CI.getArgOperand(0)->getType()->getPointerElementType();
734-
auto LI = Builder.CreateLoad(ElemT, CI.getArgOperand(0), CI.getName());
733+
auto LI = Builder.CreateLoad(CI.getType(), CI.getArgOperand(0), CI.getName());
735734
LI->setDebugLoc(CI.getDebugLoc());
736735
CI.replaceAllUsesWith(LI);
737736
return true;

llvm/lib/SYCLLowerIR/LowerESIMDVLoadVStore.cpp

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ PreservedAnalyses ESIMDLowerLoadStorePass::run(Function &F,
8989
if (GenXIntrinsic::isVStore(&Inst))
9090
Builder.CreateStore(Inst.getOperand(0), Inst.getOperand(1));
9191
else {
92-
auto *ElemT = Inst.getOperand(0)->getType()->getPointerElementType();
93-
auto LI = Builder.CreateLoad(ElemT, Inst.getOperand(0), Inst.getName());
92+
auto LI = Builder.CreateLoad(Inst.getType(), Inst.getOperand(0),
93+
Inst.getName());
9494
LI->setDebugLoc(Inst.getDebugLoc());
9595
Inst.replaceAllUsesWith(LI);
9696
}

llvm/lib/SYCLLowerIR/LowerWGScope.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,7 @@ shareOutputViaLocalMem(Instruction &I, BasicBlock &BBa, BasicBlock &BBb,
303303
Bld.CreateStore(&I, WGLocal);
304304
// 3) Generate a load in the "worker" BB of the value stored by the leader
305305
Bld.SetInsertPoint(&BBb.front());
306-
auto *WGValT = WGLocal->getType()->getPointerElementType();
307-
auto *WGVal = Bld.CreateLoad(WGValT, WGLocal, "wg_val_" + Twine(I.getName()));
306+
auto *WGVal = Bld.CreateLoad(T, WGLocal, "wg_val_" + Twine(I.getName()));
308307
// 4) Finally, replace usages of I outside the scope
309308
for (auto *U : Users)
310309
U->replaceUsesOfWith(&I, WGVal);
@@ -417,8 +416,7 @@ static void copyBetweenPrivateAndShadow(Value *L, GlobalVariable *Shadow,
417416

418417
if (!Loc2Shadow)
419418
std::swap(Src, Dst);
420-
auto *SrcT = Src->getType()->getPointerElementType();
421-
Value *LocalVal = Builder.CreateLoad(SrcT, Src, "mat_ld");
419+
Value *LocalVal = Builder.CreateLoad(T, Src, "mat_ld");
422420
Builder.CreateStore(LocalVal, Dst);
423421
}
424422
}

0 commit comments

Comments
 (0)