Skip to content

Commit e09b1b8

Browse files
committed
Apply comments
1 parent 159d676 commit e09b1b8

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

llvm/tools/sycl-post-link/SpecConstants.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,6 @@ Instruction *emitSpecConstantComposite(Type *Ty,
318318
/// first ID. If \c IsNewSpecConstant is false, this vector is expected to
319319
/// contain enough elements to assign ID to each scalar element encountered in
320320
/// the specified composite type.
321-
/// @param IsNewSpecConstant [in] Flag to specify whether \c IDs vector should
322-
/// be filled with new IDs or it should be used as-is to replicate an existing
323-
/// spec constant
324321
/// @param [in,out] Index Index of scalar element within a composite type
325322
///
326323
/// @returns Instruction* representing specialization constant in LLVM IR, which
@@ -333,7 +330,6 @@ Instruction *emitSpecConstantComposite(Type *Ty,
333330
/// encountered scalars and assigns them IDs (or re-uses existing ones).
334331
Instruction *emitSpecConstantRecursiveImpl(Type *Ty, Instruction *InsertBefore,
335332
SmallVectorImpl<unsigned> &IDs,
336-
bool IsNewSpecConstant,
337333
unsigned &Index) {
338334
if (!Ty->isArrayTy() && !Ty->isStructTy() && !Ty->isVectorTy()) { // Scalar
339335
if (Index >= IDs.size()) {
@@ -346,8 +342,8 @@ Instruction *emitSpecConstantRecursiveImpl(Type *Ty, Instruction *InsertBefore,
346342

347343
SmallVector<Instruction *, 8> Elements;
348344
auto LoopIteration = [&](Type *Ty) {
349-
Elements.push_back(emitSpecConstantRecursiveImpl(Ty, InsertBefore, IDs,
350-
IsNewSpecConstant, Index));
345+
Elements.push_back(
346+
emitSpecConstantRecursiveImpl(Ty, InsertBefore, IDs, Index));
351347
};
352348

353349
if (auto *ArrTy = dyn_cast<ArrayType>(Ty)) {
@@ -371,11 +367,9 @@ Instruction *emitSpecConstantRecursiveImpl(Type *Ty, Instruction *InsertBefore,
371367

372368
/// Wrapper intended to hide IsFirstElement argument from the caller
373369
Instruction *emitSpecConstantRecursive(Type *Ty, Instruction *InsertBefore,
374-
SmallVectorImpl<unsigned> &IDs,
375-
bool IsNewSpecConstant) {
370+
SmallVectorImpl<unsigned> &IDs) {
376371
unsigned Index = 0;
377-
return emitSpecConstantRecursiveImpl(Ty, InsertBefore, IDs, IsNewSpecConstant,
378-
Index);
372+
return emitSpecConstantRecursiveImpl(Ty, InsertBefore, IDs, Index);
379373
}
380374

381375
} // namespace
@@ -444,7 +438,7 @@ PreservedAnalyses SpecConstantsPass::run(Module &M,
444438
// 3. Transform to spirv intrinsic _Z*__spirv_SpecConstant* or
445439
// _Z*__spirv_SpecConstantComposite
446440
auto *SPIRVCall =
447-
emitSpecConstantRecursive(SCTy, CI, IDs, IsNewSpecConstant);
441+
emitSpecConstantRecursive(SCTy, CI, IDs);
448442
if (IsNewSpecConstant) {
449443
// emitSpecConstantRecursive might emit more than one spec constant
450444
// (because of composite types) and therefore, we need to ajudst

sycl/test/on-device/spec_const/multiple-usages-of-composite.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// RUN: %GPU_RUN_PLACEHOLDER %t.out %GPU_CHECK_PLACEHOLDER
77
//
88
// The test checks that multiple usages of the same specialization constant
9-
// works correctly with: toolchain processes them correctly and runtime can
9+
// works correctly: toolchain processes them correctly and runtime can
1010
// correctly execute the program.
1111
//
1212
// CHECK: --------> 1
@@ -62,7 +62,8 @@ template <typename T> class kernel_driver_t {
6262

6363
template class kernel_driver_t<float>;
6464

65-
// Uncomment this to trigger the bug.
65+
// The line below instantiates the second use of the spec constant named
66+
// `sc_kernel_t`, which used to corrupt the spec constant content
6667
template class kernel_driver_t<int>;
6768
} // namespace test
6869

0 commit comments

Comments
 (0)