From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30454 invoked by alias); 18 Feb 2014 03:16:54 -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 30403 invoked by uid 48); 18 Feb 2014 03:16:49 -0000 From: "harmeeksingh at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/60220] Vectorization : simple loop : fails to vectorize Date: Tue, 18 Feb 2014 03:16:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: harmeeksingh at gmail dot com X-Bugzilla-Status: RESOLVED 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-02/txt/msg01758.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60220 --- Comment #3 from harmeeksingh at gmail dot com --- It still does not vectorise after adding the recomended flag. But rewriting the code the following way does. This is a bizare behavioir . My tests show that this is not an issue of gcc rewriting it as a memset . If I change the value 0 to a array assignment it still gives. From the output it does show that it is trying to assign FALSE. 31: not vectorized: data ref analysis failed *D.2549_9 = 0; 31: not vectorized: data ref analysis failed *D.2549_9 = 0; #include #include #define FALSE ((char )0) struct test { int *copy; }; typedef struct test test; static inline foo1(int *a, unsigned int num) { unsigned int cnt; for (cnt = 0; cnt < num ; cnt++) a[cnt] = FALSE; } typedef uintptr_t Datum; void foo(test *__restrict c, unsigned int a, unsigned int num) { foo1(c->copy, num); // This vectorizes. if we pass it to inline function }