forked from OSchip/llvm-project
[SLP] createOp - fix null dereference warning. NFCI.
Only attempt to propagateIRFlags if we have both SelectInst - afaict we shouldn't have matched a min/max reduction without both SelectInst, but static analyzer doesn't know that.
This commit is contained in:
parent
cca40aa8d8
commit
b49c41afba
|
@ -6696,13 +6696,14 @@ class HorizontalReduction {
|
|||
propagateIRFlags(Op, ReductionOps[0]);
|
||||
return Op;
|
||||
}
|
||||
|
||||
/// Creates reduction operation with the current opcode with the IR flags
|
||||
/// from \p I.
|
||||
static Value *createOp(IRBuilder<> &Builder, RecurKind RdxKind, Value *LHS,
|
||||
Value *RHS, const Twine &Name, Instruction *I) {
|
||||
auto *SelI = dyn_cast<SelectInst>(I);
|
||||
Value *Op = createOp(Builder, RdxKind, LHS, RHS, Name, SelI != nullptr);
|
||||
if (RecurrenceDescriptor::isIntMinMaxRecurrenceKind(RdxKind)) {
|
||||
if (SelI && RecurrenceDescriptor::isIntMinMaxRecurrenceKind(RdxKind)) {
|
||||
if (auto *Sel = dyn_cast<SelectInst>(Op))
|
||||
propagateIRFlags(Sel->getCondition(), SelI->getCondition());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue