Skip to content

Commit edd4398

Browse files
committed
Revert "PR17164: Change clang's default behavior from -flax-vector-conversions=all to -flax-vector-conversions=integer."
This patch broke the Sanitizer buildbots. Please see the commit's differential revision for more information (https://reviews.llvm.org/D67678). This reverts commit b72a8c6.
1 parent d232c21 commit edd4398

File tree

10 files changed

+23
-40
lines changed

10 files changed

+23
-40
lines changed

clang/docs/CommandGuide/clang.rst

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -278,18 +278,9 @@ Language Selection and Mode Options
278278
Make all string literals default to writable. This disables uniquing of
279279
strings and other optimizations.
280280

281-
.. option:: -flax-vector-conversions, -flax-vector-conversions=<kind>, -fno-lax-vector-conversions
281+
.. option:: -flax-vector-conversions
282282

283283
Allow loose type checking rules for implicit vector conversions.
284-
Possible values of <kind>:
285-
286-
- ``none``: allow no implicit conversions between vectors
287-
- ``integer``: allow implicit bitcasts between integer vectors of the same
288-
overall bit-width
289-
- ``all``: allow implicit bitcasts between any vectors of the same
290-
overall bit-width
291-
292-
<kind> defaults to ``integer`` if unspecified.
293284

294285
.. option:: -fblocks
295286

clang/include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ BENIGN_LANGOPT(PascalStrings, 1, 0, "Pascal string support")
121121
LANGOPT(WritableStrings , 1, 0, "writable string support")
122122
LANGOPT(ConstStrings , 1, 0, "const-qualified string support")
123123
ENUM_LANGOPT(LaxVectorConversions, LaxVectorConversionKind, 2,
124-
LaxVectorConversionKind::Integer, "lax vector conversions")
124+
LaxVectorConversionKind::All, "lax vector conversions")
125125
LANGOPT(ConvergentFunctions, 1, 1, "Assume convergent functions")
126126
LANGOPT(AltiVec , 1, 0, "AltiVec-style vector initializers")
127127
LANGOPT(ZVector , 1, 0, "System z vector extensions")

clang/test/Headers/altivec-header.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -o - %s | FileCheck %s
12
// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -flax-vector-conversions=none -o - %s | FileCheck %s
2-
// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -flax-vector-conversions=all -o - %s | FileCheck %s
33
// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -x c++ -o - %s | FileCheck %s
44

55
#include <altivec.h>

clang/test/Headers/arm-neon-header.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -flax-vector-conversions=all -Wvector-conversions -ffreestanding %s
1+
// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -ffreestanding %s
22
// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -flax-vector-conversions=none -ffreestanding %s
33
// RUN: %clang_cc1 -x c++ -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -ffreestanding %s
44

clang/test/Headers/x86-intrinsics-headers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -fsyntax-only -ffreestanding -flax-vector-conversions=all %s
1+
// RUN: %clang_cc1 -fsyntax-only -ffreestanding %s
22
// RUN: %clang_cc1 -fsyntax-only -ffreestanding -flax-vector-conversions=none %s
33
// RUN: %clang_cc1 -fsyntax-only -ffreestanding -x c++ %s
44

clang/test/Headers/x86intrin-2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -fsyntax-only -ffreestanding -Wcast-qual -flax-vector-conversions=all %s -verify
2-
// RUN: %clang_cc1 -fsyntax-only -ffreestanding -Wcast-qual -flax-vector-conversions=none %s -verify
1+
// RUN: %clang_cc1 -fsyntax-only -ffreestanding -Wcast-qual %s -verify
2+
// RUN: %clang_cc1 -fsyntax-only -ffreestanding -flax-vector-conversions=none -Wcast-qual %s -verify
33
// RUN: %clang_cc1 -fsyntax-only -ffreestanding -Wcast-qual -x c++ %s -verify
44
// expected-no-diagnostics
55

clang/test/Headers/x86intrin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -fsyntax-only -ffreestanding -flax-vector-conversions=all %s -verify
1+
// RUN: %clang_cc1 -fsyntax-only -ffreestanding %s -verify
22
// RUN: %clang_cc1 -fsyntax-only -ffreestanding -flax-vector-conversions=none %s -verify
33
// RUN: %clang_cc1 -fsyntax-only -ffreestanding -x c++ %s -verify
44
// expected-no-diagnostics

clang/test/Sema/vector-assign.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,28 @@ void test1() {
1414

1515
v1 = v2; // expected-warning {{incompatible vector types assigning to 'v2s' (vector of 2 'int' values) from 'v2u' (vector of 2 'unsigned int' values)}}
1616
v1 = v3; // expected-error {{assigning to 'v2s' (vector of 2 'int' values) from incompatible type 'v1s' (vector of 1 'int' value)}}
17-
v1 = v4; // expected-error {{assigning to 'v2s' (vector of 2 'int' values) from incompatible type 'v2f' (vector of 2 'float' values)}}
17+
v1 = v4; // expected-warning {{incompatible vector types assigning to 'v2s' (vector of 2 'int' values) from 'v2f' (vector of 2 'float' values)}}
1818
v1 = v5; // expected-warning {{incompatible vector types assigning to 'v2s' (vector of 2 'int' values) from 'v4ss' (vector of 4 'short' values)}}
1919

2020
v2 = v1; // expected-warning {{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'v2s' (vector of 2 'int' values)}}
2121
v2 = v3; // expected-error {{assigning to 'v2u' (vector of 2 'unsigned int' values) from incompatible type 'v1s' (vector of 1 'int' value)}}
22-
v2 = v4; // expected-error {{assigning to 'v2u' (vector of 2 'unsigned int' values) from incompatible type 'v2f' (vector of 2 'float' values)}}
22+
v2 = v4; // expected-warning {{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'v2f' (vector of 2 'float' values)}}
2323
v2 = v5; // expected-warning {{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'v4ss' (vector of 4 'short' values)}}
2424

2525
v3 = v1; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v2s' (vector of 2 'int' values)}}
2626
v3 = v2; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v2u' (vector of 2 'unsigned int' values)}}
2727
v3 = v4; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v2f' (vector of 2 'float' values)}}
2828
v3 = v5; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v4ss'}}
2929

30-
v4 = v1; // expected-error {{assigning to 'v2f' (vector of 2 'float' values) from incompatible type 'v2s' (vector of 2 'int' values)}}
31-
v4 = v2; // expected-error {{assigning to 'v2f' (vector of 2 'float' values) from incompatible type 'v2u' (vector of 2 'unsigned int' values)}}
30+
v4 = v1; // expected-warning {{incompatible vector types assigning to 'v2f' (vector of 2 'float' values) from 'v2s' (vector of 2 'int' values)}}
31+
v4 = v2; // expected-warning {{incompatible vector types assigning to 'v2f' (vector of 2 'float' values) from 'v2u' (vector of 2 'unsigned int' values)}}
3232
v4 = v3; // expected-error {{assigning to 'v2f' (vector of 2 'float' values) from incompatible type 'v1s' (vector of 1 'int' value)}}
33-
v4 = v5; // expected-error {{assigning to 'v2f' (vector of 2 'float' values) from incompatible type 'v4ss' (vector of 4 'short' values)}}
33+
v4 = v5; // expected-warning {{incompatible vector types assigning to 'v2f' (vector of 2 'float' values) from 'v4ss' (vector of 4 'short' values)}}
3434

3535
v5 = v1; // expected-warning {{incompatible vector types assigning to 'v4ss' (vector of 4 'short' values) from 'v2s' (vector of 2 'int' values)}}
3636
v5 = v2; // expected-warning {{incompatible vector types assigning to 'v4ss' (vector of 4 'short' values) from 'v2u' (vector of 2 'unsigned int' values)}}
3737
v5 = v3; // expected-error {{assigning to 'v4ss' (vector of 4 'short' values) from incompatible type 'v1s' (vector of 1 'int' value)}}
38-
v5 = v4; // expected-error {{assigning to 'v4ss' (vector of 4 'short' values) from incompatible type 'v2f'}}
38+
v5 = v4; // expected-warning {{incompatible vector types assigning to 'v4ss' (vector of 4 'short' values) from 'v2f'}}
3939
}
4040

4141
// PR2263

clang/test/Sema/vector-cast.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: %clang_cc1 -fsyntax-only %s -verify=expected,no-lax -Wvector-conversion -flax-vector-conversions=none
2-
// RUN: %clang_cc1 -fsyntax-only %s -verify=expected,lax -Wvector-conversion -flax-vector-conversions=all
1+
// RUN: %clang_cc1 -fsyntax-only %s -verify -Wvector-conversion
32

43
typedef long long t1 __attribute__ ((vector_size (8)));
54
typedef char t2 __attribute__ ((vector_size (16)));
@@ -42,9 +41,7 @@ type 't1' (vector of 1 'long long' value) and integer type 'short' of different
4241
void f2(t2 X); // expected-note{{passing argument to parameter 'X' here}}
4342

4443
void f3(t3 Y) {
45-
f2(Y);
46-
// lax-warning@-1 {{incompatible vector types passing 't3' (vector of 4 'float' values) to parameter of type 't2' (vector of 16 'char' values)}}
47-
// no-lax-error@-2 {{passing 't3' (vector of 4 'float' values) to parameter of incompatible type 't2' (vector of 16 'char' values)}}
44+
f2(Y); // expected-warning {{incompatible vector types passing 't3' (vector of 4 'float' values) to parameter of type 't2' (vector of 16 'char' values)}}
4845
}
4946

5047
typedef float float2 __attribute__ ((vector_size (8)));
@@ -61,15 +58,13 @@ void f4() {
6158
float64x2_t v = {0.0, 1.0};
6259
f2 += d; // expected-error {{cannot convert between scalar type 'double' and vector type 'float2' (vector of 2 'float' values) as implicit conversion would cause truncation}}
6360
d += f2; // expected-error {{assigning to 'double' from incompatible type 'float2' (vector of 2 'float' values)}}
64-
a = 3.0 + vget_low_f64(v); // no-lax-error {{assigning to 'double' from incompatible type 'float64x1_t' (vector of 1 'double' value)}}
65-
b = vget_low_f64(v) + 3.0; // no-lax-error {{assigning to 'double' from incompatible type 'float64x1_t' (vector of 1 'double' value)}}
66-
c = vget_low_f64(v); // no-lax-error {{assigning to 'double' from incompatible type 'float64x1_t' (vector of 1 'double' value)}}
67-
c -= vget_low_f64(v); // no-lax-error {{assigning to 'double' from incompatible type 'float64x1_t' (vector of 1 'double' value)}}
61+
a = 3.0 + vget_low_f64(v);
62+
b = vget_low_f64(v) + 3.0;
63+
c = vget_low_f64(v);
64+
c -= vget_low_f64(v);
6865
// LAX conversions between scalar and vector types require same size and one element sized vectors.
6966
d = f2; // expected-error {{assigning to 'double' from incompatible type 'float2'}}
70-
d = d + f2;
71-
// lax-error@-1 {{assigning to 'double' from incompatible type 'float2' (vector of 2 'float' values)}}
72-
// no-lax-error@-2 {{cannot convert between scalar type 'double' and vector type 'float2' (vector of 2 'float' values) as implicit conversion would cause truncation}}
67+
d = d + f2; // expected-error {{assigning to 'double' from incompatible type 'float2'}}
7368
}
7469

7570
// rdar://15931426
@@ -83,8 +78,6 @@ void f5() {
8378
}
8479

8580
void f6(vSInt32 a0) {
86-
vUInt32 counter = (float16){0.0f, 0.0f, 0.0f, 0.0f};
87-
// lax-warning@-1 {{incompatible vector types initializing 'vUInt32' (vector of 4 'unsigned int' values) with an expression of type 'float16' (vector of 4 'float' values)}}
88-
// no-lax-error@-2 {{initializing 'vUInt32' (vector of 4 'unsigned int' values) with an expression of incompatible type 'float16' (vector of 4 'float' values)}}
81+
vUInt32 counter = (float16){0.0f, 0.0f, 0.0f, 0.0f}; // expected-warning {{incompatible vector types initializing 'vUInt32' (vector of 4 'unsigned int' values) with an expression of type 'float16' (vector of 4 'float' values)}}
8982
counter -= a0;
9083
}

clang/test/Sema/vector-ops.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: %clang_cc1 %s -verify -fsyntax-only -Wvector-conversion -triple x86_64-apple-darwin10 -flax-vector-conversions=all
2-
// FIXME: We get worse diagnostics here with -flax-vector-conversions disabled.
1+
// RUN: %clang_cc1 %s -verify -fsyntax-only -Wvector-conversion -triple x86_64-apple-darwin10
32
typedef unsigned int v2u __attribute__ ((vector_size (8)));
43
typedef int v2s __attribute__ ((vector_size (8)));
54
typedef float v2f __attribute__ ((vector_size(8)));

0 commit comments

Comments
 (0)