https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66215
--- Comment #4 from Andreas Krebbel <krebbel at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #3) > IMHO the nops should go immediately before the first real instruction in the > function. The point of not emitting it earlier is so that the nops are > already covered by debug and unwind info. > So, we certainly should skip all NOTEs at the start of the function, and > perhaps > selected other insns (dunno if e.g. UNSPECV_MAIN_POOL insn emits any code or > not). NOTE_INSN_FUNCTION_BEG is not a good place, as it can be preceeded by > various prologue instructions, and the nops really have to go before all > real instructions (that emit some bytes into the function text section). UNSPECV_MAIN_POOL does not itself emit code. However, it is used as an anchor to emit insns right after it so we should not skip it here I think. We will try with skipping all the NOTEs as you suggested and we definitely should run all the hotpatch testcases at different optimization levels. Thanks!