@@ -313,8 +313,7 @@ class ConstraintInfo {
313313 // / New variables that need to be added to the system are collected in
314314 // / \p NewVariables.
315315 ConstraintTy getConstraint (CmpInst::Predicate Pred, Value *Op0, Value *Op1,
316- SmallVectorImpl<Value *> &NewVariables,
317- bool ForceSignedSystem = false ) const ;
316+ SmallVectorImpl<Value *> &NewVariables) const ;
318317
319318 // / Turns a comparison of the form \p Op0 \p Pred \p Op1 into a vector of
320319 // / constraints using getConstraint. Returns an empty constraint if the result
@@ -331,14 +330,6 @@ class ConstraintInfo {
331330 void transferToOtherSystem (CmpInst::Predicate Pred, Value *A, Value *B,
332331 unsigned NumIn, unsigned NumOut,
333332 SmallVectorImpl<StackEntry> &DFSInStack);
334-
335- private:
336- // / Adds facts into constraint system. \p ForceSignedSystem can be set when
337- // / the \p Pred is eq/ne, and signed constraint system is used when it's
338- // / specified.
339- void addFactImpl (CmpInst::Predicate Pred, Value *A, Value *B, unsigned NumIn,
340- unsigned NumOut, SmallVectorImpl<StackEntry> &DFSInStack,
341- bool ForceSignedSystem);
342333};
343334
344335// / Represents a (Coefficient * Variable) entry after IR decomposition.
@@ -645,12 +636,8 @@ static Decomposition decompose(Value *V,
645636
646637ConstraintTy
647638ConstraintInfo::getConstraint (CmpInst::Predicate Pred, Value *Op0, Value *Op1,
648- SmallVectorImpl<Value *> &NewVariables,
649- bool ForceSignedSystem) const {
639+ SmallVectorImpl<Value *> &NewVariables) const {
650640 assert (NewVariables.empty () && " NewVariables must be empty when passed in" );
651- assert ((!ForceSignedSystem || CmpInst::isEquality (Pred)) &&
652- " signed system can only be forced on eq/ne" );
653-
654641 bool IsEq = false ;
655642 bool IsNe = false ;
656643
@@ -665,15 +652,15 @@ ConstraintInfo::getConstraint(CmpInst::Predicate Pred, Value *Op0, Value *Op1,
665652 break ;
666653 }
667654 case CmpInst::ICMP_EQ:
668- if (!ForceSignedSystem && match (Op1, m_Zero ())) {
655+ if (match (Op1, m_Zero ())) {
669656 Pred = CmpInst::ICMP_ULE;
670657 } else {
671658 IsEq = true ;
672659 Pred = CmpInst::ICMP_ULE;
673660 }
674661 break ;
675662 case CmpInst::ICMP_NE:
676- if (!ForceSignedSystem && match (Op1, m_Zero ())) {
663+ if (match (Op1, m_Zero ())) {
677664 Pred = CmpInst::getSwappedPredicate (CmpInst::ICMP_UGT);
678665 std::swap (Op0, Op1);
679666 } else {
@@ -690,7 +677,7 @@ ConstraintInfo::getConstraint(CmpInst::Predicate Pred, Value *Op0, Value *Op1,
690677 return {};
691678
692679 SmallVector<ConditionTy, 4 > Preconditions;
693- bool IsSigned = ForceSignedSystem || CmpInst::isSigned (Pred);
680+ bool IsSigned = CmpInst::isSigned (Pred);
694681 auto &Value2Index = getValue2Index (IsSigned);
695682 auto ADec = decompose (Op0->stripPointerCastsSameRepresentation (),
696683 Preconditions, IsSigned, DL);
@@ -750,7 +737,7 @@ ConstraintInfo::getConstraint(CmpInst::Predicate Pred, Value *Op0, Value *Op1,
750737 int64_t OffsetSum;
751738 if (AddOverflow (Offset1, Offset2, OffsetSum))
752739 return {};
753- if (Pred == CmpInst::ICMP_SLT || Pred == CmpInst::ICMP_ULT)
740+ if (Pred == (IsSigned ? CmpInst::ICMP_SLT : CmpInst::ICMP_ULT) )
754741 if (AddOverflow (OffsetSum, int64_t (-1 ), OffsetSum))
755742 return {};
756743 R[0 ] = OffsetSum;
@@ -1593,20 +1580,10 @@ static bool checkOrAndOpImpliedByOther(
15931580void ConstraintInfo::addFact (CmpInst::Predicate Pred, Value *A, Value *B,
15941581 unsigned NumIn, unsigned NumOut,
15951582 SmallVectorImpl<StackEntry> &DFSInStack) {
1596- addFactImpl (Pred, A, B, NumIn, NumOut, DFSInStack, false );
1597- // If the Pred is eq/ne, also add the fact to signed system.
1598- if (CmpInst::isEquality (Pred))
1599- addFactImpl (Pred, A, B, NumIn, NumOut, DFSInStack, true );
1600- }
1601-
1602- void ConstraintInfo::addFactImpl (CmpInst::Predicate Pred, Value *A, Value *B,
1603- unsigned NumIn, unsigned NumOut,
1604- SmallVectorImpl<StackEntry> &DFSInStack,
1605- bool ForceSignedSystem) {
16061583 // If the constraint has a pre-condition, skip the constraint if it does not
16071584 // hold.
16081585 SmallVector<Value *> NewVariables;
1609- auto R = getConstraint (Pred, A, B, NewVariables, ForceSignedSystem );
1586+ auto R = getConstraint (Pred, A, B, NewVariables);
16101587
16111588 // TODO: Support non-equality for facts as well.
16121589 if (!R.isValid (*this ) || R.isNe ())
0 commit comments