Skip to content

Commit

Permalink
conv: Make hl.var with lvalue illegal in LowerValueCategoriesPass.
Browse files Browse the repository at this point in the history
  • Loading branch information
xlauko committed Sep 17, 2024
1 parent 4442a2c commit a2ff6db
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/vast/Conversion/Generic/LowerValueCategories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,17 @@ namespace vast::conv {
populate(unary_in_place_conversions{}, patterns, trg, mctx, tc);
populate(assign_conversions{}, patterns, trg, mctx, tc);

auto is_legal = [&](auto op) {
auto is_legal = [&](operation op) {
return tc.template get_has_legal_return_type< operation >()(op)
&& tc.template get_has_legal_operand_types< operation >()(op);
};

trg.markUnknownOpDynamicallyLegal(is_legal);

trg.addDynamicallyLegalOp< hl::VarDeclOp >([&](hl::VarDeclOp op) {
return !mlir::isa< hl::LValueType >(op.getType());
});

// As we go and replace operands, sometimes it can happen that this cast
// already will be in form `hl.ptr< T > -> T` instead of `hl.lvalue< T > -> T`.
// I am not sure why this is happening, quite possibly some pattern is doing
Expand Down

0 comments on commit a2ff6db

Please sign in to comment.