From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6CE5F385DC2D; Wed, 2 Feb 2022 12:31:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6CE5F385DC2D From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104334] [12 Regression] Ranger/dom miscompilation Date: Wed, 02 Feb 2022 12:31:28 +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: 12.0 X-Bugzilla-Keywords: lto, needs-bisection, wrong-code X-Bugzilla-Severity: blocker X-Bugzilla-Who: jakub at gcc dot gnu.org 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: 12.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: Wed, 02 Feb 2022 12:31:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104334 --- Comment #11 from Jakub Jelinek --- > And another question is, the 2, 3, 4 cases handling seems like an optimiz= ation, > so wi_fold at line 192 should give the right answer, but it doesn'= t. Actually no, I misunderstood, with -O0 or non-LTO, it is the wi_fold call, while with LTO it is the 178 wi_fold (r, type, lh_lb, lh_lb, rh_lb, rh_ub); 179 if (wi::gt_p (lh_range, 1, sign)) 180 { 181 wi_fold (tmp, type, lh_lb + 1, lh_lb + 1, rh_lb, rh_ub); 182 r.union_ (tmp); 183 if (wi::eq_p (lh_range, 3)) 184 { (gdb)=20 185 wi_fold (tmp, type, lh_lb + 2, lh_lb + 2, rh_lb, rh_u= b); 186 r.union_ (tmp); 187 } 188 } 189 wi_fold (tmp, type, lh_ub, lh_ub, rh_lb, rh_ub); 190 r.union_ (tmp); optimization. And that one doesn't work too well, because wi::eq_p (lh_range, 3) is false: xi.is_sign_extended is true, yi.is_sign_extended is true lh_range.val[0] is -1, and yi.val[0] is 3, so it isn't equal. That is because we haven't sign-extended 3.=