@@ -104,12 +104,12 @@ int main(int argc, const char **argv) {
104
104
// <kind>-<triple>
105
105
// where <kind> is host, openmp, hip, sycl or fpga,
106
106
// and <triple> is an offload target triple.
107
+ SmallVector<StringRef, 8u > Kinds (Targets.size ());
107
108
SmallVector<StringRef, 8u > Triples (Targets.size ());
108
109
for (unsigned I = 0 ; I < Targets.size (); ++I) {
109
- StringRef Kind;
110
- std::tie (Kind, Triples[I]) = StringRef (Targets[I]).split (' -' );
110
+ std::tie (Kinds[I], Triples[I]) = StringRef (Targets[I]).split (' -' );
111
111
112
- bool KindIsValid = StringSwitch<bool >(Kind )
112
+ bool KindIsValid = StringSwitch<bool >(Kinds[I] )
113
113
.Case (" host" , true )
114
114
.Case (" openmp" , true )
115
115
.Case (" hip" , true )
@@ -124,7 +124,7 @@ int main(int argc, const char **argv) {
124
124
raw_svector_ostream Msg (Buf);
125
125
Msg << " invalid target '" << Targets[I] << " '" ;
126
126
if (!KindIsValid)
127
- Msg << " , unknown offloading kind '" << Kind << " '" ;
127
+ Msg << " , unknown offloading kind '" << Kinds[I] << " '" ;
128
128
if (!TripleIsValid)
129
129
Msg << " , unknown target triple '" << Triples[I] << " '" ;
130
130
reportError (createStringError (errc::invalid_argument, Msg.str ()));
@@ -202,11 +202,11 @@ int main(int argc, const char **argv) {
202
202
if (!Used.empty ()) {
203
203
ArrayType *ArrayTy = ArrayType::get (Int8PtrTy, Used.size ());
204
204
205
- // SPIRV linking is done on LLVM IR inputs, so we can use special
205
+ // SYCL/ SPIRV linking is done on LLVM IR inputs, so we can use special
206
206
// global variable llvm.used to represent a reference to a symbol. But for
207
207
// other targets we have to create a real reference since llvm.used may
208
208
// not be representable in the object file.
209
- if (Triple (Triples[I]).isSPIR ()) {
209
+ if (Kinds[I] == " sycl " || Triple (Triples[I]).isSPIR ()) {
210
210
auto *GV = new GlobalVariable (
211
211
Mod, ArrayTy, false , GlobalValue::AppendingLinkage,
212
212
ConstantArray::get (ArrayTy, Used), " llvm.used" );
0 commit comments