[Beignet] [PATCH 2/2] Backend: Add a loop unswitch pass.

Xiuli Pan xiuli.pan at intel.com
Wed May 3 08:24:07 UTC 2017


From: Pan Xiuli <xiuli.pan at intel.com>

We found that in some loops there will be constant bool values that do
not change with loop, and LLVM can unswitch these bool value out of the
loop for less compare.

Signed-off-by: Pan Xiuli <xiuli.pan at intel.com>
---
 backend/src/llvm/llvm_to_gen.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp
index 37919ec..8f27f7b 100644
--- a/backend/src/llvm/llvm_to_gen.cpp
+++ b/backend/src/llvm/llvm_to_gen.cpp
@@ -370,6 +370,7 @@ namespace gbe
 #else
     passes.add(new DataLayout(DL));
 #endif
+    passes.add(createLoopUnswitchPass(true))
     // Print the code before further optimizations
     passes.add(createIntrinsicLoweringPass());
     passes.add(createStripAttributesPass());     // Strip unsupported attributes and calling conventions.
-- 
2.7.4



More information about the Beignet mailing list