From c7bf438553b5b63da6ab29e665168674ffbeea2d Mon Sep 17 00:00:00 2001 From: xlauko Date: Wed, 18 Sep 2024 10:40:51 +0200 Subject: [PATCH] conv:tomem: Make StripParamLValuesPass work on external function without named parameters. --- lib/vast/Conversion/ToMem/StripParamLValues.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/vast/Conversion/ToMem/StripParamLValues.cpp b/lib/vast/Conversion/ToMem/StripParamLValues.cpp index 9932e4f2fc..8dfcdac2b2 100644 --- a/lib/vast/Conversion/ToMem/StripParamLValues.cpp +++ b/lib/vast/Conversion/ToMem/StripParamLValues.cpp @@ -58,16 +58,18 @@ namespace vast::conv { { using base = ConversionPassMixin< StripParamLValuesPass, StripParamLValuesBase >; - static bool is_lvalue_type(mlir_value val) { - return !mlir::isa< hl::LValueType >(val.getType()); + static bool is_not_lvalue_type(mlir_type ty) { + return !mlir::isa< hl::LValueType >(ty); } static conversion_target create_conversion_target(mcontext_t &mctx) { conversion_target trg(mctx); trg.markUnknownOpDynamicallyLegal([] (operation op) { - if (auto fn = mlir::dyn_cast< mlir::FunctionOpInterface >(op)) - return rns::all_of(fn.getArguments(), is_lvalue_type); + if (auto fn = mlir::dyn_cast< mlir::FunctionOpInterface >(op)) { + auto fty = mlir::cast< core::FunctionType >(fn.getFunctionType()); + return rns::all_of(fty.getInputs(), is_not_lvalue_type); + } return true; });