[llvm] 9112ec6 - [mlgo] Use LLVM_HAVE_TFLITE instead of LLVM_HAVE_TF_API

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 11:11:30 PST 2022


Author: Kazu Hirata
Date: 2022-12-15T11:11:24-08:00
New Revision: 9112ec6ad0593b067762ae24a036d207f689c78a

URL: https://github.com/llvm/llvm-project/commit/9112ec6ad0593b067762ae24a036d207f689c78a
DIFF: https://github.com/llvm/llvm-project/commit/9112ec6ad0593b067762ae24a036d207f689c78a.diff

LOG: [mlgo] Use LLVM_HAVE_TFLITE instead of LLVM_HAVE_TF_API

This patch replaces uses of LLVM_HAVE_TF_API with LLVM_HAVE_TFLITE in
a couple of CMakeLists.txt.

Now that 842b0d0fe2dd142305a9461e50cdce9aff7f86bc has landed,
we now have:

  LLVM_HAVE_TF_API is defined if and only if LLVM_HAVE_TFLITE
  evaluates to true

in the CMake variable world (assuming that you do not set
LLVM_HAVE_TF_API on the cmake invocation).

FWIW, the story is a little different in the C++ macro world, where:

  LLVM_HAVE_TF_API is defined if and only if LLVM_HAVE_TFLITE is
  defined

This is why edc83a15b45e6b91fce3f35622a6b0a6d34e5211 consisted only of
mechanical replacements.

Differential Revision: https://reviews.llvm.org/D140061

Added: 
    

Modified: 
    llvm/lib/Analysis/CMakeLists.txt
    llvm/unittests/Analysis/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/CMakeLists.txt b/llvm/lib/Analysis/CMakeLists.txt
index d50b990abd5b0..3b6018aacf714 100644
--- a/llvm/lib/Analysis/CMakeLists.txt
+++ b/llvm/lib/Analysis/CMakeLists.txt
@@ -1,4 +1,4 @@
-if (DEFINED LLVM_HAVE_TF_AOT OR DEFINED LLVM_HAVE_TF_API)
+if (DEFINED LLVM_HAVE_TF_AOT OR LLVM_HAVE_TFLITE)
   include(TensorFlowCompile)
   set(LLVM_INLINER_MODEL_PATH_DEFAULT "models/inliner-Oz")
 
@@ -17,18 +17,14 @@ if (DEFINED LLVM_HAVE_TF_AOT OR DEFINED LLVM_HAVE_TF_API)
     )
   endif()
 
-  if (DEFINED LLVM_HAVE_TF_API)
-    if (LLVM_HAVE_TFLITE)
-      build_proto(
-        tensorflow/core/protobuf/error_codes
-        tensorflow/core/example/feature
-        tensorflow/core/example/example)
-      list(APPEND MLLinkDeps 
-        tensorflow-lite::tensorflow-lite
-        protobuf::libprotobuf)
-    else()
-      list(APPEND MLLinkDeps ${tensorflow_c_api} ${tensorflow_fx})
-    endif()
+  if (LLVM_HAVE_TFLITE)
+    build_proto(
+      tensorflow/core/protobuf/error_codes
+      tensorflow/core/example/feature
+      tensorflow/core/example/example)
+    list(APPEND MLLinkDeps
+      tensorflow-lite::tensorflow-lite
+      protobuf::libprotobuf)
   endif()
 endif()
 

diff  --git a/llvm/unittests/Analysis/CMakeLists.txt b/llvm/unittests/Analysis/CMakeLists.txt
index a748949ad4c2f..d93f249962f8b 100644
--- a/llvm/unittests/Analysis/CMakeLists.txt
+++ b/llvm/unittests/Analysis/CMakeLists.txt
@@ -7,7 +7,7 @@ set(LLVM_LINK_COMPONENTS
   )
 
 set(MLGO_TESTS TFUtilsTest.cpp TrainingLoggerTest.cpp)
-if (DEFINED LLVM_HAVE_TF_API)
+if (LLVM_HAVE_TFLITE)
   LIST(APPEND EXTRA_TESTS ${MLGO_TESTS})
 else()
   LIST(APPEND LLVM_OPTIONAL_SOURCES ${MLGO_TESTS})


        


More information about the llvm-commits mailing list