From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3626 invoked by alias); 4 May 2014 09:22:49 -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 3577 invoked by uid 48); 4 May 2014 09:22:42 -0000 From: "andysem at mail dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/61043] LTO accumulates CPU requirements from all input objects Date: Sun, 04 May 2014 09:22:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: andysem at mail dot ru X-Bugzilla-Status: UNCONFIRMED 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: 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-05/txt/msg00163.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61043 --- Comment #2 from andysem at mail dot ru --- (In reply to Andi Kleen from comment #1) > Yes LTO doesn't support different options for different files, and combines > some of them (which happens in your case) and ignores some others. > > You could use tag the functions in the different file with > > __attribute__(target("...")) > > This will also allow automatic switching. > > Arguably gcc should do this automatically for LTO, but unfortunately it > doesn't Unfortunately, gcc does not allow using SIMD intrinsics if not enabled by compiler switches, so leaving the compiler options for a generic target CPU wouldn't work. At least that is the case with gcc 4.8. > Or alternatively don't compile the file that needs the changed options with > LTO Yes, I'm currently not using LTO in my real world project that exhibits this problem. But users of my project would like to enable LTO, and currently this silently produces incorrect binaries. The purpose of this ticket is to indicate the problem and suggest a possible solution (automatically marking each function in every translation unit with the target options).