Skip to content

Commit a51af24

Browse files
jgu222gfxbot
authored andcommitted
Alias root or non-alias variable needs to be handled normally.
Only alias variable needs to be handled specially Change-Id: I0034ab892184b1e40b9fbea9ae8191701d34bcf9
1 parent ee1491b commit a51af24

File tree

2 files changed

+29
-17
lines changed

2 files changed

+29
-17
lines changed

IGC/Compiler/CISACodeGen/CShader.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,22 +2281,23 @@ CVariable* CShader::GetSymbol(llvm::Value *value, bool fromConstantPool)
22812281
return it->second;
22822282
}
22832283

2284-
if (IGC_IS_FLAG_ENABLED(EnableDeSSAAlias) && m_deSSA->isAlias(value))
2284+
if (IGC_IS_FLAG_ENABLED(EnableDeSSAAlias))
22852285
{
22862286
// Generate CVariable alias.
22872287
// Value and its aliasee must be of the same size.
22882288
Value* Aliasee = m_deSSA->getAliasee(value);
2289-
CVariable *Base = GetSymbol(Aliasee);
2290-
if (Aliasee == value) {
2291-
return Base;
2292-
}
2293-
Type *Ty = value->getType();
2294-
VectorType* VTy = dyn_cast<VectorType>(Ty);
2295-
Type *BTy = VTy ? VTy->getElementType() : Ty;
2296-
VISA_Type visaTy = GetType(BTy);
2297-
CVariable* AliasVar = GetNewAlias(Base, visaTy, 0, Base->GetNumberElement());
2298-
symbolMapping.insert(std::pair<llvm::Value*, CVariable*>(value, AliasVar));
2299-
return AliasVar;
2289+
if (Aliasee != value)
2290+
{
2291+
// An aliaser
2292+
CVariable *Base = GetSymbol(Aliasee);
2293+
Type *Ty = value->getType();
2294+
VectorType* VTy = dyn_cast<VectorType>(Ty);
2295+
Type *BTy = VTy ? VTy->getElementType() : Ty;
2296+
VISA_Type visaTy = GetType(BTy);
2297+
CVariable* AliasVar = GetNewAlias(Base, visaTy, 0, Base->GetNumberElement());
2298+
symbolMapping.insert(std::pair<llvm::Value*, CVariable*>(value, AliasVar));
2299+
return AliasVar;
2300+
}
23002301
}
23012302

23022303
if (IGC_IS_FLAG_ENABLED(EnableVariableAlias))

IGC/Compiler/CISACodeGen/DeSSA.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -968,11 +968,22 @@ DeSSA::CoalesceInsertElementsForBasicBlock(BasicBlock *Blk)
968968

969969
Value* DeSSA::getRootValue(Value* Val, e_alignment *pAlign) const
970970
{
971-
auto RI = InsEltMap.find(Val);
972-
if (RI != InsEltMap.end()) {
973-
Value *InsEltRoot = RI->second;
974-
Value *PhiRootVal = getRegRoot(InsEltRoot, pAlign);
975-
return (PhiRootVal ? PhiRootVal : InsEltRoot);
971+
if (IGC_IS_FLAG_ENABLED(EnableDeSSAAlias))
972+
{
973+
auto AI = AliasMap.find(Val);
974+
if (AI != AliasMap.end()) {
975+
Value *Aliasee = AI->second;
976+
Value *PhiRootVal = getRegRoot(Aliasee, pAlign);
977+
return (PhiRootVal ? PhiRootVal : Aliasee);
978+
}
979+
}
980+
else {
981+
auto RI = InsEltMap.find(Val);
982+
if (RI != InsEltMap.end()) {
983+
Value *InsEltRoot = RI->second;
984+
Value *PhiRootVal = getRegRoot(InsEltRoot, pAlign);
985+
return (PhiRootVal ? PhiRootVal : InsEltRoot);
986+
}
976987
}
977988
return getRegRoot(Val, pAlign);
978989
}

0 commit comments

Comments
 (0)