Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

vectorization remark is printed multiple times #27617

Open Quuxplusone opened 8 years ago

Quuxplusone commented 8 years ago
Bugzilla Link PR27618
Status NEW
Importance P normal
Reported by Albert Netymk (albertnetymk@gmail.com)
Reported on 2016-05-03 10:42:58 -0700
Last modified on 2018-05-30 03:15:35 -0700
Version 3.8
Hardware PC Linux
CC francisvm@yahoo.com, hfinkel@anl.gov, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
#define SIZE (1 << 15)

#define MINDEX(n, m) (SIZE*(n)+(m))

#define XMM_ALIGNMENT_BYTES 16

float *restrict mat_a __attribute__((aligned (XMM_ALIGNMENT_BYTES)));
float *restrict vec_b __attribute__((aligned (XMM_ALIGNMENT_BYTES)));
float *restrict vec_c __attribute__((aligned (XMM_ALIGNMENT_BYTES)));

// __attribute__ ((noinline))
void matvec_autovec()
{
    int i, j;

    float tmp;
    for (i = 0; i < SIZE; i++) {
        tmp = 0;
        for (j = 0; j < SIZE; j++) {
            tmp += mat_a[MINDEX(i, j)] * vec_b[j];
        }
        vec_c[i] = tmp;
    }
}

void multiple()
{
    matvec_autovec();
}

int main(int argc, char **argv)
{
    return 0;
}

The command I used is clang-3.8 -Ofast test.c -Rpass=loop-vectorize

test.c:22:9: remark: vectorized loop (vectorization width: 4, interleaved count: 1) [-Rpass=loop-vectorize]
        for (j = 0; j < SIZE; j++) {
        ^
test.c:22:9: remark: vectorized loop (vectorization width: 4, interleaved count: 1) [-Rpass=loop-vectorize]

The output reduces to 1 after I uncomment the noinline attribute.

Quuxplusone commented 8 years ago

Indeed, I think we need to provide more information when the remark occurs in the context of inlined code.