Skip to content

Commit cea3d3d

Browse files
author
Thorsten Schütt
committed
address review comments
1 parent d2db014 commit cea3d3d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7054,9 +7054,13 @@ bool CombinerHelper::matchAddOverflow(MachineInstr &MI, BuildFnTy &MatchInfo) {
70547054
}
70557055
};
70567056

7057+
// We try to combine addo to non-overflowing add.
7058+
if (!isLegalOrBeforeLegalizer({TargetOpcode::G_ADD, {DstTy}}) ||
7059+
!isConstantLegalOrBeforeLegalizer(CarryTy))
7060+
return false;
7061+
70577062
// We try to combine uaddo to non-overflowing add.
7058-
if (!IsSigned && isLegalOrBeforeLegalizer({TargetOpcode::G_ADD, {DstTy}}) &&
7059-
isConstantLegalOrBeforeLegalizer(DstTy)) {
7063+
if (!IsSigned) {
70607064
ConstantRange CRLHS =
70617065
ConstantRange::fromKnownBits(KB->getKnownBits(LHS), false /*IsSigned*/);
70627066
ConstantRange CRRHS =
@@ -7080,14 +7084,11 @@ bool CombinerHelper::matchAddOverflow(MachineInstr &MI, BuildFnTy &MatchInfo) {
70807084
};
70817085
return true;
70827086
}
7083-
};
7087+
}
70847088
return false;
7085-
};
7089+
}
70867090

70877091
// We try to combine saddo to non-overflowing add.
7088-
if (!isLegalOrBeforeLegalizer({TargetOpcode::G_ADD, {DstTy}}) ||
7089-
!isConstantLegalOrBeforeLegalizer(CarryTy))
7090-
return false;
70917092

70927093
// If LHS and RHS each have at least two sign bits, then there is no signed
70937094
// overflow.
@@ -7122,7 +7123,7 @@ bool CombinerHelper::matchAddOverflow(MachineInstr &MI, BuildFnTy &MatchInfo) {
71227123
};
71237124
return true;
71247125
}
7125-
};
7126+
}
71267127

71277128
return false;
71287129
}

0 commit comments

Comments
 (0)