https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81430
Bug ID: 81430 Summary: nvptx acceleration compilation broken because of running pass_partition_blocks Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org CC: marxin at gcc dot gnu.org Target Milestone: --- [ tentatively setting component to lto ] Atm, when running the libgomp testsuite for an x86_64 compiler with nvptx acceleration, we run into a number of ICEs in lto1. I've investigated an ICE in fix_crossing_unconditional_branches, which occurs for both openmp and openacc. The basic problem is that we're running pass_partition_blocks for nvptx, while we don't want to do that. Note that for standalone compilation for single-thread ptx execution, we don't attempt to run pass_partition_blocks. This is because for nvptx, TARGET_HAVE_NAMED_SECTIONS is set to false, and this bit in finish_options switches off pass_partition_blocks: ... /* If the target requested unwind info, then turn off the partitioning optimization with a different message. Likewise, if the target does not support named sections. */ if (opts->x_flag_reorder_blocks_and_partition && (!targetm_common.have_named_sections || (opts->x_flag_unwind_tables && targetm_common.unwind_tables_default && (ui_except == UI_SJLJ || ui_except >= UI_TARGET)))) { if (opts_set->x_flag_reorder_blocks_and_partition) inform (loc, "-freorder-blocks-and-partition does not work " "on this architecture"); opts->x_flag_reorder_blocks_and_partition = 0; opts->x_flag_reorder_blocks = 1; } ... But that doesn't seem to work for the offloading setup. The scenario is as follows: - testcase is compiled with -O2 - ix86_option_optimization_table enables OPT_freorder_blocks_and_partition at -O2 - cc1 writes out the flag as part of DECL_FUNCTION_SPECIFIC_OPTIMIZATION - lto1 reads in the flag as part of DECL_FUNCTION_SPECIFIC_OPTIMIZATION - lto1 uses the flag, and runs pass_partition_blocks - pass_partition_blocks ICEs