Skip to content

Commit 62d9a34

Browse files
author
Thorsten Schütt
committed
address review comments
1 parent 4bddc0e commit 62d9a34

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
@@ -7048,9 +7048,13 @@ bool CombinerHelper::matchAddOverflow(MachineInstr &MI, BuildFnTy &MatchInfo) {
70487048
}
70497049
};
70507050

7051+
// We try to combine addo to non-overflowing add.
7052+
if (!isLegalOrBeforeLegalizer({TargetOpcode::G_ADD, {DstTy}}) ||
7053+
!isConstantLegalOrBeforeLegalizer(CarryTy))
7054+
return false;
7055+
70517056
// We try to combine uaddo to non-overflowing add.
7052-
if (!IsSigned && isLegalOrBeforeLegalizer({TargetOpcode::G_ADD, {DstTy}}) &&
7053-
isConstantLegalOrBeforeLegalizer(DstTy)) {
7057+
if (!IsSigned) {
70547058
ConstantRange CRLHS =
70557059
ConstantRange::fromKnownBits(KB->getKnownBits(LHS), false /*IsSigned*/);
70567060
ConstantRange CRRHS =
@@ -7074,14 +7078,11 @@ bool CombinerHelper::matchAddOverflow(MachineInstr &MI, BuildFnTy &MatchInfo) {
70747078
};
70757079
return true;
70767080
}
7077-
};
7081+
}
70787082
return false;
7079-
};
7083+
}
70807084

70817085
// We try to combine saddo to non-overflowing add.
7082-
if (!isLegalOrBeforeLegalizer({TargetOpcode::G_ADD, {DstTy}}) ||
7083-
!isConstantLegalOrBeforeLegalizer(CarryTy))
7084-
return false;
70857086

70867087
// If LHS and RHS each have at least two sign bits, then there is no signed
70877088
// overflow.
@@ -7116,7 +7117,7 @@ bool CombinerHelper::matchAddOverflow(MachineInstr &MI, BuildFnTy &MatchInfo) {
71167117
};
71177118
return true;
71187119
}
7119-
};
7120+
}
71207121

71217122
return false;
71227123
}

0 commit comments

Comments
 (0)