1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[OpenMP][FIX] remove unused variable and long if-else chain

MSVC throws an error if you use "too many" if-else in a row:
  `Frontend/OpenMP/OMPKinds.def(570): fatal error C1061: compiler limit:
    blocks nested too deeply`
We work around it now...
This commit is contained in:
Johannes Doerfert 2020-07-11 02:36:07 -05:00
parent c61125c80f
commit 702a5efb08

View File

@ -1397,9 +1397,17 @@ void OpenMPInModule::identifyKernels(Module &M) {
bool llvm::omp::containsOpenMP(Module &M, OpenMPInModule &OMPInModule) { bool llvm::omp::containsOpenMP(Module &M, OpenMPInModule &OMPInModule) {
if (OMPInModule.isKnown()) if (OMPInModule.isKnown())
return OMPInModule; return OMPInModule;
// MSVC doesn't like long if-else chains for some reason and instead just
// issues an error. Work around it..
do {
#define OMP_RTL(_Enum, _Name, ...) \ #define OMP_RTL(_Enum, _Name, ...) \
else if (M.getFunction(_Name)) OMPInModule = true; if (M.getFunction(_Name)) { \
OMPInModule = true; \
break; \
}
#include "llvm/Frontend/OpenMP/OMPKinds.def" #include "llvm/Frontend/OpenMP/OMPKinds.def"
} while (false);
// Identify kernels once. TODO: We should split the OMPInformationCache into a // Identify kernels once. TODO: We should split the OMPInformationCache into a
// module and an SCC part. The kernel information, among other things, could // module and an SCC part. The kernel information, among other things, could