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
This commit is contained in:
ian-semmle
2019-09-30 10:45:37 +01:00
committed by GitHub
5 changed files with 32 additions and 19 deletions

View File

@@ -8015,7 +8015,7 @@ ir.cpp:
# 1154| Type = [SpecifiedType] __attribute((vector_size(16UL))) int
# 1154| init: [Initializer] initializer for vi4
# 1154| expr: [VectorAggregateLiteral] {...}
# 1154| Type = [GNUVectorType] __attribute((vector_size(16))) int
# 1154| Type = [GNUVectorType] __attribute((vector_size(16UL))) int
# 1154| ValueCategory = prvalue
# 1154| 0: [Literal] 0
# 1154| Type = [IntType] int
@@ -8107,7 +8107,7 @@ ir.cpp:
# 1158| Type = [SpecifiedType] __attribute((vector_size(16UL))) int
# 1158| ValueCategory = lvalue
# 1158| 1: [AddExpr] ... + ...
# 1158| Type = [GNUVectorType] __attribute((vector_size(16))) int
# 1158| Type = [GNUVectorType] __attribute((vector_size(16UL))) int
# 1158| ValueCategory = prvalue
# 1158| 0: [VariableAccess] vi4
# 1158| Type = [SpecifiedType] __attribute((vector_size(16UL))) int

View File

@@ -5277,8 +5277,8 @@ ir.cpp:
# 1153| mu0_2(unknown) = UnmodeledDefinition :
# 1153| r0_3(glval<int>) = VariableAddress[i] :
# 1153| mu0_4(int) = InitializeParameter[i] : &:r0_3
# 1154| r0_5(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
# 1154| mu0_6(__attribute((vector_size(16))) int) = Uninitialized[vi4] : &:r0_5
# 1154| r0_5(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
# 1154| mu0_6(__attribute((vector_size(16UL))) int) = Uninitialized[vi4] : &:r0_5
# 1154| r0_7(int) = Constant[0] :
# 1154| r0_8(glval<int>) = PointerAdd[4] : r0_5, r0_7
# 1154| r0_9(int) = Constant[0] :
@@ -5296,7 +5296,7 @@ ir.cpp:
# 1154| r0_21(int) = Constant[3] :
# 1154| mu0_22(int) = Store : &:r0_20, r0_21
# 1155| r0_23(glval<int>) = VariableAddress[x] :
# 1155| r0_24(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
# 1155| r0_24(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
# 1155| r0_25(glval<int>) = VariableAddress[i] :
# 1155| r0_26(int) = Load : &:r0_25, ~mu0_2
# 1155| r0_27(glval<int>) = PointerAdd[4] : r0_24, r0_26
@@ -5304,29 +5304,29 @@ ir.cpp:
# 1155| mu0_29(int) = Store : &:r0_23, r0_28
# 1156| r0_30(glval<int>) = VariableAddress[x] :
# 1156| r0_31(int) = Load : &:r0_30, ~mu0_2
# 1156| r0_32(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
# 1156| r0_32(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
# 1156| r0_33(glval<int>) = VariableAddress[i] :
# 1156| r0_34(int) = Load : &:r0_33, ~mu0_2
# 1156| r0_35(glval<int>) = PointerAdd[4] : r0_32, r0_34
# 1156| mu0_36(int) = Store : &:r0_35, r0_31
# 1157| r0_37(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4_shuffle] :
# 1157| r0_38(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
# 1157| r0_39(__attribute((vector_size(16))) int) = Load : &:r0_38, ~mu0_2
# 1157| r0_40(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
# 1157| r0_41(__attribute((vector_size(16))) int) = Load : &:r0_40, ~mu0_2
# 1157| r0_37(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4_shuffle] :
# 1157| r0_38(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
# 1157| r0_39(__attribute((vector_size(16UL))) int) = Load : &:r0_38, ~mu0_2
# 1157| r0_40(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
# 1157| r0_41(__attribute((vector_size(16UL))) int) = Load : &:r0_40, ~mu0_2
#-----| r0_42(int) = Constant[3] :
# 1157| r0_43(int) = Constant[2] :
# 1157| r0_44(int) = Constant[1] :
# 1157| r0_45(int) = Constant[0] :
# 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
# 1157| mu0_47(__attribute((vector_size(16))) int) = Store : &:r0_37, r0_46
# 1158| r0_48(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
# 1158| r0_49(__attribute((vector_size(16))) int) = Load : &:r0_48, ~mu0_2
# 1158| r0_50(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4_shuffle] :
# 1158| r0_51(__attribute((vector_size(16))) int) = Load : &:r0_50, ~mu0_2
# 1158| r0_52(__attribute((vector_size(16))) int) = Add : r0_49, r0_51
# 1158| r0_53(glval<__attribute((vector_size(16))) int>) = VariableAddress[vi4] :
# 1158| mu0_54(__attribute((vector_size(16))) int) = Store : &:r0_53, r0_52
# 1157| mu0_47(__attribute((vector_size(16UL))) int) = Store : &:r0_37, r0_46
# 1158| r0_48(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
# 1158| r0_49(__attribute((vector_size(16UL))) int) = Load : &:r0_48, ~mu0_2
# 1158| r0_50(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4_shuffle] :
# 1158| r0_51(__attribute((vector_size(16UL))) int) = Load : &:r0_50, ~mu0_2
# 1158| r0_52(__attribute((vector_size(16UL))) int) = Add : r0_49, r0_51
# 1158| r0_53(glval<__attribute((vector_size(16UL))) int>) = VariableAddress[vi4] :
# 1158| mu0_54(__attribute((vector_size(16UL))) int) = Store : &:r0_53, r0_52
# 1159| v0_55(void) = NoOp :
# 1153| v0_56(void) = ReturnVoid :
# 1153| v0_57(void) = UnmodeledUse : mu*

View File

@@ -0,0 +1,6 @@
// semmle-extractor-options: --clang
void builtin(void) {
__attribute__((vector_size(16U))) int vec2 = { 0, 1, 2, 3 };
__attribute__((vector_size(16UL))) int vec = { 0, 1, 2, 3 };
__builtin_shufflevector(vec, vec, 3, 2, 1, 0);
}

View File

@@ -0,0 +1,3 @@
| file://:0:0:0:0 | __attribute((vector_size(16))) int | 4 |
| file://:0:0:0:0 | __attribute((vector_size(16U))) int | 4 |
| file://:0:0:0:0 | __attribute((vector_size(16UL))) int | 4 |

View File

@@ -0,0 +1,4 @@
import cpp
from GNUVectorType gvt
select gvt, gvt.getNumElements()