Skip to content

Commit f69365b

Browse files
traoux1gfxbot
traoux1
authored andcommitted
enable custoim safe pass in order to remove bitcast instructions
Change-Id: I65240f5b09205bcc3f2c2bac9c77d3d1c853e9d4
1 parent 5f4cfaa commit f69365b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,9 +1142,9 @@ void OptimizeIR(CodeGenContext* pContext)
11421142
mpm.add(new BreakConstantExpr());
11431143
mpm.add(new IGCConstProp(!pContext->m_DriverInfo.SupportsPreciseMath()));
11441144

1145+
mpm.add(new CustomSafeOptPass());
11451146
if(!pContext->m_DriverInfo.WADisableCustomPass())
11461147
{
1147-
mpm.add(new CustomSafeOptPass());
11481148
mpm.add(new CustomUnsafeOptPass());
11491149
}
11501150

@@ -1300,9 +1300,9 @@ void OptimizeIR(CodeGenContext* pContext)
13001300
mpm.add(CreateEarlyOutPatternsPass());
13011301
mpm.add(createBlendToDiscardPass());
13021302
}
1303+
mpm.add(new CustomSafeOptPass());
13031304
if (!pContext->m_DriverInfo.WADisableCustomPass())
13041305
{
1305-
mpm.add(new CustomSafeOptPass());
13061306
mpm.add(new CustomUnsafeOptPass());
13071307
}
13081308
}

IGC/Compiler/CustomSafeOptPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ void CustomSafeOptPass::visitAllocaInst(AllocaInst &I)
186186
if (GetElementPtrInst *pGEP = llvm::dyn_cast<GetElementPtrInst>(*it))
187187
{
188188
ConstantInt *C0 = dyn_cast<ConstantInt>(pGEP->getOperand(1));
189-
if (!C0 || !C0->isZero())
189+
if (!C0 || !C0->isZero() || pGEP->getNumOperands() != 3)
190190
{
191191
return;
192192
}

0 commit comments

Comments
 (0)