diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000000..740eb9cd5b06 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "llvm/lib/rv"] + path = llvm/lib/rv + url = https://github.com/sx-aurora-dev/rv.git + branch = hpce/develop diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index a5ee7abc655b..7d1cdcef652b 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -3300,6 +3300,9 @@ bool CodeGenFunction::EmitOMPWorksharingLoop( } else if (const auto *C = S.getSingleClause()) { if (C->getKind() == OMPC_ORDER_concurrent) CGF.LoopStack.setParallel(/*Enable=*/true); + } else { + // TODO: This may not be legal + CGF.LoopStack.setParallel(/*Enable=*/true); } }, [IVSize, IVSigned, Ordered, IL, LB, UB, ST, StaticChunkedOne, Chunk, diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index 91410659a0be..0ceac08c04cf 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -1033,6 +1033,8 @@ if(LLVM_TARGET_IS_CROSSCOMPILE_HOST) # (this is a variable that CrossCompile sets on recursive invocations) endif() +include_directories("${CMAKE_SOURCE_DIR}/lib/rv/include") + if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) # special hack for Solaris to handle crazy system sys/regset.h include_directories("${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/Solaris") diff --git a/llvm/include/llvm/IR/VPBuilder.h b/llvm/include/llvm/IR/VPBuilder.h index 6de1317f7934..98ede35b2a5a 100644 --- a/llvm/include/llvm/IR/VPBuilder.h +++ b/llvm/include/llvm/IR/VPBuilder.h @@ -69,6 +69,8 @@ class VPBuilder { Value& CreateContiguousLoad(Type *ReturnTy, Value & Pointer, MaybeAlign Alignment); Value& CreateScatter(Value & Val, Value & PointerVec, MaybeAlign Alignment); Value& CreateGather(Type *ReturnTy, Value & PointerVec, MaybeAlign Alignment); + Value &createSelect(Value &OnTrue, Value &OnFalse, Value &Mask, Value &Pivot, + Twine Name = ""); }; } // namespace llvm diff --git a/llvm/lib/CMakeLists.txt b/llvm/lib/CMakeLists.txt index 5ecdf5af956a..491517c670fa 100644 --- a/llvm/lib/CMakeLists.txt +++ b/llvm/lib/CMakeLists.txt @@ -38,6 +38,8 @@ add_subdirectory(Passes) add_subdirectory(TextAPI) add_subdirectory(ToolDrivers) add_subdirectory(XRay) +add_subdirectory(rv) + if (LLVM_INCLUDE_TESTS) add_subdirectory(Testing) endif() diff --git a/llvm/lib/IR/VPBuilder.cpp b/llvm/lib/IR/VPBuilder.cpp index 728132fada9a..e8b7765e6d7d 100644 --- a/llvm/lib/IR/VPBuilder.cpp +++ b/llvm/lib/IR/VPBuilder.cpp @@ -209,4 +209,13 @@ Value *VPBuilder::CreateVectorShift(Value *SrcVal, Value *Amount, Twine Name) { Name); } +Value &VPBuilder::createSelect(Value &OnTrue, Value &OnFalse, Value &Mask, + Value &Pivot, Twine Name) { + auto D = VPIntrinsic::getDeclarationForParams( + &getModule(), Intrinsic::vp_select, OnTrue.getType(), + {&OnTrue, &OnFalse, &Mask, &Pivot}); + return *Builder.CreateCall( + D, {&OnTrue, &OnFalse, &Mask, &Pivot, &RequestEVL()}, Name); +} + } // namespace llvm diff --git a/llvm/lib/Passes/CMakeLists.txt b/llvm/lib/Passes/CMakeLists.txt index 703969f8b5f4..43b48a15d0e9 100644 --- a/llvm/lib/Passes/CMakeLists.txt +++ b/llvm/lib/Passes/CMakeLists.txt @@ -27,4 +27,5 @@ add_llvm_component_library(LLVMPasses TransformUtils Vectorize Instrumentation + RV ) diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 090477c3dffb..954723e79700 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -250,6 +250,8 @@ #include "llvm/Transforms/Vectorize/SLPVectorizer.h" #include "llvm/Transforms/Vectorize/VectorCombine.h" +#include "rv/registerPasses.h" + using namespace llvm; static const Regex DefaultAliasRegex( @@ -413,6 +415,7 @@ PassBuilder::PassBuilder(TargetMachine *TM, PipelineTuningOptions PTO, PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME); #include "PassRegistry.def" } + rv::addConfiguredRVPasses(*this); } void PassBuilder::registerModuleAnalyses(ModuleAnalysisManager &MAM) { diff --git a/llvm/lib/rv b/llvm/lib/rv new file mode 160000 index 000000000000..da1bb9e4e29f --- /dev/null +++ b/llvm/lib/rv @@ -0,0 +1 @@ +Subproject commit da1bb9e4e29f1fb00ecf8dc5153899b119e99463