Skip to content

Commit

Permalink
Automated Code Change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 663169967
  • Loading branch information
XLS Team authored and copybara-github committed Aug 15, 2024
1 parent 3159e70 commit 28e4cad
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions xls/passes/bdd_cse_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ absl::StatusOr<bool> BddCsePass::RunOnFunctionBaseInternal(
auto node_hash = [&](Node* n) {
CHECK(n->GetType()->IsBits());
std::vector<int64_t> values_to_hash;
values_to_hash.reserve(n->BitCountOrDie());
for (int64_t i = 0; i < n->BitCountOrDie(); ++i) {
values_to_hash.push_back(bdd_function->GetBddNode(n, i).value());
}
Expand Down
1 change: 1 addition & 0 deletions xls/passes/proc_inlining_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,7 @@ absl::StatusOr<ProcThread> InlineProcAsProcThread(
}

std::vector<Node*> next_state;
next_state.reserve(proc_to_inline->GetStateElementCount());
for (int64_t i = 0; i < proc_to_inline->GetStateElementCount(); ++i) {
next_state.push_back(node_map.at(proc_to_inline->GetNextStateElement(i)));
}
Expand Down
1 change: 1 addition & 0 deletions xls/passes/query_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace {
std::vector<TreeBitLocation> ToTreeBitLocations(Node* node) {
CHECK(node->GetType()->IsBits());
std::vector<TreeBitLocation> locations;
locations.reserve(node->BitCountOrDie());
for (int64_t i = 0; i < node->BitCountOrDie(); ++i) {
locations.emplace_back(TreeBitLocation(node, i));
}
Expand Down
6 changes: 6 additions & 0 deletions xls/passes/ternary_query_engine_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,7 @@ TEST_F(TernaryQueryEngineTest, ArrayUpdate) {
BValue update = MakeValueWithKnownBits("update", "0b01X", &fb);
BValue result = fb.ArrayUpdate(array, update, {idx});
std::vector<BValue> reads;
reads.reserve(array_val.size());
for (int64_t i = 0; i < array_val.size(); ++i) {
reads.push_back(fb.ArrayIndex(result, {fb.Literal(UBits(i, 8))}));
}
Expand Down Expand Up @@ -1461,6 +1462,7 @@ TEST_F(TernaryQueryEngineTest, ArrayUpdateZeroLengthIndex) {
BValue update = MakeValueWithKnownBits("update", "0b01X", &fb);
BValue result = fb.ArrayUpdate(array, update, {idx});
std::vector<BValue> reads;
reads.reserve(array_val.size());
for (int64_t i = 0; i < array_val.size(); ++i) {
reads.push_back(fb.ArrayIndex(result, {fb.Literal(UBits(i, 8))}));
}
Expand Down Expand Up @@ -1498,6 +1500,7 @@ TEST_F(TernaryQueryEngineTest, ArrayUpdateExact) {
BValue update = fb.Literal(UBits(0, 2));
BValue result = fb.ArrayUpdate(array, update, {idx});
std::vector<BValue> reads;
reads.reserve(array.GetType()->AsArrayOrDie()->size());
for (int64_t i = 0; i < array.GetType()->AsArrayOrDie()->size(); ++i) {
reads.push_back(fb.ArrayIndex(result, {fb.Literal(UBits(i, 8))}));
}
Expand Down Expand Up @@ -1529,6 +1532,7 @@ TEST_F(TernaryQueryEngineTest, ArrayUpdateExactOOB) {
BValue update = fb.Literal(UBits(0, 2));
BValue result = fb.ArrayUpdate(array, update, {idx});
std::vector<BValue> reads;
reads.reserve(array.GetType()->AsArrayOrDie()->size());
for (int64_t i = 0; i < array.GetType()->AsArrayOrDie()->size(); ++i) {
reads.push_back(fb.ArrayIndex(result, {fb.Literal(UBits(i, 8))}));
}
Expand Down Expand Up @@ -1561,6 +1565,7 @@ TEST_F(TernaryQueryEngineTest, ArrayUpdateSometimesOOB) {
BValue update = MakeValueWithKnownBits("update", "0b01X", &fb);
BValue result = fb.ArrayUpdate(array, update, {idx});
std::vector<BValue> reads;
reads.reserve(array_val.size());
for (int64_t i = 0; i < array_val.size(); ++i) {
reads.push_back(fb.ArrayIndex(result, {fb.Literal(UBits(i, 8))}));
}
Expand Down Expand Up @@ -1599,6 +1604,7 @@ TEST_F(TernaryQueryEngineTest, ArrayUpdateOOB) {
BValue update = MakeValueWithKnownBits("update", "0b01X", &fb);
BValue result = fb.ArrayUpdate(array, update, {idx});
std::vector<BValue> reads;
reads.reserve(array_val.size());
for (int64_t i = 0; i < array_val.size(); ++i) {
reads.push_back(fb.ArrayIndex(result, {fb.Literal(UBits(i, 8))}));
}
Expand Down

0 comments on commit 28e4cad

Please sign in to comment.