Skip to content

Commit

Permalink
Automated Code Change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 662384991
  • Loading branch information
XLS Team authored and copybara-github committed Aug 13, 2024
1 parent b817d73 commit 4e7bb32
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions xls/interpreter/block_evaluator_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ TEST_P(BlockEvaluatorTest, PipelinedHierarchicalRotate) {
BlockBuilder b(absl::StrCat(TestName(), "_rot", n, "_", r), package.get());
XLS_RETURN_IF_ERROR(b.AddClockPort("clk"));
std::vector<BValue> inputs;
inputs.reserve(n);
for (int64_t i = 0; i < n; ++i) {
inputs.push_back(
b.InputPort(absl::StrCat("in", i), package->GetBitsType(8)));
Expand All @@ -166,6 +167,7 @@ TEST_P(BlockEvaluatorTest, PipelinedHierarchicalRotate) {
BlockBuilder b(absl::StrCat(TestName(), "multirot", n), package.get());
XLS_RETURN_IF_ERROR(b.AddClockPort("clk"));
std::vector<BValue> inputs;
inputs.reserve(n);
for (int64_t i = 0; i < n; ++i) {
inputs.push_back(
b.InputPort(absl::StrCat("in", i), package->GetBitsType(8)));
Expand Down
1 change: 1 addition & 0 deletions xls/interpreter/ir_interpreter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ absl::StatusOr<Value> IrInterpreter::DeepOr(

auto input_elements = [&](int64_t i) {
std::vector<const Value*> values;
values.reserve(inputs.size());
for (int64_t j = 0; j < inputs.size(); ++j) {
values.push_back(&inputs[j]->elements()[i]);
}
Expand Down
2 changes: 2 additions & 0 deletions xls/interpreter/random_value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Value RandomValue(Type* type, absl::BitGenRef rng) {
if (type->IsTuple()) {
TupleType* tuple_type = type->AsTupleOrDie();
std::vector<Value> elements;
elements.reserve(tuple_type->size());
for (int64_t i = 0; i < tuple_type->size(); ++i) {
elements.push_back(RandomValue(tuple_type->element_type(i), rng));
}
Expand All @@ -46,6 +47,7 @@ Value RandomValue(Type* type, absl::BitGenRef rng) {
if (type->IsArray()) {
ArrayType* array_type = type->AsArrayOrDie();
std::vector<Value> elements;
elements.reserve(array_type->size());
for (int64_t i = 0; i < array_type->size(); ++i) {
elements.push_back(RandomValue(array_type->element_type(), rng));
}
Expand Down

0 comments on commit 4e7bb32

Please sign in to comment.