From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26872 invoked by alias); 9 Nov 2012 13:28:55 -0000 Received: (qmail 26864 invoked by uid 22791); 9 Nov 2012 13:28:54 -0000 X-SWARE-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_VZ,TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-pa0-f47.google.com (HELO mail-pa0-f47.google.com) (209.85.220.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Nov 2012 13:28:45 +0000 Received: by mail-pa0-f47.google.com with SMTP id fa11so2648487pad.20 for ; Fri, 09 Nov 2012 05:28:45 -0800 (PST) MIME-Version: 1.0 Received: by 10.66.87.226 with SMTP id bb2mr31758529pab.57.1352467725037; Fri, 09 Nov 2012 05:28:45 -0800 (PST) Received: by 10.66.246.232 with HTTP; Fri, 9 Nov 2012 05:28:44 -0800 (PST) In-Reply-To: References: <20121109123617.GA1886@tucnak.redhat.com> Date: Fri, 09 Nov 2012 13:28:00 -0000 Message-ID: Subject: Re: [off-list] Re: [PATCH] Vzeroupper placement/47440 From: Uros Bizjak To: Jakub Jelinek Cc: Vladimir Yakovlev , "H.J. Lu" , Igor Zamyatin , gcc-patches@gcc.gnu.org Content-Type: multipart/mixed; boundary=f46d042fd91c5230a904ce0fee4e Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg00742.txt.bz2 --f46d042fd91c5230a904ce0fee4e Content-Type: text/plain; charset=ISO-8859-1 Content-length: 2613 On Fri, Nov 9, 2012 at 1:47 PM, Uros Bizjak wrote: >>> >> These assert should tell you what is wrong with the control flow. >>> >> Please look at control_flow_insn_p, which condition returns true. >>> > >>> > There is a note after call insn. >>> > >>> > (call_insn:TI 908 35558 50534 1681 (call (mem:QI (symbol_ref:DI >>> > ("_gfortran_stop_string") [flags 0x41] >> > _gfortran_stop_string>) [0 _gfortran_stop_string S1 A8]) >>> > (const_int 0 [0])) huygens.fppized.f90:190 616 {*call} >>> > (expr_list:REG_DEAD (reg:DI 5 di) >>> > (expr_list:REG_DEAD (reg:SI 4 si) >>> > (expr_list:REG_NORETURN (const_int 0 [0]) >>> > (nil)))) >>> > (expr_list:REG_FRAME_RELATED_EXPR (use (reg:DI 5 di)) >>> > (expr_list:REG_BR_PRED (use (reg:SI 4 si)) >>> > (nil)))) >>> > (note 50534 908 909 1681 (expr_list:REG_DEP_TRUE (concat:DI (reg:DI 5 di) >>> > (const_int 0 [0])) >>> > (expr_list:REG_DEP_TRUE (concat:SI (reg:SI 4 si) >>> > (const_int 0 [0])) >>> > (nil))) NOTE_INSN_CALL_ARG_LOCATION) >>> > >>> >>> Huh, this RTX is ignored: >> >> NOTE_INSN_CALL_ARG_LOCATION is fine, even after a REG_NORETURN call. >> It is just a way how to pass call argument details to dwarf2out. >> If you have a pass after var-tracking, you need to skip over it. > > Yes, but postreload mode switching should come before pro_and_epilogue > anyway, otherwise create_pre_exit won't work: > > --mode-switching.c (222)-- > /* If this function returns a value at the end, we have to > insert the final mode switch before the return value copy > to its hard register. */ > if (EDGE_COUNT (EXIT_BLOCK_PTR->preds) == 1 > && NONJUMP_INSN_P ((last_insn = BB_END (src_bb))) > && GET_CODE (PATTERN (last_insn)) == USE > && GET_CODE ((ret_reg = XEXP (PATTERN (last_insn), 0))) == REG) > --mode-switching.2 (228)-- > > I believe that this will work OK if the pass is inserted before > prologue generation pass. Finally, having a post-reload mode-switching pass, we can double-check that there are no live SSE registers at vzeroupper insertion point. As vzeroupper is only an optimization, we want to play safe and cancel vzeroupper insertion in this case There is no degradation for x86_64 gABI targets, since all SSE registers are call-clobbered. Vzeroupper is conditionally inserted just before call insn, where all registers are saved to stack and already dead. The vzeroupper at function exit is not problematic. Uros. --f46d042fd91c5230a904ce0fee4e Content-Type: text/plain; charset=US-ASCII; name="p.diff.txt" Content-Disposition: attachment; filename="p.diff.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_h9bcbvgi0 Content-length: 3140 SW5kZXg6IGkzODYtcHJvdG9zLmgKPT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQot LS0gaTM4Ni1wcm90b3MuaAkocmV2aXNpb24gMTkzMzI5KQorKysgaTM4Ni1w cm90b3MuaAkod29ya2luZyBjb3B5KQpAQCAtMTcyLDggKzE3MiwxMSBAQCBl eHRlcm4gaW50IGl4ODZfbW9kZV9uZWVkZWQgKGludCwgcnR4KTsKIGV4dGVy biBpbnQgaXg4Nl9tb2RlX2FmdGVyIChpbnQsIGludCwgcnR4KTsKIGV4dGVy biBpbnQgaXg4Nl9tb2RlX2VudHJ5IChpbnQpOwogZXh0ZXJuIGludCBpeDg2 X21vZGVfZXhpdCAoaW50KTsKLWV4dGVybiB2b2lkIGl4ODZfZW1pdF9tb2Rl X3NldCAoaW50LCBpbnQpOwogCisjaWZkZWYgSEFSRF9DT05TVAorZXh0ZXJu IHZvaWQgaXg4Nl9lbWl0X21vZGVfc2V0IChpbnQsIGludCwgSEFSRF9SRUdf U0VUKTsKKyNlbmRpZgorCiBleHRlcm4gdm9pZCB4ODZfb3JkZXJfcmVnc19m b3JfbG9jYWxfYWxsb2MgKHZvaWQpOwogZXh0ZXJuIHZvaWQgeDg2X2Z1bmN0 aW9uX3Byb2ZpbGVyIChGSUxFICosIGludCk7CiBleHRlcm4gdm9pZCB4ODZf ZW1pdF9mbG9hdHVucyAocnR4IFsyXSk7CkluZGV4OiBpMzg2LmMKPT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PQotLS0gaTM4Ni5j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b2RlKQoraXg4Nl9lbWl0 X21vZGVfc2V0IChpbnQgZW50aXR5LCBpbnQgbW9kZSwgSEFSRF9SRUdfU0VU IHJlZ3NfbGl2ZSkKIHsKICAgc3dpdGNoIChlbnRpdHkpCiAgICAgewogICAg IGNhc2UgQVZYX1UxMjg6CiAgICAgICBpZiAobW9kZSA9PSBBVlhfVTEyOF9D TEVBTikKLQllbWl0X2luc24gKGdlbl9hdnhfdnplcm91cHBlciAoKSk7CisJ aXg4Nl9hdnhfZW1pdF92emVyb3VwcGVyIChyZWdzX2xpdmUpOwogICAgICAg YnJlYWs7CiAgICAgY2FzZSBJMzg3X1RSVU5DOgogICAgIGNhc2UgSTM4N19G TE9PUjoKSW5kZXg6IGkzODYuaAo9PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0t LSBpMzg2LmgJKHJldmlzaW9uIDE5MzMyOSkKKysrIGkzODYuaAkod29ya2lu ZyBjb3B5KQpAQCAtMjIyMyw3ICsyMjI3LDcgQEAgZW51bSBhdnhfdTEyOF9z dGF0ZQogICAgYXJlIHRvIGJlIGluc2VydGVkLiAgKi8KIAogI2RlZmluZSBF TUlUX01PREVfU0VUKEVOVElUWSwgTU9ERSwgSEFSRF9SRUdTX0xJVkUpIFwK LSAgaXg4Nl9lbWl0X21vZGVfc2V0ICgoRU5USVRZKSwgKE1PREUpKQorICBp eDg2X2VtaXRfbW9kZV9zZXQgKChFTlRJVFkpLCAoTU9ERSksIChIQVJEX1JF R1NfTElWRSkpCiAMCiAvKiBBdm9pZCByZW5hbWluZyBvZiBzdGFjayByZWdp c3RlcnMsIGFzIGRvaW5nIHNvIGluIGNvbWJpbmF0aW9uIHdpdGgKICAgIHNj aGVkdWxpbmcganVzdCBpbmNyZWFzZXMgYW1vdW50IG9mIGxpdmUgcmVnaXN0 ZXJzIGF0IHRpbWUgYW5kIGluCg== --f46d042fd91c5230a904ce0fee4e--