mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[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
c605d833fa
commit
49724f85ec
@ -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
Block a user