From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C4B4D385703B; Mon, 10 Aug 2020 14:24:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C4B4D385703B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597069462; bh=4lo1nu5cCtmQSXgn/uBhiqdO57rFPsmsxsluGAYcq3I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yMudE8r6ijbq5HFLlFGl/iMm0s0bt+CcUvRw+ZxYjo8na5EAuFHSo5YmEBq6Y1Dbb 2gjqiAGXD8DmNKxRlrNpz4KMK3e+cyTUWS+t3bngZH8UtmdQo4k8m1ygWlSQGimmwQ WhiFO9+INOpQBvFfqrKOs8l3Svfko5UEu3x0WExU= From: "yevh.kolesnikov at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/96482] [10/11 Regression] Combination of -finline-small-functions and ipa-cp optimisations causes incorrect values being passed to a function since r279523 Date: Mon, 10 Aug 2020 14:24:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: yevh.kolesnikov at gmail dot com X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.3 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: Mon, 10 Aug 2020 14:24:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96482 --- Comment #5 from Yevhenii Kolesnikov = --- (In reply to Martin Li=C5=A1ka from comment #3) > Thank you for the report, I can take a look. > Can you please provide steps how to build Mesa with -O3 and -flto? mesa is configured with meson. LTO can be enabled with builtin option -b_lto=3Dtrue. Options can be supplied to the compiler with -Dc_args and -Dcpp_args. So, to enable O3 it's -Dc_args=3D"-O3" -Dcpp_args=3D"-O3". You'= ll also need to set -Dbuildtype=3Dplain, or otherwise these options will be overwri= tten.=20 So, the full build process will look like this: meson \ -Dbuildtype=3Dplain \ -Dvalgrind=3Dfalse \ -Ddri-drivers=3Di965 \ -Dgallium-drivers=3Diris,swrast \ -Dvulkan-drivers=3D \ -Dgallium-omx=3D"disabled" \ -Dplatforms=3Dx11,drm,surfaceless \ -Dllvm=3Dfalse \ -Db_lto=3Dtrue \ -Dc_args=3D"-g \ -O3 \ " \ -Dcpp_args=3D"-g \ -O3 \ " \ --prefix=3D~/builds/mesa-bug \ ./mesa-bug ninja -C ./mesa-bug install The aforementioned functions and assembly code then will be in ~/builds/mesa-bug/lib/dri/iris_dri.so > About the addr_to_index function: am I right that unreachable is defined = in > your configuration as __builtin_unreachable? To be precise, unreachable is defined like this: #define unreachable(str) \ do { \ assert(!str); \ __builtin_unreachable(); \ } while (0) I'm not sure why this one-time loop is necessary, to be honest. > Can you please replace it with fprintf that prints the value? The value of addr_format? It doesn't print anything, since this branch is n= ever hit. Moreover, it prevents addr_to_index from being inlined, so the crash g= oes away. The value of addr_format in my case is 3, which corresponds to the nir_address_format_32bit_index_offset enum. So, in my case, the first branc= h is always hit.=