Skip to content

Commit

Permalink
pr: Remove noparse arguments from noparse when folding.
Browse files Browse the repository at this point in the history
  • Loading branch information
frabert authored and xlauko committed Jan 8, 2025
1 parent 6f03642 commit bd57a54
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/vast/Dialect/Parser/Ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ namespace vast::pr {
using fold_result_t = ::llvm::SmallVectorImpl< ::mlir::OpFoldResult >;

logical_result NoParse::fold(FoldAdaptor adaptor, fold_result_t &results) {
return mlir::failure();
auto change = mlir::failure();
auto op = getOperation();

for (auto [idx, operand] : llvm::reverse(llvm::enumerate(getOperands()))) {
if (auto noparse = mlir::dyn_cast< NoParse >(operand.getDefiningOp())) {
op->eraseOperand(idx);
change = mlir::success();
}
}

return change;
}

} // namespace vast::pr

0 comments on commit bd57a54

Please sign in to comment.