Skip to content

Commit 2601acc

Browse files
jgu222gfxbot
authored andcommitted
Use a ptr type as std::list's template class type
Change-Id: Iac5503def6fc8dd1b930610d51541dc5c8e44836
1 parent 5ed8d56 commit 2601acc

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

+18-17
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,8 @@ void EmitPass::MovPhiSources(llvm::BasicBlock* aBB)
902902
Value* dstRootV; // root value of dst (dessa)
903903
Value* srcRootV; // root value of src (dessa)
904904
};
905-
std::list<PhiSrcMoveInfo> phiSrcDstList;
905+
BumpPtrAllocator phiAllocator;
906+
std::list<PhiSrcMoveInfo*> phiSrcDstList;
906907
std::vector<std::pair<CVariable*, CVariable*>> emitList;
907908
std::map<CVariable*, unsigned int> dstVTyMap;
908909
llvm::BasicBlock *bb = aBB;
@@ -1003,19 +1004,19 @@ void EmitPass::MovPhiSources(llvm::BasicBlock* aBB)
10031004
// might have the same variable with two different CVariable.
10041005
if (dstRootV != srcRootV)
10051006
{
1006-
phiSrcDstList.push_back(PhiSrcMoveInfo());
1007-
PhiSrcMoveInfo& phiInfo = phiSrcDstList.back();
1008-
phiInfo.dstCVar = m_currShader->GetSymbol(PN);
1009-
phiInfo.srcCVar = m_currShader->GetSymbol(Src);
1010-
phiInfo.dstRootV = dstRootV;
1011-
phiInfo.srcRootV = srcRootV;
1007+
PhiSrcMoveInfo* phiInfo = new (phiAllocator) PhiSrcMoveInfo();
1008+
phiInfo->dstCVar = m_currShader->GetSymbol(PN);
1009+
phiInfo->srcCVar = m_currShader->GetSymbol(Src);
1010+
phiInfo->dstRootV = dstRootV;
1011+
phiInfo->srcRootV = srcRootV;
1012+
phiSrcDstList.push_back(phiInfo);
10121013

10131014
int numElt = 0;
10141015
if (VectorType *vTy = dyn_cast<VectorType>(PN->getType()))
10151016
{
10161017
numElt = int_cast<int>(vTy->getNumElements());
10171018
}
1018-
dstVTyMap.insert(std::pair<CVariable*, unsigned int>(phiInfo.dstCVar, numElt));
1019+
dstVTyMap.insert(std::pair<CVariable*, unsigned int>(phiInfo->dstCVar, numElt));
10191020
}
10201021
}
10211022
}
@@ -1039,9 +1040,9 @@ void EmitPass::MovPhiSources(llvm::BasicBlock* aBB)
10391040
auto Et = phiSrcDstList.end();
10401041
for (; It != Et; ++It)
10411042
{
1042-
auto Cmp = [=](const PhiSrcMoveInfo& Val)
1043+
auto Cmp = [&](const PhiSrcMoveInfo* Val)
10431044
{
1044-
return Val.srcRootV == It->dstRootV;
1045+
return Val->srcRootV == (*It)->dstRootV;
10451046
};
10461047

10471048
if (0 == std::count_if(phiSrcDstList.begin(), phiSrcDstList.end(), Cmp))
@@ -1065,8 +1066,8 @@ void EmitPass::MovPhiSources(llvm::BasicBlock* aBB)
10651066
// the entry becomes the one to be added into emitList.
10661067
It = phiSrcDstList.begin();
10671068

1068-
Value* dRootV = It->dstRootV;
1069-
CVariable* D1 = It->dstCVar;
1069+
Value* dRootV = (*It)->dstRootV;
1070+
CVariable* D1 = (*It)->dstCVar;
10701071
CVariable* T = m_currShader->GetNewVariable(D1);
10711072
dstVTyMap[T] = dstVTyMap[D1];
10721073
emitList.push_back(std::pair<CVariable*, CVariable*>(D1, T));
@@ -1075,9 +1076,9 @@ void EmitPass::MovPhiSources(llvm::BasicBlock* aBB)
10751076
auto LI = It, LE = phiSrcDstList.end();
10761077
for (++LI; LI != LE; ++LI)
10771078
{
1078-
PhiSrcMoveInfo& phiinfo = *LI;
1079-
if (phiinfo.srcRootV == dRootV) {
1080-
CVariable* sVar = phiinfo.srcCVar;
1079+
PhiSrcMoveInfo* phiinfo = *LI;
1080+
if (phiinfo->srcRootV == dRootV) {
1081+
CVariable* sVar = phiinfo->srcCVar;
10811082
CVariable* nVar;
10821083
if (sVar->GetType() != T->GetType()) {
10831084
nVar = m_currShader->GetNewAlias(
@@ -1086,12 +1087,12 @@ void EmitPass::MovPhiSources(llvm::BasicBlock* aBB)
10861087
else {
10871088
nVar = T;
10881089
}
1089-
phiinfo.srcCVar = nVar;
1090+
phiinfo->srcCVar = nVar;
10901091
}
10911092
}
10921093
}
10931094
assert(It != Et);
1094-
emitList.push_back(std::pair<CVariable*, CVariable*>(It->srcCVar, It->dstCVar));
1095+
emitList.push_back(std::pair<CVariable*, CVariable*>((*It)->srcCVar, (*It)->dstCVar));
10951096
phiSrcDstList.erase(It);
10961097
}
10971098
// emit the src-side phi-moves

0 commit comments

Comments
 (0)