Skip to content

Commit

Permalink
account for empty memory size
Browse files Browse the repository at this point in the history
  • Loading branch information
jiahanxie353 committed Nov 17, 2024
1 parent d803cb0 commit a104870
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Conversion/SCFToCalyx/SCFToCalyx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,10 @@ class BuildOpGroups : public calyx::FuncOpPartialLoweringPattern {
jsonOS.value(getState<ComponentLoweringState>().getExtMemData());
jsonOS.flush();
outFile.close();
} else
} else {
llvm::errs() << "Unable to open file for writing\n";
return failure();
}
}
}

Expand Down Expand Up @@ -733,6 +735,11 @@ LogicalResult BuildOpGroups::buildOp(PatternRewriter &rewriter,
void insertNestedArrayValue(llvm::json::Array &array,
const std::vector<int> &indices, size_t index,
llvm::json::Value value) {
if (indices.empty()) {
array.emplace_back(std::move(value));
return;
}

if (index == indices.size() - 1) {
// ensure the array is big enough
while (array.size() <= static_cast<size_t>(indices[index])) {
Expand Down

0 comments on commit a104870

Please sign in to comment.