-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Open
Labels
TBAAType-Based Alias Analysis / Strict AliasingType-Based Alias Analysis / Strict Aliasingclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Description
There is a simple case, I get total different results with long
type and long long
type, as shown,
long type
#include <cstdio>
#include <arm_sve.h>
const int SIZE = 16;
int main()
{
int datas[SIZE];
#pragma clang loop vectorize(disable)
for (int i = 0; i < SIZE; i++) {
datas[i] = -i - i - 1;
}
long res2[SIZE];
svbool_t pa = svptrue_b32();
svint32_t v1 = svld1(pa, &datas[0]);
svint64_t v2 = svunpklo(v1);
svst1(pa, (long *)&res2[0], v2);
printf("--%dth-- %lld\n", 0, res2[0]);
printf("--%dth-- %lld\n", 1, res2[1]);
printf("\n");
return 0;
}
output
run with opensource qemu
--0th-- -1
--1th-- -3
#include <cstdio>
#include <arm_sve.h>
const int SIZE = 16;
int main()
{
int datas[SIZE];
#pragma clang loop vectorize(disable)
for (int i = 0; i < SIZE; i++) {
datas[i] = -i - i - 1;
}
long long res2[SIZE];
svbool_t pa = svptrue_b32();
svint32_t v1 = svld1(pa, &datas[0]);
svint64_t v2 = svunpklo(v1);
svst1(pa, (long *)&res2[0], v2);
printf("--%dth-- %lld\n", 0, res2[0]);
printf("--%dth-- %lld\n", 1, res2[1]);
printf("\n");
return 0;
}
output
run with opensource qemu
--0th-- -1
--1th-- -6484229677715469824
I did some preliminary analysis and found that the main difference was in the tbaa results。IR diverged after GVN pass and different tbaa caused different results,
long type
https://godbolt.org/z/3sraTe9bE
long long type
https://godbolt.org/z/sYsrna6ar
Metadata
Metadata
Assignees
Labels
TBAAType-Based Alias Analysis / Strict AliasingType-Based Alias Analysis / Strict Aliasingclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"