Skip to content

Commit 6101889

Browse files
authored
Merge pull request #2031 from matt-gretton-dann/cpp-444-fix-vector_size-INVALID_KEY
Update tests for changes to reporting of vector_size attribute
2 parents 387e21e + cc016d5 commit 6101889

5 files changed

Lines changed: 32 additions & 19 deletions

File tree

cpp/ql/test/library-tests/ir/ir/PrintAST.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8015,7 +8015,7 @@ ir.cpp:
80158015
# 1154| Type = [SpecifiedType] __attribute((vector_size(16UL))) int
80168016
# 1154| init: [Initializer] initializer for vi4
80178017
# 1154| expr: [VectorAggregateLiteral] {...}
8018-
# 1154| Type = [GNUVectorType] __attribute((vector_size(16))) int
8018+
# 1154| Type = [GNUVectorType] __attribute((vector_size(16UL))) int
80198019
# 1154| ValueCategory = prvalue
80208020
# 1154| 0: [Literal] 0
80218021
# 1154| Type = [IntType] int
@@ -8107,7 +8107,7 @@ ir.cpp:
81078107
# 1158| Type = [SpecifiedType] __attribute((vector_size(16UL))) int
81088108
# 1158| ValueCategory = lvalue
81098109
# 1158| 1: [AddExpr] ... + ...
8110-
# 1158| Type = [GNUVectorType] __attribute((vector_size(16))) int
8110+
# 1158| Type = [GNUVectorType] __attribute((vector_size(16UL))) int
81118111
# 1158| ValueCategory = prvalue
81128112
# 1158| 0: [VariableAccess] vi4
81138113
# 1158| Type = [SpecifiedType] __attribute((vector_size(16UL))) int

cpp/ql/test/library-tests/ir/ir/raw_ir.expected

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5277,8 +5277,8 @@ ir.cpp:
52775277
# 1153| mu0_2(unknown) = UnmodeledDefinition :
52785278
# 1153| r0_3(glval<int>) = VariableAddress[i] :
52795279
# 1153| mu0_4(int) = InitializeParameter[i] : &:r0_3
5280-
# 1154| r0_5(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
5281-
# 1154| mu0_6(__attribute((vector_size(16))) int) = Uninitialized[vi4] : &:r0_5
5280+
# 1154| r0_5(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
5281+
# 1154| mu0_6(__attribute((vector_size(16UL))) int) = Uninitialized[vi4] : &:r0_5
52825282
# 1154| r0_7(int) = Constant[0] :
52835283
# 1154| r0_8(glval<int>) = PointerAdd[4] : r0_5, r0_7
52845284
# 1154| r0_9(int) = Constant[0] :
@@ -5296,37 +5296,37 @@ ir.cpp:
52965296
# 1154| r0_21(int) = Constant[3] :
52975297
# 1154| mu0_22(int) = Store : &:r0_20, r0_21
52985298
# 1155| r0_23(glval<int>) = VariableAddress[x] :
5299-
# 1155| r0_24(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
5299+
# 1155| r0_24(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
53005300
# 1155| r0_25(glval<int>) = VariableAddress[i] :
53015301
# 1155| r0_26(int) = Load : &:r0_25, ~mu0_2
53025302
# 1155| r0_27(glval<int>) = PointerAdd[4] : r0_24, r0_26
53035303
# 1155| r0_28(int) = Load : &:r0_27, ~mu0_2
53045304
# 1155| mu0_29(int) = Store : &:r0_23, r0_28
53055305
# 1156| r0_30(glval<int>) = VariableAddress[x] :
53065306
# 1156| r0_31(int) = Load : &:r0_30, ~mu0_2
5307-
# 1156| r0_32(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
5307+
# 1156| r0_32(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
53085308
# 1156| r0_33(glval<int>) = VariableAddress[i] :
53095309
# 1156| r0_34(int) = Load : &:r0_33, ~mu0_2
53105310
# 1156| r0_35(glval<int>) = PointerAdd[4] : r0_32, r0_34
53115311
# 1156| mu0_36(int) = Store : &:r0_35, r0_31
5312-
# 1157| r0_37(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4_shuffle] :
5313-
# 1157| r0_38(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
5314-
# 1157| r0_39(__attribute((vector_size(16))) int) = Load : &:r0_38, ~mu0_2
5315-
# 1157| r0_40(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
5316-
# 1157| r0_41(__attribute((vector_size(16))) int) = Load : &:r0_40, ~mu0_2
5312+
# 1157| r0_37(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4_shuffle] :
5313+
# 1157| r0_38(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
5314+
# 1157| r0_39(__attribute((vector_size(16UL))) int) = Load : &:r0_38, ~mu0_2
5315+
# 1157| r0_40(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
5316+
# 1157| r0_41(__attribute((vector_size(16UL))) int) = Load : &:r0_40, ~mu0_2
53175317
#-----| r0_42(int) = Constant[3] :
53185318
# 1157| r0_43(int) = Constant[2] :
53195319
# 1157| r0_44(int) = Constant[1] :
53205320
# 1157| r0_45(int) = Constant[0] :
53215321
# 1157| r0_46(__attribute((vector_size(16))) int) = BuiltIn[__builtin_shufflevector] : 0:r0_39, 1:r0_41, 2:r0_42, 3:r0_43, 4:r0_44, 5:r0_45
5322-
# 1157| mu0_47(__attribute((vector_size(16))) int) = Store : &:r0_37, r0_46
5323-
# 1158| r0_48(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
5324-
# 1158| r0_49(__attribute((vector_size(16))) int) = Load : &:r0_48, ~mu0_2
5325-
# 1158| r0_50(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4_shuffle] :
5326-
# 1158| r0_51(__attribute((vector_size(16))) int) = Load : &:r0_50, ~mu0_2
5327-
# 1158| r0_52(__attribute((vector_size(16))) int) = Add : r0_49, r0_51
5328-
# 1158| r0_53(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
5329-
# 1158| mu0_54(__attribute((vector_size(16))) int) = Store : &:r0_53, r0_52
5322+
# 1157| mu0_47(__attribute((vector_size(16UL))) int) = Store : &:r0_37, r0_46
5323+
# 1158| r0_48(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
5324+
# 1158| r0_49(__attribute((vector_size(16UL))) int) = Load : &:r0_48, ~mu0_2
5325+
# 1158| r0_50(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4_shuffle] :
5326+
# 1158| r0_51(__attribute((vector_size(16UL))) int) = Load : &:r0_50, ~mu0_2
5327+
# 1158| r0_52(__attribute((vector_size(16UL))) int) = Add : r0_49, r0_51
5328+
# 1158| r0_53(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
5329+
# 1158| mu0_54(__attribute((vector_size(16UL))) int) = Store : &:r0_53, r0_52
53305330
# 1159| v0_55(void) = NoOp :
53315331
# 1153| v0_56(void) = ReturnVoid :
53325332
# 1153| v0_57(void) = UnmodeledUse : mu*
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// semmle-extractor-options: --clang
2+
void builtin(void) {
3+
__attribute__((vector_size(16U))) int vec2 = { 0, 1, 2, 3 };
4+
__attribute__((vector_size(16UL))) int vec = { 0, 1, 2, 3 };
5+
__builtin_shufflevector(vec, vec, 3, 2, 1, 0);
6+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| file://:0:0:0:0 | __attribute((vector_size(16))) int | 4 |
2+
| file://:0:0:0:0 | __attribute((vector_size(16U))) int | 4 |
3+
| file://:0:0:0:0 | __attribute((vector_size(16UL))) int | 4 |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import cpp
2+
3+
from GNUVectorType gvt
4+
select gvt, gvt.getNumElements()

0 commit comments

Comments
 (0)