https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81034
Bug ID: 81034 Summary: [x86] Broken IRA pass when printing results of intrinsic execution Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: sebastian.peryt at intel dot com Target Milestone: --- Target: x86_64-*-*, i?86-*-* Created attachment 41516 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41516&action=edit Reproducible During missing intrinsic implementation I found strange bug connected to printf. The reproducer is attached. The intrinsics I've been implementing are _mm_mask_load_sd and _mm_maskz_load_sd. Both of them use the same md. Unfortunately, with _mm_maskz_load_sd, when I want to printf values that were generated for some particular cases it breaks compilation and results in following error: during RTL pass: ira In file included from /gcc/gcc/testsuite/gcc.target/i386/avx512f-vmovsd-2.c:5:0: /gcc/gcc/testsuite/gcc.target/i386/avx512f-check.h: In function ‘do_test’: /gcc/gcc/testsuite/gcc.target/i386/avx512f-check.h:11:1: internal compiler error: in wide_int_to_tree, at tree.c:1487 0xe9e9f3 wide_int_to_tree(tree_node*, generic_wide_int<wide_int_ref_storage<false> > const&) ../../gcc/gcc/tree.c:1487 0x895df6 make_tree(tree_node*, rtx_def*) ../../gcc/gcc/expmed.c:5113 0x895e8b make_tree(tree_node*, rtx_def*) ../../gcc/gcc/expmed.c:5139 0xee83a2 force_const_mem(machine_mode, rtx_def*) ../../gcc/gcc/varasm.c:3733 0xa1652b setup_reg_equiv ../../gcc/gcc/ira.c:3992 0xa1652b ira ../../gcc/gcc/ira.c:5244 0xa1652b execute ../../gcc/gcc/ira.c:5580 To reproduce this error two conditions has to be met: - mask value has to be either 0 or 2 - optimization has to be O2, O3 or Ofast It is also interesting that for Os optimization it works. When printf of res4 in attached code is commented out it also compiles. On the other hand, for res3 printf doesn't make a difference - it always works. I have compared passes' dumps for version with res4 printf and without and I found some interesting discrepancies there: 1. On 029t.einline pass, in compiling (non-printf) version function do_test () has been partially expanded by what looks like to be the content of avx512f_test () function. 2. On 051i.ipa_oacc pass the order of functions in dump files has been changed and optimized - for non-compiling one setting the order: a.avx512f_test () b.main () c.do_test () and for compiling one: a.main () b.do_test () 3. On 087t.fixup_cfg4 pass main () is totally deleted from not compiling version leaving only do_test (). I would appreciate any input on that issue.