Skip to content

Commit a92c701

Browse files
[SCFToCalyx] Adapt to upstream change in LoopLikeOpInterface.
This PR adapts to a change in `LoopLikeOpInterface` from llvm/llvm-project#158679, which changed the API for getting a statically known iteration count. The PR adapts to the change by using the accessor of the `ForOp` for exactly that information instead of relying on a free function that takes the properties/operands of the op. Signed-off-by: Ingo Müller <[email protected]>
1 parent 2c424ef commit a92c701

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/Conversion/SCFToCalyx/SCFToCalyx.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,10 @@ class ScfForOp : public calyx::RepeatOpInterface<scf::ForOp> {
9696
}
9797

9898
std::optional<int64_t> getBound() override {
99-
return constantTripCount(getOperation().getLowerBound(),
100-
getOperation().getUpperBound(),
101-
getOperation().getStep());
99+
auto scfForOp = mlir::cast<scf::ForOp>(getOperation());
100+
if (std::optional<APInt> bound = scfForOp.getStaticTripCount())
101+
return bound->getZExtValue();
102+
return std::nullopt;
102103
}
103104
};
104105

0 commit comments

Comments
 (0)