Mesa (lp-binning): llvmpipe: added debug option to disable LLVM optimization passes

Brian Paul brianp at kemper.freedesktop.org
Thu Jan 28 00:17:09 UTC 2010


Module: Mesa
Branch: lp-binning
Commit: 36a0819ff4ede1af91dcf909106cf20659856384
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=36a0819ff4ede1af91dcf909106cf20659856384

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jan 27 17:16:42 2010 -0700

llvmpipe: added debug option to disable LLVM optimization passes

---

 src/gallium/drivers/llvmpipe/lp_debug.h  |    1 +
 src/gallium/drivers/llvmpipe/lp_jit.c    |   30 +++++++++++++++++-------------
 src/gallium/drivers/llvmpipe/lp_screen.c |    1 +
 3 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_debug.h b/src/gallium/drivers/llvmpipe/lp_debug.h
index 7e04bd4..ee81814 100644
--- a/src/gallium/drivers/llvmpipe/lp_debug.h
+++ b/src/gallium/drivers/llvmpipe/lp_debug.h
@@ -48,6 +48,7 @@ st_print_current(void);
 #define DEBUG_SHOW_TILES    0x200
 #define DEBUG_SHOW_SUBTILES 0x400
 #define DEBUG_COUNTERS      0x800
+#define DEBUG_NO_LLVM_OPT  0x1000
 
 
 #ifdef DEBUG
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c
index 429cb97..9fad703 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.c
+++ b/src/gallium/drivers/llvmpipe/lp_jit.c
@@ -37,6 +37,7 @@
 
 #include "util/u_memory.h"
 #include "util/u_cpu_detect.h"
+#include "lp_debug.h"
 #include "lp_screen.h"
 #include "lp_bld_intr.h"
 #include "lp_bld_misc.h"
@@ -165,20 +166,23 @@ lp_jit_screen_init(struct llvmpipe_screen *screen)
 
    screen->pass = LLVMCreateFunctionPassManager(screen->provider);
    LLVMAddTargetData(screen->target, screen->pass);
-   /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
-    * but there are more on SVN. */
-   /* TODO: Add more passes */
-   LLVMAddConstantPropagationPass(screen->pass);
-   if(util_cpu_caps.has_sse4_1) {
-      /* FIXME: There is a bug in this pass, whereby the combination of fptosi
-       * and sitofp (necessary for trunc/floor/ceil/round implementation)
-       * somehow becomes invalid code.
-       */
-      LLVMAddInstructionCombiningPass(screen->pass);
+
+   if ((LP_DEBUG & DEBUG_NO_LLVM_OPT) == 0) {
+      /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
+       * but there are more on SVN. */
+      /* TODO: Add more passes */
+      LLVMAddConstantPropagationPass(screen->pass);
+      if(util_cpu_caps.has_sse4_1) {
+         /* FIXME: There is a bug in this pass, whereby the combination of fptosi
+          * and sitofp (necessary for trunc/floor/ceil/round implementation)
+          * somehow becomes invalid code.
+          */
+         LLVMAddInstructionCombiningPass(screen->pass);
+      }
+      LLVMAddPromoteMemoryToRegisterPass(screen->pass);
+      LLVMAddGVNPass(screen->pass);
+      LLVMAddCFGSimplificationPass(screen->pass);
    }
-   LLVMAddPromoteMemoryToRegisterPass(screen->pass);
-   LLVMAddGVNPass(screen->pass);
-   LLVMAddCFGSimplificationPass(screen->pass);
 
    lp_jit_init_globals(screen);
 }
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 9dd4ea7..a3adc81 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -55,6 +55,7 @@ static const struct debug_named_value lp_debug_flags[] = {
    { "show_tiles",    DEBUG_SHOW_TILES },
    { "show_subtiles", DEBUG_SHOW_SUBTILES },
    { "counters", DEBUG_COUNTERS },
+   { "nopt", DEBUG_NO_LLVM_OPT },
    {NULL, 0}
 };
 #endif




More information about the mesa-commit mailing list