From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18225 invoked by alias); 13 Oct 2014 15:51:07 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 18154 invoked by uid 48); 13 Oct 2014 15:51:02 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/63464] compare one character to many: faster Date: Mon, 13 Oct 2014 15:51:00 -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: 5.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-10/txt/msg00967.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63464 --- Comment #9 from Jakub Jelinek --- Created attachment 33697 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33697&action=edit gcc5-pr63464.patch WIP patch. What is missing: 1) the optimize_range_tests_to_bit_test call should be guarded by lshift_cheap_p (), Richard, any preference on where to declare that function (tree-switch-conversion.h and include that in tree-ssa-reassoc.c, somewhere else?) 2) much more importantly, it right now doesn't actually fixup the IL, so instead of the desirable jump around the shift we have there just BIT_IOR_EXPR (and the shift actually happens to be done first, before the range test). Richard, any preference how to represent it in the IL from in between the optimization and fixup once all bbs are reassociated? I've been thinking about e.g. some pass-through internal call on the TRUTH_ORIF_EXPR operand. Another option might be, if we'd adjust update_range_test, so that it would not only emit a gimplification of the range test, but also an optional gimple_seq before that, would be to push all the SSA_NAMEs that would be otherwise passed to the internal call, into some vector, and just split bb after the def stmt of those SSA_NAMEs and also before the (single, hopefully) user of that SSA_NAME, adding an edge around the middle of the bb and PHI.