[cfe-commits] r132975 - in /cfe/trunk: lib/Sema/SemaChecking.cpp test/Sema/conversion-64-32.c
Chris Lattner
sabre at nondot.org
Mon Jun 13 21:51:15 PDT 2011
Author: lattner
Date: Mon Jun 13 23:51:15 2011
New Revision: 132975
URL: http://llvm.org/viewvc/llvm-project?rev=132975&view=rev
Log:
fix rdar://9546171 - -Wshorten-64-to-32 shouldn't warn on vector bitcasts.
Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/Sema/conversion-64-32.c
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=132975&r1=132974&r2=132975&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Mon Jun 13 23:51:15 2011
@@ -2895,6 +2895,11 @@
return;
return DiagnoseImpCast(S, E, T, CC, diag::warn_impcast_vector_scalar);
}
+
+ // If the vector cast is cast between two vectors of the same size, it is
+ // a bitcast, not a conversion.
+ if (S.Context.getTypeSize(Source) == S.Context.getTypeSize(Target))
+ return;
Source = cast<VectorType>(Source)->getElementType().getTypePtr();
Target = cast<VectorType>(Target)->getElementType().getTypePtr();
@@ -2989,9 +2994,7 @@
return;
}
- // People want to build with -Wshorten-64-to-32 and not -Wconversion
- // and by god we'll let them.
-
+ // People want to build with -Wshorten-64-to-32 and not -Wconversion.
if (isFromSystemMacro(S, CC))
return;
Modified: cfe/trunk/test/Sema/conversion-64-32.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/conversion-64-32.c?rev=132975&r1=132974&r2=132975&view=diff
==============================================================================
--- cfe/trunk/test/Sema/conversion-64-32.c (original)
+++ cfe/trunk/test/Sema/conversion-64-32.c Mon Jun 13 23:51:15 2011
@@ -3,3 +3,13 @@
int test0(long v) {
return v; // expected-warning {{implicit conversion loses integer precision}}
}
+
+
+// rdar://9546171
+typedef int int4 __attribute__ ((vector_size(16)));
+typedef long long long2 __attribute__((__vector_size__(16)));
+
+int4 test1(long2 a) {
+ int4 v127 = a; // no warning.
+ return v127;
+}
More information about the cfe-commits
mailing list