Skip to content

Commit

Permalink
Make pass output deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
arrangabriel committed Oct 24, 2024
1 parent a55782a commit 5a8761a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/Dialect/BaseModelica/Transforms/CallCSE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ class CallCSEPass final : public impl::CallCSEPassBase<CallCSEPass> {

/// Get all call operations in the model.
void collectCallOps(ModelOp modelOp, llvm::SmallVectorImpl<CallOp> &callOps) {
llvm::SmallVector<EquationInstanceOp> initialEquationOps;
llvm::SmallVector<EquationInstanceOp> dynamicEquationOps;

modelOp.collectInitialEquations(initialEquationOps);
modelOp.collectMainEquations(dynamicEquationOps);

llvm::DenseSet<EquationTemplateOp> templateOps;
llvm::SmallVector<EquationTemplateOp> templateOps;

for (EquationInstanceOp equationOp : dynamicEquationOps) {
templateOps.insert(equationOp.getTemplate());
EquationTemplateOp templateOp = equationOp.getTemplate();
if (!templateOp.getInductionVariables().empty() &&
llvm::is_contained(templateOps, templateOp)) {
continue;
}
templateOps.push_back(templateOp);
}

for (EquationTemplateOp templateOp : templateOps) {
Expand Down

0 comments on commit 5a8761a

Please sign in to comment.