[MLIR] Simplex::appendVariable: early return if count == 0

This commit is contained in:
Arjun P 2021-09-20 13:09:05 +05:30
parent ec03bbe8a7
commit 76cb876563
2 changed files with 3 additions and 0 deletions

View File

@ -483,6 +483,8 @@ void Simplex::rollback(unsigned snapshot) {
}
void Simplex::appendVariable(unsigned count) {
if (count == 0)
return;
var.reserve(var.size() + count);
colUnknown.reserve(colUnknown.size() + count);
for (unsigned i = 0; i < count; ++i) {

View File

@ -388,6 +388,7 @@ TEST(SimplexTest, appendVariable) {
unsigned snapshot1 = simplex.getSnapshot();
simplex.appendVariable();
simplex.appendVariable(0);
EXPECT_EQ(simplex.getNumVariables(), 2u);
int64_t yMin = 2, yMax = 5;