From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 164D538930C3; Fri, 24 Apr 2020 00:48:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 164D538930C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587689298; bh=Fi15i/KuK0GgE+dElxufPP/LEFK2Aa1iwDnzSwGuWok=; h=From:To:Subject:Date:In-Reply-To:References:From; b=G8AmEGu6Cpx8NgK1PA1FnrUijU/n8JrC1kDvBykJxZiTppbznR/aEAwvUOhY76G88 9BdB+d6P7QDGgQSpliWEFjMuMqHyin0wuC7+Qlaxl18LIkJpqJ7XsTKCkP6Uvz4Fea 0wRVHBCkX+kEqwIUH/Xgkw1OV1XsX+zq498nt68c= From: "law at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94734] [10 Regression] Program crashes when compiled with -O2 since r10-1892-gb9ef6a2e04bfd013 Date: Fri, 24 Apr 2020 00:48:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: law at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Apr 2020 00:48:18 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94734 --- Comment #6 from Jeffrey A. Law --- THe whole point of that change is to not require a dominating load if the object comes from the stack. We conditionally load from the same location, then have a PHI which selects that loaded value or "1" and we store the result. That's precisely what is supposed to be happening. The loop in question looks like: ;; basic block 3, loop depth 1 ;; pred: 2 ;; 6 # ivtmp.13_9 =3D PHI <0(2), ivtmp.13_7(6)> _4 =3D MEM[base: in_21(D), index: ivtmp.13_9, step: 8, offset: 0B]; if (_4 =3D=3D 0B) goto ; [5.50%] else goto ; [94.50%] ;; succ: 13 ;; 4 ;; basic block 4, loop depth 1 ;; pred: 3 if (ivtmp.13_9 !=3D 2) goto ; [28.10%] else goto ; [71.90%] ;; succ: 6 ;; 5 ;; basic block 5, loop depth 1 ;; pred: 4 cstore_32 =3D MEM[symbol: arr, index: ivtmp.13_9, step: 4, offset: 0B]; ;; succ: 6 ;; basic block 6, loop depth 1 ;; pred: 5 ;; 4 # cstore_31 =3D PHI MEM[symbol: arr, index: ivtmp.13_9, step: 4, offset: 0B] =3D cstore_31; _40 =3D (unsigned int) ivtmp.13_9; _38 =3D _40 + 1; _37 =3D (int) _38; ivtmp.13_7 =3D ivtmp.13_9 + 1; sum_a_27 =3D (int) ivtmp.13_7; if (n_16(D) > sum_a_27) goto ; [94.50%] else goto ; [5.50%] ;; succ: 3 ;; 7 You can see the load from the same stock slot in bb5, the selecting PHI in = bb6 and the store in bb6. THe test in bb4 looks weird and is the source of the problem I believe.=