Skip to content

Commit 35ee8d2

Browse files
authored
[SYCL][NFC] Move LowerWGScope pass to LLVM project (#1306)
LowerWGScope pass is an llvm pass that performs SYCL specific transformations in LLVM IR right after frontend. LLVM passes are supposed to be in llvm project and not in clang project. Add lit tests for SYCL specific CodeGen and LowerWGScope pass Signed-off-by: Artur Gainullin <[email protected]>
1 parent 3b6799a commit 35ee8d2

File tree

20 files changed

+149
-73
lines changed

20 files changed

+149
-73
lines changed

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "clang/CodeGen/BackendUtil.h"
10-
#include "SYCLLowerIR/LowerWGScope.h"
1110
#include "clang/Basic/CodeGenOptions.h"
1211
#include "clang/Basic/Diagnostic.h"
1312
#include "clang/Basic/LangOptions.h"

clang/lib/CodeGen/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
add_subdirectory(SYCLLowerIR)
2-
31
set(LLVM_LINK_COMPONENTS
42
Analysis
53
BitReader
@@ -23,6 +21,7 @@ set(LLVM_LINK_COMPONENTS
2321
Remarks
2422
ScalarOpts
2523
Support
24+
SYCLLowerIR
2625
Target
2726
TransformUtils
2827
)
@@ -112,5 +111,4 @@ add_clang_library(clangCodeGen
112111
clangFrontend
113112
clangLex
114113
clangSerialization
115-
clangSYCLLowerIR
116114
)

clang/lib/CodeGen/CodeGenAction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "CodeGenModule.h"
1111
#include "CoverageMappingGen.h"
1212
#include "MacroPPCallbacks.h"
13-
#include "SYCLLowerIR/LowerWGScope.h"
1413
#include "clang/AST/ASTConsumer.h"
1514
#include "clang/AST/ASTContext.h"
1615
#include "clang/AST/DeclCXX.h"
@@ -39,6 +38,7 @@
3938
#include "llvm/IRReader/IRReader.h"
4039
#include "llvm/Linker/Linker.h"
4140
#include "llvm/Pass.h"
41+
#include "llvm/SYCLLowerIR/LowerWGScope.h"
4242
#include "llvm/Support/MemoryBuffer.h"
4343
#include "llvm/Support/SourceMgr.h"
4444
#include "llvm/Support/TimeProfiler.h"
@@ -335,7 +335,7 @@ namespace clang {
335335
if (LangOpts.SYCLIsDevice) {
336336
PrettyStackTraceString CrashInfo("Pre-linking SYCL passes");
337337
legacy::PassManager PreLinkingSyclPasses;
338-
PreLinkingSyclPasses.add(createSYCLLowerWGScopePass());
338+
PreLinkingSyclPasses.add(llvm::createSYCLLowerWGScopePass());
339339
PreLinkingSyclPasses.run(*getModule());
340340
}
341341

clang/lib/CodeGen/SYCLLowerIR/CMakeLists.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

clang/test/CodeGenSYCL/hier_par.cpp

Lines changed: 0 additions & 43 deletions
This file was deleted.

llvm/include/llvm/InitializePasses.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ void initializeStripNonDebugSymbolsPass(PassRegistry&);
404404
void initializeStripNonLineTableDebugInfoPass(PassRegistry&);
405405
void initializeStripSymbolsPass(PassRegistry&);
406406
void initializeStructurizeCFGPass(PassRegistry&);
407+
void initializeSYCLLowerWGScopeLegacyPassPass(PassRegistry &);
407408
void initializeTailCallElimPass(PassRegistry&);
408409
void initializeTailDuplicatePass(PassRegistry&);
409410
void initializeTargetLibraryInfoWrapperPassPass(PassRegistry&);

llvm/include/llvm/LinkAllPasses.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "llvm/CodeGen/Passes.h"
3838
#include "llvm/IR/Function.h"
3939
#include "llvm/IR/IRPrintingPasses.h"
40+
#include "llvm/SYCLLowerIR/LowerWGScope.h"
4041
#include "llvm/Support/Valgrind.h"
4142
#include "llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h"
4243
#include "llvm/Transforms/IPO.h"
@@ -199,6 +200,7 @@ namespace {
199200
(void) llvm::createMergeFunctionsPass();
200201
(void) llvm::createMergeICmpsLegacyPass();
201202
(void) llvm::createExpandMemCmpPass();
203+
(void)llvm::createSYCLLowerWGScopePass();
202204
std::string buf;
203205
llvm::raw_string_ostream os(buf);
204206
(void) llvm::createPrintModulePass(os);

clang/lib/CodeGen/SYCLLowerIR/LowerWGScope.h renamed to llvm/include/llvm/SYCLLowerIR/LowerWGScope.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class SYCLLowerWGScopePass : public PassInfoMixin<SYCLLowerWGScopePass> {
2525
};
2626

2727
FunctionPass *createSYCLLowerWGScopePass();
28-
void initializeSYCLLowerWGScopeLegacyPassPass(PassRegistry &);
2928

3029
} // namespace llvm
3130

llvm/lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ add_subdirectory(AsmParser)
2727
add_subdirectory(LineEditor)
2828
add_subdirectory(ProfileData)
2929
add_subdirectory(Passes)
30+
add_subdirectory(SYCLLowerIR)
3031
add_subdirectory(TextAPI)
3132
add_subdirectory(ToolDrivers)
3233
add_subdirectory(XRay)

llvm/lib/LLVMBuild.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ subdirectories =
4242
Passes
4343
ProfileData
4444
Support
45+
SYCLLowerIR
4546
TableGen
4647
TextAPI
4748
Target

0 commit comments

Comments
 (0)