Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenCL] Fix ICE with invalid use of half
Because half is limited to the `cl_khr_fp16` extension being enabled, `DefaultLvalueConversion` can fail when it's not enabled. The original assumption that it will never fail is therefore wrong now. Fixes: PR47976 Reviewed By: Anastasia Differential Revision: https://reviews.llvm.org/D103175
- Loading branch information
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//RUN: %clang_cc1 %s -triple spir -verify -fsyntax-only | ||
|
||
#pragma OPENCL EXTENSION cl_khr_fp16 : disable | ||
|
||
typedef half half2 __attribute__((ext_vector_type(2))); | ||
|
||
half f(half2 h2) { // expected-error{{declaring function return value of type 'half' is not allowed ; did you forget * ?}} | ||
return h2.s0; // expected-error{{loading directly from pointer to type '__private half' requires cl_khr_fp16. Use vector data load builtin functions instead}} | ||
} | ||
|
||
#pragma OPENCL EXTENSION cl_khr_fp16 : enable | ||
|
||
half f(half2 h2) { | ||
return h2.s0; | ||
} |