On Wed, Dec 7, 2022 at 9:51 AM Sebastian Huber <sebastian.hu...@embedded-brains.de> wrote: > > On 06.12.22 17:08, Richard Biener wrote: > > Likely. I'd use the gimple_build () API from gimple-fold.h which > > builds the expression(s) to a gimple_seq creating necessary temporaries > > on-the-fly and then insert that sequence on the edge. > > Thanks, I will have a look at this. > > I am struggling to convert a uint32_type_node node to a gcov_type_node > (64-bit). I tried to use this: > > if (result != NULL_TREE) > { > tree tmp1 = make_temp_ssa_name (gcov_type_node, NULL, name); > gassign *stmt7 = gimple_build_assign (result, VIEW_CONVERT_EXPR, > build1 (VIEW_CONVERT_EXPR, gcov_type_node, > high));
You want gimple_build_assign (result, NOP_EXPR, high); here (a conversion, from unsigned it will zero-extend) > tree tmp2 = make_temp_ssa_name (gcov_type_node, NULL, name); > gassign *stmt8 = gimple_build_assign (tmp2, LSHIFT_EXPR, tmp1, > build_int_cst (integer_type_node, 32)); > gassign *stmt9 = gimple_build_assign (result, BIT_IOR_EXPR, tmp2, > tmp1); > gsi_insert_after (gsi, stmt7, GSI_NEW_STMT); > gsi_insert_after (gsi, stmt8, GSI_NEW_STMT); > gsi_insert_after (gsi, stmt9, GSI_NEW_STMT); > } > > This ends up in: > > ../test.c: In function 'f': > ../test.c:4:1: error: conversion of register to a different size in > 'view_convert_expr' > 4 | } > | ^ > VIEW_CONVERT_EXPR<long long int>(PROF_time_profiler_15); > > PROF_time_profile_9 = VIEW_CONVERT_EXPR<long long > int>(PROF_time_profiler_15); > during IPA pass: profile > ../test.c:4:1: internal compiler error: verify_gimple failed > 0xdddc95 verify_gimple_in_cfg(function*, bool, bool) > /home/EB/sebastian_h/src/gcc/gcc/tree-cfg.cc:5647 > 0xc20221 execute_function_todo > /home/EB/sebastian_h/src/gcc/gcc/passes.cc:2091 > 0xc1efd6 do_per_function > /home/EB/sebastian_h/src/gcc/gcc/passes.cc:1701 > 0xc20416 execute_todo > /home/EB/sebastian_h/src/gcc/gcc/passes.cc:2145 > Please submit a full bug report, with preprocessed source (by using > -freport-bug). > Please include the complete backtrace with any bug report. > See <https://gcc.gnu.org/bugs/> for instructions. > > > -- > embedded brains GmbH > Herr Sebastian HUBER > Dornierstr. 4 > 82178 Puchheim > Germany > email: sebastian.hu...@embedded-brains.de > phone: +49-89-18 94 741 - 16 > fax: +49-89-18 94 741 - 08 > > Registergericht: Amtsgericht München > Registernummer: HRB 157899 > Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler > Unsere Datenschutzerklärung finden Sie hier: > https://embedded-brains.de/datenschutzerklaerung/