[PATCH] D92439: Fix missing error for use of 128-bit integer inside SPIR64 device code.

Jennifer Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 1 17:21:37 PST 2020


jyu2 created this revision.
jyu2 added reviewers: erichkeane, aaron.ballman, Fznamznon, rjmccall, jdoerfert, rsmith.
jyu2 added a project: clang.
Herald added a subscriber: Anastasia.
jyu2 requested review of this revision.

Emit error for use of 128-bit integer inside device code had been
already implemented in https://reviews.llvm.org/D74387.  However,
the error is not emitted for SPIR64, due for SPIR64 hasInt128Type
return true.

hasInt128Type: is also used to control generation of certain 128-bit
predefined macros, initializer predefined 128-bit integer types and
build 128-bit ArithmeticTypes.  Except predefined macros, only the
device target is considered, since error only emit when 128-bit
integer is used inside device code, the host target (auxtarget) also
needs to be considered.

The change address:

1. (SPIR.h) Correct hasInt128Type() for SPIR targets.
2. Sema.cpp and SemaOverload.cpp: Add additional check to consider host target(auxtarget) when call to hasInt128Type.  So that __int128_t and __int128() are allowed to avoid error when they used outside device code.
3. SemaType.cpp: add check for SYCLIsDevice to delay the error message. The error will be emitted if the use of 128-bit integer in the device code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92439

Files:
  clang/lib/Basic/Targets/SPIR.h
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/CodeGen/ext-int-cc.c
  clang/test/SemaSYCL/int128.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92439.308815.patch
Type: text/x-patch
Size: 9942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201202/542be3ee/attachment-0001.bin>


More information about the cfe-commits mailing list