Skip to content

Commit f6da5ea

Browse files
committed
!fixup add message, refactor constructor
1 parent 7d6628b commit f6da5ea

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

llvm/include/llvm/Analysis/IVDescriptors.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,15 @@ class RecurrenceDescriptor {
9393

9494
RecurrenceDescriptor(Value *Start, Instruction *Exit, StoreInst *Store,
9595
RecurKind K, FastMathFlags FMF, Instruction *ExactFP,
96-
Type *RT, bool Signed, bool Ordered,
97-
SmallPtrSetImpl<Instruction *> &CI,
98-
unsigned MinWidthCastToRecurTy)
96+
Type *RT, bool Signed = false, bool Ordered = false,
97+
const SmallPtrSetImpl<Instruction *> *CI = nullptr,
98+
unsigned MinWidthCastToRecurTy = -1U)
9999
: IntermediateStore(Store), StartValue(Start), LoopExitInstr(Exit),
100100
Kind(K), FMF(FMF), ExactFPMathInst(ExactFP), RecurrenceType(RT),
101101
IsSigned(Signed), IsOrdered(Ordered),
102102
MinWidthCastToRecurrenceType(MinWidthCastToRecurTy) {
103-
CastInsts.insert_range(CI);
103+
if (CI)
104+
CastInsts.insert_range(*CI);
104105
}
105106

106107
/// This POD struct holds information about a potential recurrence operation.

llvm/lib/Analysis/IVDescriptors.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ static RecurrenceDescriptor getMinMaxRecurrence(PHINode *Phi, Loop *TheLoop,
389389
return RecurrenceDescriptor(
390390
Phi->getIncomingValueForBlock(TheLoop->getLoopPreheader()),
391391
cast<Instruction>(RdxNext), IntermediateStore, RK, FMF, nullptr,
392-
Phi->getType(), false, false, Casts, -1U);
392+
Phi->getType());
393393
}
394394

395395
bool RecurrenceDescriptor::AddReductionVar(
@@ -753,7 +753,7 @@ bool RecurrenceDescriptor::AddReductionVar(
753753
// Save the description of this reduction variable.
754754
RecurrenceDescriptor RD(RdxStart, ExitInstruction, IntermediateStore, Kind,
755755
FMF, ExactFPMathInst, RecurrenceType, IsSigned,
756-
IsOrdered, CastInsts, MinWidthCastToRecurrenceType);
756+
IsOrdered, &CastInsts, MinWidthCastToRecurrenceType);
757757
RedDes = RD;
758758

759759
return true;
@@ -1105,7 +1105,7 @@ bool RecurrenceDescriptor::isReductionPHI(PHINode *Phi, Loop *TheLoop,
11051105
if (RD.getRecurrenceKind() != RecurKind::None) {
11061106
assert(
11071107
RecurrenceDescriptor::isMinMaxRecurrenceKind(RD.getRecurrenceKind()) &&
1108-
"must return a min/max recurrence kind");
1108+
"Expected a min/max recurrence kind");
11091109
LLVM_DEBUG(dbgs() << "Found a min/max reduction PHI." << *Phi << "\n");
11101110
RedDes = RD;
11111111
return true;

0 commit comments

Comments
 (0)