forked from OSchip/llvm-project
[LoopUtils] reorder logic for creating reduction; NFC
If we are using a shuffle reduction, we don't need to go through the switch on opcode - return early.
This commit is contained in:
parent
92be640bd7
commit
58b6c5d932
|
@ -982,6 +982,15 @@ Value *llvm::createSimpleTargetReduction(IRBuilderBase &Builder,
|
|||
unsigned Opcode, Value *Src,
|
||||
RecurKind RdxKind,
|
||||
ArrayRef<Value *> RedOps) {
|
||||
TargetTransformInfo::ReductionFlags RdxFlags;
|
||||
RdxFlags.IsMaxOp = RdxKind == RecurKind::SMax ||
|
||||
RdxKind == RecurKind::UMax ||
|
||||
RdxKind == RecurKind::FMax;
|
||||
RdxFlags.IsSigned = RdxKind == RecurKind::SMax || RdxKind == RecurKind::SMin;
|
||||
if (!ForceReductionIntrinsic &&
|
||||
!TTI->useReductionIntrinsic(Opcode, Src->getType(), RdxFlags))
|
||||
return getShuffleReduction(Builder, Src, Opcode, RdxKind, RedOps);
|
||||
|
||||
auto *SrcVTy = cast<VectorType>(Src->getType());
|
||||
|
||||
std::function<Value *()> BuildFunc;
|
||||
|
@ -1044,15 +1053,7 @@ Value *llvm::createSimpleTargetReduction(IRBuilderBase &Builder,
|
|||
default:
|
||||
llvm_unreachable("Unhandled opcode");
|
||||
}
|
||||
TargetTransformInfo::ReductionFlags RdxFlags;
|
||||
RdxFlags.IsMaxOp = RdxKind == RecurKind::SMax ||
|
||||
RdxKind == RecurKind::UMax ||
|
||||
RdxKind == RecurKind::FMax;
|
||||
RdxFlags.IsSigned = RdxKind == RecurKind::SMax || RdxKind == RecurKind::SMin;
|
||||
if (ForceReductionIntrinsic ||
|
||||
TTI->useReductionIntrinsic(Opcode, Src->getType(), RdxFlags))
|
||||
return BuildFunc();
|
||||
return getShuffleReduction(Builder, Src, Opcode, RdxKind, RedOps);
|
||||
return BuildFunc();
|
||||
}
|
||||
|
||||
Value *llvm::createTargetReduction(IRBuilderBase &B,
|
||||
|
|
Loading…
Reference in New Issue