[llvm-branch-commits] [llvm] e90ea76 - [IR] remove 'NoNan' param when creating FP reductions
Sanjay Patel via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Dec 30 06:56:17 PST 2020
Author: Sanjay Patel
Date: 2020-12-30T09:51:23-05:00
New Revision: e90ea76380d411bf81861228f23e4716ef337100
URL: https://github.com/llvm/llvm-project/commit/e90ea76380d411bf81861228f23e4716ef337100
DIFF: https://github.com/llvm/llvm-project/commit/e90ea76380d411bf81861228f23e4716ef337100.diff
LOG: [IR] remove 'NoNan' param when creating FP reductions
This is no-functional-change-intended (AFAIK, we can't
isolate this difference in a regression test).
That's because the callers should be setting the IRBuilder's
FMF field when creating the reduction and/or setting those
flags after creating. It doesn't make sense to override this
one flag alone.
This is part of a multi-step process to clean up the FMF
setting/propagation. See PR35538 for an example.
Added:
Modified:
llvm/include/llvm/IR/IRBuilder.h
llvm/lib/IR/IRBuilder.cpp
llvm/lib/Transforms/Utils/LoopUtils.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index 4b26299d046c..c9074abe88c2 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -779,11 +779,11 @@ class IRBuilderBase {
/// Create a vector float max reduction intrinsic of the source
/// vector.
- CallInst *CreateFPMaxReduce(Value *Src, bool NoNaN = false);
+ CallInst *CreateFPMaxReduce(Value *Src);
/// Create a vector float min reduction intrinsic of the source
/// vector.
- CallInst *CreateFPMinReduce(Value *Src, bool NoNaN = false);
+ CallInst *CreateFPMinReduce(Value *Src);
/// Create a lifetime.start intrinsic.
///
diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp
index e8fa35314a94..51e289165590 100644
--- a/llvm/lib/IR/IRBuilder.cpp
+++ b/llvm/lib/IR/IRBuilder.cpp
@@ -380,24 +380,12 @@ CallInst *IRBuilderBase::CreateIntMinReduce(Value *Src, bool IsSigned) {
return getReductionIntrinsic(this, ID, Src);
}
-CallInst *IRBuilderBase::CreateFPMaxReduce(Value *Src, bool NoNaN) {
- auto Rdx = getReductionIntrinsic(this, Intrinsic::vector_reduce_fmax, Src);
- if (NoNaN) {
- FastMathFlags FMF;
- FMF.setNoNaNs();
- Rdx->setFastMathFlags(FMF);
- }
- return Rdx;
+CallInst *IRBuilderBase::CreateFPMaxReduce(Value *Src) {
+ return getReductionIntrinsic(this, Intrinsic::vector_reduce_fmax, Src);
}
-CallInst *IRBuilderBase::CreateFPMinReduce(Value *Src, bool NoNaN) {
- auto Rdx = getReductionIntrinsic(this, Intrinsic::vector_reduce_fmin, Src);
- if (NoNaN) {
- FastMathFlags FMF;
- FMF.setNoNaNs();
- Rdx->setFastMathFlags(FMF);
- }
- return Rdx;
+CallInst *IRBuilderBase::CreateFPMinReduce(Value *Src) {
+ return getReductionIntrinsic(this, Intrinsic::vector_reduce_fmin, Src);
}
CallInst *IRBuilderBase::CreateLifetimeStart(Value *Ptr, ConstantInt *Size) {
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index 80ae6b37e132..a3665a5636e5 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -1039,10 +1039,10 @@ Value *llvm::createSimpleTargetReduction(
case Instruction::FCmp:
if (Flags.IsMaxOp) {
MinMaxKind = RD::MRK_FloatMax;
- BuildFunc = [&]() { return Builder.CreateFPMaxReduce(Src, Flags.NoNaN); };
+ BuildFunc = [&]() { return Builder.CreateFPMaxReduce(Src); };
} else {
MinMaxKind = RD::MRK_FloatMin;
- BuildFunc = [&]() { return Builder.CreateFPMinReduce(Src, Flags.NoNaN); };
+ BuildFunc = [&]() { return Builder.CreateFPMinReduce(Src); };
}
break;
default:
More information about the llvm-branch-commits
mailing list