Skip to content

Commit 9f5c9ae

Browse files
mmereckisys_zuul
authored andcommitted
Move "IgnoreNaN" setting from DriverInfo to context (compilation option).
Change-Id: Ied9bba8ce983e1ba7ce6aad7a58013be73049f5a
1 parent db13dba commit 9f5c9ae

File tree

6 files changed

+6
-11
lines changed

6 files changed

+6
-11
lines changed

IGC/Compiler/CISACodeGen/DriverInfo.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ namespace IGC
9595
/// The driver implements single instance vertex dispatch feature
9696
virtual bool SupportsSingleInstanceVertexDispatch() const { return false; }
9797

98-
/// We can safely ignore Nan
99-
virtual bool IgnoreNan() const { return false; }
100-
10198
// Allow branch swapping for better Nan perf
10299
virtual bool BranchSwapping() const { return false; }
103100

IGC/Compiler/CISACodeGen/GenIRLowering.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,6 @@ bool GenIRLowering::runOnFunction(Function& F) {
286286
if (FII == MDU->end_FunctionsInfo())
287287
return false;
288288

289-
CodeGenContextWrapper* pCtxWrapper = &getAnalysis<CodeGenContextWrapper>();
290-
CodeGenContext* ctx = pCtxWrapper->getCodeGenContext();
291-
292289
auto &DL = F.getParent()->getDataLayout();
293290

294291
BuilderTy TheBuilder(F.getContext(), TargetFolder(DL));
@@ -397,7 +394,7 @@ bool GenIRLowering::runOnFunction(Function& F) {
397394
break;
398395
case Instruction::Select:
399396
// Enable the pattern match only when NaNs can be ignored.
400-
if (ctx->m_DriverInfo.IgnoreNan() ||
397+
if (modMD->compOpt.NoNaNs ||
401398
modMD->compOpt.FiniteMathOnly)
402399
{
403400
Changed |= combineSelectInst(cast<SelectInst>(Inst), BI);

IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ namespace IGC
626626

627627
// TODO: move to use instruction flags
628628
// to figure out if we need to preserve Nan
629-
bool preserveNan = !ctx.m_DriverInfo.IgnoreNan();
629+
bool preserveNan = !ctx.getCompilerOption().NoNaNs;
630630

631631
// Legalizer does not handle constant expressions
632632
mpm.add(new BreakConstantExpr());

IGC/Compiler/CustomSafeOptPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ void GenSpecificPattern::visitCmpInst(CmpInst& I)
17251725
else
17261726
{
17271727
CodeGenContext* pCtx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
1728-
if (pCtx->m_DriverInfo.IgnoreNan())
1728+
if (pCtx->getCompilerOption().NoNaNs)
17291729
{
17301730
if (I.getPredicate() == CmpInst::FCMP_ORD)
17311731
{

IGC/Compiler/CustomUnsafeOptPass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,7 +1996,7 @@ void CustomUnsafeOptPass::visitFCmpInst(FCmpInst& FC)
19961996
}
19971997
if (FC.getPredicate() == CmpInst::FCMP_UNO)
19981998
{
1999-
if (m_ctx->m_DriverInfo.IgnoreNan())
1999+
if (m_ctx->getCompilerOption().NoNaNs)
20002000
{
20012001
FC.replaceAllUsesWith(ConstantInt::getFalse(FC.getType()));
20022002
FC.eraseFromParent();
@@ -2006,7 +2006,7 @@ void CustomUnsafeOptPass::visitFCmpInst(FCmpInst& FC)
20062006
}
20072007
else if (FC.getPredicate() == CmpInst::FCMP_ORD)
20082008
{
2009-
if (m_ctx->m_DriverInfo.IgnoreNan())
2009+
if (m_ctx->getCompilerOption().NoNaNs)
20102010
{
20112011
FC.replaceAllUsesWith(ConstantInt::getTrue(FC.getType()));
20122012
FC.eraseFromParent();

IGC/common/MDFrameWork.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ namespace IGC
190190
bool OptDisable = false;
191191
bool MadEnable = false;
192192
bool NoSignedZeros = false;
193+
bool NoNaNs = false;
193194

194195
// default rounding modes
195196
unsigned FloatRoundingMode = IGC::ROUND_TO_NEAREST_EVEN;

0 commit comments

Comments
 (0)