Multiple calls to omp_get_wtime could be optimized out due to the function
is mistakenly marked as readnone. This patch fixes the issue, and also add the
support to run optimization on libomptarget tests.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
LG, though we might want to make sure we mark it as readonly and inaccessible_mem_only in the openmp-opt pass (see OMPKinds.td)
Comment Actions
@tianshilei1992
This broke the build:
FAILED: lib/Frontend/OpenMP/CMakeFiles/LLVMFrontendOpenMP.dir/OMPIRBuilder.cpp.o CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/sergei/llvm-project/cmake-build-release/lib/Frontend/OpenMP -I/home/sergei/llvm-project/llvm/lib/Frontend/OpenMP -I/home/sergei/llvm-project/cmake-build-release/include -I/home/sergei/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fPIC -fno-exceptions -fno-rtti -UNDEBUG -std=c++14 -MD -MT lib/Frontend/OpenMP/CMakeFiles/LLVMFrontendOpenMP.dir/OMPIRBuilder.cpp.o -MF lib/Frontend/OpenMP/CMakeFiles/LLVMFrontendOpenMP.dir/OMPIRBuilder.cpp.o.d -o lib/Frontend/OpenMP/CMakeFiles/LLVMFrontendOpenMP.dir/OMPIRBuilder.cpp.o -c /home/sergei/llvm-project/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp In file included from /home/sergei/llvm-project/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:354: /home/sergei/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def:684:1: error: use of undeclared identifier 'OMPRTL_omp_get_wtime' __OMP_RTL_ATTRS(omp_get_wtime, GetterAttrs, AttributeSet(), ParamAttrs()) ^ /home/sergei/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def:610:17: note: expanded from macro '__OMP_RTL_ATTRS' OMP_RTL_ATTRS(OMPRTL_##Name, FnAttrSet, RetAttrSet, ArgAttrSets) ^ <scratch space>:78:1: note: expanded from here OMPRTL_omp_get_wtime ^ 1 error generated.