[PATCH] D142405: [CMake] Replace list(FIND) by if(IN_LIST) where index isn't used

Chris Bieneman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 14:53:01 PST 2023


beanz added inline comments.


================
Comment at: llvm/cmake/modules/TableGen.cmake:45-54
+  if (LLVM_ENABLE_DAGISEL_COV AND "-gen-dag-isel" IN_LIST ARGN)
+    list(APPEND LLVM_TABLEGEN_FLAGS "-instrument-coverage")
   endif()
-  if (LLVM_ENABLE_GISEL_COV)
-    list(FIND ARGN "-gen-global-isel" idx)
-    if( NOT idx EQUAL -1 )
-      list(APPEND LLVM_TABLEGEN_FLAGS "-instrument-gisel-coverage")
-      list(APPEND LLVM_TABLEGEN_FLAGS "-gisel-coverage-file=${LLVM_GISEL_COV_PREFIX}all")
-    endif()
+  if (LLVM_ENABLE_GISEL_COV AND "-gen-global-isel" IN_LIST ARGN)
+    list(APPEND LLVM_TABLEGEN_FLAGS "-instrument-gisel-coverage")
+    list(APPEND LLVM_TABLEGEN_FLAGS "-gisel-coverage-file=${LLVM_GISEL_COV_PREFIX}all")
   endif()
----------------
aaronpuchert wrote:
> I hope we're not running into https://cmake.org/cmake/help/latest/command/macro.html#argument-caveats here.
You're inside a function here, so that should be fine...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142405/new/

https://reviews.llvm.org/D142405



More information about the llvm-commits mailing list