Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6611465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:58:23+00:00 2026-05-25T19:58:23+00:00

One particular hot spot when I profile a code I am working on, is

  • 0

One particular hot spot when I profile a code I am working on, is the following loop:

for(int loc = start; loc<end; ++loc)
    y[loc]+=a[offset+loc]*x[loc+d];

where the arrays y, a, and x have no overlap. It seems to me that a loop like this should be easily vectorized, however when I compile using g++ with the options “-O3 -ftree-vectorize -ftree-vectorizer-verbose=1”, I get no indication that this particular loop was vectorized. However, a loop occurring just before the code above:

for(int i=0; i<m; ++i)
    y[i]=0;

does get vectorized according to the output. Any thoughts on why the first loop is not vectorized, or how I might be able to fix this? (I am not all that educated on the concept of vectorization, so I am likely missing something quite obvious)

As per Oli’s suggestion, turning up the verbosity yields the following notes (while I am usually good at reading compiler warnings/errors/output, I have no idea what this means):

./include/mv_ops.h:89: note: dependence distance  = 0.
./include/mv_ops.h:89: note: accesses have the same alignment.
./include/mv_ops.h:89: note: dependence distance modulo vf == 0 between *D.50620_89 and *D.50620_89
./include/mv_ops.h:89: note: not vectorized: can't determine dependence between *D.50623_98 and *D.50620_89
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:58:24+00:00Added an answer on May 25, 2026 at 7:58 pm

    You need to tell the compiler that x, y, and a do not overlap. In C/C++ terms that means telling the compiler that those pointers do not alias by declaring them with restrict (or __restrict). gcc is very aggressive about optimizations when it assumes no aliasing, so be careful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For one particular issue in the architecture of an application I'm working on, interfaces
I have the following HTML code: <div class=container> <span class=red></span> <span class=hot></span> </div> On
My question is about one particular usage of static keyword. It is possible to
I have one particular FLA that is crashing every time I try to compile
How to show and hide one particular column in Mouse Over and Mouse out
I have a data frame where one particular column has a set of specific
My map is currently inefficient when parsing one particular set of files (a total
What MySQL query will do a text search and replace in one particular field
I want to search a table to find all rows where one particular field
Say I'm interested in the source for one particular Linux utility, like factor .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.