Skip to content

Commit

Permalink
Remove noinf for fdiv by 0 in FastMath Handling
Browse files Browse the repository at this point in the history
Remove noinf for fdiv by 0 in FastMathConstantHandling pass
  • Loading branch information
pmkippes authored and igcbot committed Sep 26, 2023
1 parent ef2bc1d commit 21e69c0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions IGC/AdaptorCommon/FastMathConstantHandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class FastMathConstantHandling : public FunctionPass, public InstVisitor<FastMat
#if LLVM_VERSION_MAJOR >= 10
void visitFNeg(Instruction& I);
#endif
void visitFDiv(Instruction& I);
virtual llvm::StringRef getPassName() const override { return "Fast Math Constant Handling"; }

void getAnalysisUsage(AnalysisUsage& AU) const override
Expand Down Expand Up @@ -102,6 +103,15 @@ void FastMathConstantHandling::visitFNeg(Instruction& I)
}
#endif

void FastMathConstantHandling::visitFDiv(Instruction& I)
{
if (auto* fp_val = dyn_cast<llvm::ConstantFP>(I.getOperand(1));
fp_val && fp_val->getValueAPF().isZero())
{
I.setHasNoInfs(false);
}
}

bool FastMathConstantHandling::runOnFunction(Function& F)
{
if (IGC_IS_FLAG_DISABLED(DisableFastMathConstantHandling))
Expand Down

0 comments on commit 21e69c0

Please sign in to comment.