Skip to content

Commit 6622dcc

Browse files
committed
Address more review comments
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
1 parent df9531f commit 6622dcc

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ static llvm::MDNode *getAspectEnumValueMD(ASTContext &ASTContext,
534534
AspectEnumValMD.push_back(llvm::MDString::get(Ctx, ECD->getName()));
535535
AspectEnumValMD.push_back(
536536
llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
537-
llvm::Type::getInt32Ty(Ctx), ECD->getInitVal().getZExtValue())));
537+
llvm::Type::getInt32Ty(Ctx), ECD->getInitVal().getSExtValue())));
538538
return llvm::MDNode::get(Ctx, AspectEnumValMD);
539539
}
540540

clang/test/CodeGenSYCL/Inputs/sycl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ enum class address_space : int {
7070
} // namespace access
7171

7272
// Dummy aspect enum with limited enumerators
73-
enum class __SYCL_TYPE(aspect) aspect {
73+
enum class __SYCL_TYPE(aspect) aspect { // #AspectEnum
7474
host = 0,
7575
cpu = 1,
7676
gpu = 2,

clang/test/CodeGenSYCL/multiple_aspect_enum.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
1-
// RUN: %clang_cc1 -fsycl-is-device -triple spir64-unknown-unknown -fsyntax-only -verify -emit-llvm-only %s
1+
// RUN: %clang_cc1 -internal-isystem %S/Inputs -fsycl-is-device -triple spir64-unknown-unknown -fsyntax-only -verify -emit-llvm-only %s
22

33
// Tests for error diagnostics when multiple definitions of
44
// [[__sycl_detail__::sycl_type(aspect)]] enums are present.
5+
#include "sycl.hpp"
56

6-
// expected-note@+1{{previous definition is here}}
7-
enum class [[__sycl_detail__::sycl_type(aspect)]] aspect {
8-
host = 0,
9-
cpu = 1,
10-
gpu = 2,
11-
accelerator = 3,
12-
custom = 4,
13-
fp16 = 5,
14-
fp64 = 6,
15-
future_aspect = 12
16-
};
7+
// expected-note@#AspectEnum{{previous definition is here}}
178

189
// expected-error@+1{{redefinition of aspect enum}}
1910
enum class [[__sycl_detail__::sycl_type(aspect)]] aspect_redef {

llvm/lib/SYCLLowerIR/SYCLPropagateAspectsUsage.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ using AspectValueToNameMapTy = SmallMapVector<StringRef, int, 32>;
8383

8484
/// Retrieves from metadata (sycl_aspects) the mapping between SYCL aspect names
8585
/// and their integral values.
86-
AspectValueToNameMapTy getSYCLAspectsFromMetadata(const Module &M) {
86+
AspectValueToNameMapTy getAspectsFromMetadata(const Module &M) {
8787
const NamedMDNode *Node = M.getNamedMetadata("sycl_aspects");
8888
AspectValueToNameMapTy Result;
8989
if (!Node)
@@ -136,7 +136,7 @@ void propagateAspectsThroughTypes(const TypesEdgesTy &Edges, const Type *Start,
136136
/// another type TT, which in turn uses the aspect A.
137137
/// @TypesWithAspects argument consist of known types with aspects
138138
/// from metadata information.
139-
/// @AspectValues argument consist of known known aspect values and their names.
139+
/// @AspectValues argument consist of known aspect values and their names.
140140
///
141141
/// The algorithm is the following:
142142
/// 1) Make a list of all structure types from module @M. The list also
@@ -362,7 +362,7 @@ buildFunctionsToAspectsMap(Module &M, TypeToAspectsMapTy &TypesWithAspects) {
362362
PreservedAnalyses
363363
SYCLPropagateAspectsUsagePass::run(Module &M, ModuleAnalysisManager &MAM) {
364364
TypeToAspectsMapTy TypesWithAspects = getTypesThatUseAspectsFromMetadata(M);
365-
AspectValueToNameMapTy AspectValues = getSYCLAspectsFromMetadata(M);
365+
AspectValueToNameMapTy AspectValues = getAspectsFromMetadata(M);
366366

367367
// If there is no metadata for aspect values the source code must not have
368368
// included the SYCL headers. In that case there should also not be any types

0 commit comments

Comments
 (0)