[Beignet] [PATCH] GBE: skip current BB if it is not in a PN node's incoming BB list.

Zhigang Gong zhigang.gong at intel.com
Wed Apr 1 21:24:17 PDT 2015


This is a possible situation especially for a complex switch case
lowering.

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

diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index 0487bcb..4008704 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -1186,6 +1186,10 @@ namespace gbe
   void GenWriter::emitMovForPHI(BasicBlock *curr, BasicBlock *succ) {
     for (BasicBlock::iterator I = succ->begin(); isa<PHINode>(I); ++I) {
       PHINode *PN = cast<PHINode>(I);
+      // If current BB is not in the PN's incomming block list,
+      // just skip it here.
+      if (PN->getBasicBlockIndex(curr) < 0)
+        continue;
       Value *IV = PN->getIncomingValueForBlock(curr);
       Type *llvmType = PN->getType();
       const ir::Type type = getType(ctx, llvmType);
-- 
1.9.1



More information about the Beignet mailing list