[PATCH] D52879: Derive builtin return type from its definition

Marco Antognini via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 4 03:56:22 PDT 2018


mantognini created this revision.
mantognini added reviewers: Anastasia, spatel.
Herald added subscribers: cfe-commits, kristina.
mantognini added dependencies: D52873: Remove unwanted signedness conversion from tests, D52875: Fix definitions of __builtin_(add|sub|mul)_overflow.

Prior to this patch, OpenCL code such as the following would attempt to create
a BranchInst with a non-bool argument:

  if (enqueue_kernel(get_default_queue(), 0, nd, ^(void){})) /* ... */

This patch is a follow up on a similar issue with pipe builtin
operations. See commit r280800 and https://bugs.llvm.org/show_bug.cgi?id=30219.

This change, while being conservative on non-builtin functions,
should set the type of expressions invoking builtins to the
proper type, instead of defaulting to `bool` and requiring
manual overrides in Sema::CheckBuiltinFunctionCall.

In addition to tests for enqueue_kernel, the tests are extended to
check other OpenCL builtins.


Repository:
  rC Clang

https://reviews.llvm.org/D52879

Files:
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaExpr.cpp
  test/CodeGenOpenCL/builtins.cl
  test/CodeGenOpenCL/pipe_builtin.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52879.168260.patch
Type: text/x-patch
Size: 7539 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181004/9e0eef7c/attachment.bin>


More information about the cfe-commits mailing list