On Sun, Dec 01, 2019 at 08:09:56PM -0500, Marek Polacek wrote: > On Thu, Nov 28, 2019 at 11:29:20PM -0500, Jason Merrill wrote: > > Sounds like reduced_constant_expression_p needs to deal better with empty > > bases. > > This got a bit complicated because it also needs to handle unions and > now we also need to heed vptr. But the following seems to work. > > (I'll skip the story about a bogus error I hit when building cmcstl2 and > the need to debug a ~90,000 LOC test, because creduce got stuck reducing > it.)
Note, I got creduce stuck several times and what helped is: --- /usr/bin/creduce 2019-02-15 17:17:32.000000000 +0100 +++ /usr/bin/creduce.nonnested 2019-11-30 11:34:21.604937392 +0100 @@ -802,7 +802,7 @@ my @all_methods = ( { "name" => "pass_clang", "arg" => "local-to-global", "pri" => 9500, "C" => 1, }, { "name" => "pass_clang", "arg" => "param-to-global", "pri" => 203, "C" => 1, }, { "name" => "pass_clang", "arg" => "param-to-local", "pri" => 204, "C" => 1, }, - { "name" => "pass_clang", "arg" => "remove-nested-function", "pri" => 205, "C" => 1, }, + #{ "name" => "pass_clang", "arg" => "remove-nested-function", "pri" => 205, "C" => 1, }, { "name" => "pass_clang", "arg" => "rename-fun", "last_pass_pri" => 207, "C" => 1, }, { "name" => "pass_clang", "arg" => "union-to-struct", "pri" => 208, }, { "name" => "pass_clang", "arg" => "rename-param", "last_pass_pri" => 209, "C" => 1, }, where I can use creduce.nonnested if normal creduce gets stuck. That pass tends to increase size of code rather than reduce if there are nested functions, by adding a large series of temporaries: type __reduce_tmp_123 = ... type __reduce_tmp_122 = __reduce_tmp_123; type __reduce_tmp_121 = __reduce_tmp_122; type __reduce_tmp_120 = __reduce_tmp_121; type __reduce_tmp_119 = __reduce_tmp_120; type __reduce_tmp_118 = __reduce_tmp_119; type __reduce_tmp_117 = __reduce_tmp_118; ... and every iteration adds another line. Jakub