[Beignet] [PATCH] Fix getting bitwidth of PointerType of LLVM.

yan.wang at linux.intel.com yan.wang at linux.intel.com
Fri Nov 18 07:43:46 UTC 2016


From: Yan Wang <yan.wang at linux.intel.com>

PointerType could not be forced to IntegerTyoe for getting bitwidth.
With Rong's comments, use getTypeBitSize() instead of
Type::getIntegerBitWidth().
---
 backend/src/llvm/llvm_gen_backend.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index 397c721..d6b0665 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -1366,7 +1366,7 @@ namespace gbe
           }
           Builder.SetInsertPoint(cast<Instruction>(theUser));
 
-          Type *ptyTy = IntegerType::get(ptr->getContext(), ptr->getType()->getIntegerBitWidth());
+          Type *ptyTy = IntegerType::get(ptr->getContext(), getTypeBitSize(unit, ptr->getType()));
           Value *v1 = Builder.CreatePtrToInt(pointerOp, ptyTy);
 
           Value *v2 = Builder.CreatePtrToInt(getSinglePointerOrigin(pointerOp), ptyTy);
-- 
2.7.4



More information about the Beignet mailing list