Hello, I want to know whether it is correct to add left shift instruction to a constant expression statement like "_3 + 4"?
I am trying to add a left shift instruction in between below GIMPLE instructions - <bb 2> : instrn_buffer.0_1 = instrn_buffer; _2 = tree.cnt; _3 = (int) _2; _4 = _3 + 4; _5 = (unsigned int) _4; // I want to add left shift here D.2993 = __builtin_riscv_sfploadi (instrn_buffer.0_1, 0, _5); //this is "stmt" I am using this snippet in custom gcc plugin - tree lshift_tmp = make_temp_ssa_name (integer_type_node, NULL, "slli"); gimple *lshift = gimple_build_assign (lshift_tmp, LSHIFT_EXPR, parm, build_int_cst (integer_type_node, 8)); gsi_insert_before(&gsi, lshift, GSI_NEW_STMT); //Update function call gimple_call_set_arg (stmt, idx, lshift_tmp); update_stmt (stmt); update_ssa (TODO_update_ssa); from which above GIMPLE IR is modified to - <bb 2> : instrn_buffer.0_1 = instrn_buffer; _2 = tree.cnt; _3 = (int) _2; _4 = _3 + 4; _5 = (unsigned int) _4; slli_24 = _5 << 8; D.2993 = __builtin_riscv_sfploadi (instrn_buffer.0_1, 0, slli_24); 1. When I run above code, either dominator tree validation or tree cfg fixup is failing which suggests to me it is either incorrect to apply such left shift or some more work is missing? 2. I followed how a left shift gimple assignment is generated but still feels there is something wrong with the above generation. Can someone please point me out? Thanks in advance! As always, the GCC community and its members are very supportive, responsive and helpful! Regards, Shubham