[llvm-branch-commits] [cfe-branch] r368843 - Merging r368561:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Aug 14 05:53:30 PDT 2019
Author: hans
Date: Wed Aug 14 05:53:30 2019
New Revision: 368843
URL: http://llvm.org/viewvc/llvm-project?rev=368843&view=rev
Log:
Merging r368561:
------------------------------------------------------------------------
r368561 | svenvh | 2019-08-12 14:44:26 +0200 (Mon, 12 Aug 2019) | 9 lines
[OpenCL] Ignore parentheses for sampler initialization
The sampler handling logic in SemaInit.cpp would inadvertently treat
parentheses around sampler arguments as an implicit cast, leading to
an unreachable "can't implicitly cast lvalue to rvalue with
this cast kind". Fix by ignoring parentheses once we are in the
sampler initializer case.
Differential Revision: https://reviews.llvm.org/D66080
------------------------------------------------------------------------
Modified:
cfe/branches/release_90/ (props changed)
cfe/branches/release_90/lib/Sema/SemaInit.cpp
cfe/branches/release_90/test/SemaOpenCL/sampler_t.cl
Propchange: cfe/branches/release_90/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 14 05:53:30 2019
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:366429,366448,366457,366474,366480,366483,366511,366670,366694,366699,366878,367008,367039,367055,367103,367134,367301,367305,367323,367387,367403,367520,367530,367661,367675,367802,367823,367906,368104,368202
+/cfe/trunk:366429,366448,366457,366474,366480,366483,366511,366670,366694,366699,366878,367008,367039,367055,367103,367134,367301,367305,367323,367387,367403,367520,367530,367661,367675,367802,367823,367906,368104,368202,368561
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_90/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_90/lib/Sema/SemaInit.cpp?rev=368843&r1=368842&r2=368843&view=diff
==============================================================================
--- cfe/branches/release_90/lib/Sema/SemaInit.cpp (original)
+++ cfe/branches/release_90/lib/Sema/SemaInit.cpp Wed Aug 14 05:53:30 2019
@@ -8116,7 +8116,7 @@ ExprResult InitializationSequence::Perfo
// argument passing.
assert(Step->Type->isSamplerT() &&
"Sampler initialization on non-sampler type.");
- Expr *Init = CurInit.get();
+ Expr *Init = CurInit.get()->IgnoreParens();
QualType SourceType = Init->getType();
// Case 1
if (Entity.isParameterKind()) {
Modified: cfe/branches/release_90/test/SemaOpenCL/sampler_t.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_90/test/SemaOpenCL/sampler_t.cl?rev=368843&r1=368842&r2=368843&view=diff
==============================================================================
--- cfe/branches/release_90/test/SemaOpenCL/sampler_t.cl (original)
+++ cfe/branches/release_90/test/SemaOpenCL/sampler_t.cl Wed Aug 14 05:53:30 2019
@@ -10,6 +10,9 @@
#define CLK_FILTER_NEAREST 0x10
#define CLK_FILTER_LINEAR 0x20
+typedef float float4 __attribute__((ext_vector_type(4)));
+float4 read_imagef(read_only image1d_t, sampler_t, float);
+
constant sampler_t glb_smp = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_LINEAR;
constant sampler_t glb_smp2; // expected-error{{variable in constant address space must be initialized}}
global sampler_t glb_smp3 = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_NEAREST; // expected-error{{sampler type cannot be used with the __local and __global address space qualifiers}} expected-error {{global sampler requires a const or constant address space qualifier}}
@@ -74,3 +77,7 @@ void bar() {
foo(smp1+1); //expected-error{{invalid operands to binary expression ('sampler_t' and 'int')}}
}
+void smp_args(read_only image1d_t image) {
+ // Test that parentheses around sampler arguments are ignored.
+ float4 res = read_imagef(image, (glb_smp10), 0.0f);
+}
More information about the llvm-branch-commits
mailing list