1 | // RUN: %clang_cc1 %s -triple hexagon-unknown-elf -O2 -emit-llvm -o - | FileCheck %s |
2 | |
3 | typedef union __attribute__((aligned(4))) { |
4 | unsigned short uh[2]; |
5 | unsigned uw; |
6 | } vect32; |
7 | |
8 | void bar(vect32 p[][2]); |
9 | |
10 | // CHECK-LABEL: define void @fred |
11 | void fred(unsigned Num, int Vec[2], int *Index, int Arr[4][2]) { |
12 | vect32 Tmp[4][2]; |
13 | // Generate tbaa for the load of Index: |
14 | // CHECK: load i32, i32* %Index{{.*}}tbaa |
15 | // But no tbaa for the two stores: |
16 | // CHECK: %uw[[UW1:[0-9]*]] = getelementptr |
17 | // CHECK: store{{.*}}%uw[[UW1]] |
18 | // CHECK: tbaa ![[OCPATH:[0-9]+]] |
19 | // There will be a load after the store, and it will use tbaa. Make sure |
20 | // the check-not above doesn't find it: |
21 | // CHECK: load |
22 | Tmp[*Index][0].uw = Arr[*Index][0] * Num; |
23 | // CHECK: %uw[[UW2:[0-9]*]] = getelementptr |
24 | // CHECK: store{{.*}}%uw[[UW2]] |
25 | // CHECK: tbaa ![[OCPATH]] |
26 | Tmp[*Index][1].uw = Arr[*Index][1] * Num; |
27 | // Same here, don't generate tbaa for the loads: |
28 | // CHECK: %uh[[UH1:[0-9]*]] = bitcast %union.vect32 |
29 | // CHECK: %arrayidx[[AX1:[0-9]*]] = getelementptr{{.*}}%uh[[UH1]] |
30 | // CHECK: load i16, i16* %arrayidx[[AX1]] |
31 | // CHECK: tbaa ![[OCPATH]] |
32 | // CHECK: store |
33 | Vec[0] = Tmp[*Index][0].uh[1]; |
34 | // CHECK: %uh[[UH2:[0-9]*]] = bitcast %union.vect32 |
35 | // CHECK: %arrayidx[[AX2:[0-9]*]] = getelementptr{{.*}}%uh[[UH2]] |
36 | // CHECK: load i16, i16* %arrayidx[[AX2]] |
37 | // CHECK: tbaa ![[OCPATH]] |
38 | // CHECK: store |
39 | Vec[1] = Tmp[*Index][1].uh[1]; |
40 | bar(Tmp); |
41 | } |
42 | |
43 | // CHECK-DAG: ![[CHAR:[0-9]+]] = !{!"omnipotent char" |
44 | // CHECK-DAG: ![[OCPATH]] = !{![[CHAR]], ![[CHAR]], i64 0} |
45 | |