[Beignet] [PATCH] Defer the scalarize to the last pass before the Gen pass.

Zhigang Gong zhigang.gong at intel.com
Sun Dec 15 19:01:22 PST 2013


I found that the previous pass, gvn pass,  may generate new vector instruction.
We just defer the scalarize pass to make sure the gen pass will not encounter
unsupported non scalar instructions.

Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 backend/src/llvm/llvm_to_gen.cpp |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp
index 111514f..ad07c5e 100644
--- a/backend/src/llvm/llvm_to_gen.cpp
+++ b/backend/src/llvm/llvm_to_gen.cpp
@@ -80,7 +80,6 @@ namespace gbe
     // Print the code before further optimizations
     if (OCL_OUTPUT_LLVM_BEFORE_EXTRA_PASS)
       passes.add(createPrintModulePass(&*o));
-    passes.add(createScalarizePass());        // Expand all vector ops
     passes.add(createScalarReplAggregatesPass()); // Break up allocas
     passes.add(createRemoveGEPPass(unit));
     passes.add(createConstantPropagationPass());
@@ -88,6 +87,7 @@ namespace gbe
     passes.add(createLowerSwitchPass());
     passes.add(createPromoteMemoryToRegisterPass());
     passes.add(createGVNPass());                  // Remove redundancies
+    passes.add(createScalarizePass());        // Expand all vector ops
     passes.add(createGenPass(unit));
 
     // Print the code extra optimization passes
-- 
1.7.9.5



More information about the Beignet mailing list