Skip to content

Commit a8da38b

Browse files
committed
apply comments
Signed-off-by: Sidorov, Dmitry <[email protected]>
1 parent 1b344a1 commit a8da38b

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

llvm/lib/SYCLLowerIR/CleanupSYCLMetadata.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@ void cleanupSYCLCompilerModuleMetadata(const Module &M, llvm::StringRef MD) {
3333
Node->eraseFromParent();
3434
}
3535

36-
void cleanupSYCLCompilerFunctionMetadata(Function &F,
37-
llvm::StringRef MD) {
38-
MDNode *Node = F.getMetadata(MD);
39-
if (!Node)
40-
return;
41-
F.setMetadata(MD, nullptr);
42-
}
43-
4436
// GV is supposed to be either llvm.compiler.used or llvm.used.
4537
SmallVector<Constant *>
4638
eraseGlobalVariableAndReturnOperands(GlobalVariable *GV) {
@@ -74,10 +66,12 @@ PreservedAnalyses CleanupSYCLMetadataPass::run(Module &M,
7466
for (const auto &MD : ModuleMDToRemove)
7567
cleanupSYCLCompilerModuleMetadata(M, MD);
7668

69+
// Cleanup no longer needed function metadata.
7770
SmallVector<StringRef, 1> FunctionMDToRemove = {"srcloc"};
7871
for (auto &F : M) {
7972
for (const auto &MD : FunctionMDToRemove)
80-
cleanupSYCLCompilerFunctionMetadata(F, MD);
73+
if (F.getMetadata(MD))
74+
F.setMetadata(MD, nullptr);
8175
}
8276

8377
return PreservedAnalyses::all();

llvm/test/SYCLLowerIR/CleanupSYCLCompilerInternalMetadata/sycl-function-metadata.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; RUN: opt -passes=cleanup-sycl-metadata -S < %s | FileCheck %s
22
;
3-
; Test checks that the pass is able to cleanup sycl_declared_aspects and srcloc
3+
; Test checks that the pass is able to cleanup srcloc metadata
44
; function metadata
55

66
; CHECK-NOT: srcloc

0 commit comments

Comments
 (0)