Skip to content

Support shuffle_vector_exprt in goto programs #6645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ansi-c/c_typecheck_gcc_polymorphic_builtins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ exprt c_typecheck_baset::typecheck_shuffle_vector(
operands.push_back(std::move(mod_index));
}

return shuffle_vector_exprt{arg0, arg1, std::move(operands)}.lower();
return shuffle_vector_exprt{arg0, arg1, std::move(operands)};
}
else if(identifier == "__builtin_shufflevector")
{
Expand Down Expand Up @@ -1509,8 +1509,8 @@ exprt c_typecheck_baset::typecheck_shuffle_vector(
}
}

return shuffle_vector_exprt{arguments[0], arguments[1], std::move(operands)}
.lower();
return shuffle_vector_exprt{
arguments[0], arguments[1], std::move(operands)};
}
else
UNREACHABLE;
Expand Down
12 changes: 12 additions & 0 deletions src/goto-programs/remove_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Date: September 2014
#include <util/arith_tools.h>
#include <util/std_expr.h>

#include <ansi-c/c_expr.h>

#include "goto_model.h"

static bool have_to_remove_vector(const typet &type);
Expand All @@ -41,6 +43,8 @@ static bool have_to_remove_vector(const exprt &expr)
{
return true;
}
else if(expr.id() == ID_shuffle_vector)
return true;
else if(expr.id()==ID_vector)
return true;
}
Expand Down Expand Up @@ -93,6 +97,14 @@ static void remove_vector(exprt &expr)
if(!have_to_remove_vector(expr))
return;

if(expr.id() == ID_shuffle_vector)
{
exprt result = to_shuffle_vector_expr(expr).lower();
remove_vector(result);
expr.swap(result);
return;
}

Forall_operands(it, expr)
remove_vector(*it);

Expand Down