nir/validate: Only build in debug mode
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 7 Jan 2015 00:11:57 +0000 (16:11 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 15 Jan 2015 15:20:24 +0000 (07:20 -0800)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir.h
src/glsl/nir/nir_validate.c

index 201304b2f106242deb752e2dbe1b46b7c70d0db9..1daf53fa44c6b0827c84aad2e73adbadc3571dd7 100644 (file)
@@ -1437,7 +1437,11 @@ void nir_index_blocks(nir_function_impl *impl);
 
 void nir_print_shader(nir_shader *shader, FILE *fp);
 
+#ifdef DEBUG
 void nir_validate_shader(nir_shader *shader);
+#else
+static inline void nir_validate_shader(nir_shader *shader) { }
+#endif /* DEBUG */
 
 void nir_calc_dominance_impl(nir_function_impl *impl);
 void nir_calc_dominance(nir_shader *shader);
index 240da02a715f1f8081feaa3e31a266448af7043b..d2ce021196ea2e565d242fd993b7c4f22fe65070 100644 (file)
  * This file checks for invalid IR indicating a bug somewhere in the compiler.
  */
 
+/* Since this file is just a pile of asserts, don't bother compiling it if
+ * we're not building a debug build.
+ */
+#ifdef DEBUG
+
 /*
  * Per-register validation state.
  */
@@ -882,3 +887,5 @@ nir_validate_shader(nir_shader *shader)
 
    destroy_validate_state(&state);
 }
+
+#endif /* NDEBUG */