diff options
author | Tim Murray <timmurray@google.com> | 2014-10-30 15:34:01 -0700 |
---|---|---|
committer | Tim Murray <timmurray@google.com> | 2014-10-30 15:37:48 -0700 |
commit | 4839c9acf4e935dab0b3de3fac0e315d00c3a369 (patch) | |
tree | 0b15e8418056383781f71d5971a597d69f9d87ae | |
parent | 38883df9fc8fc1c488d5b53828c6bd3dfe2ddbb8 (diff) | |
download | libbcc-lollipop-mr1-dev.tar.gz |
Disable step opt for 12-byte structs on 64-bit.android-5.1.1_r5android-5.1.1_r28android-5.1.1_r22android-5.1.1_r17android-5.1.1_r12lollipop-mr1-wfc-releaselollipop-mr1-dev
bug 17663411
Change-Id: I21c67f95704e8aeb63f72bd371b1b5a5cc6e569d
-rw-r--r-- | lib/Renderscript/RSForEachExpand.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/lib/Renderscript/RSForEachExpand.cpp b/lib/Renderscript/RSForEachExpand.cpp index 505971f..d273e67 100644 --- a/lib/Renderscript/RSForEachExpand.cpp +++ b/lib/Renderscript/RSForEachExpand.cpp @@ -120,6 +120,43 @@ private: return 0; } + bool isStepOptSupported(llvm::Type *AllocType) { + + llvm::PointerType *PT = llvm::dyn_cast<llvm::PointerType>(AllocType); + llvm::Type *VoidPtrTy = llvm::Type::getInt8PtrTy(*Context); + + if (mEnableStepOpt) { + return false; + } + + if (AllocType == VoidPtrTy) { + return false; + } + + if (!PT) { + return false; + } + + // remaining conditions are 64-bit only + if (VoidPtrTy->getPrimitiveSizeInBits() == 32) { + return true; + } + + // coerce suggests an upconverted struct type, which we can't support + if (AllocType->getStructName().find("coerce") != llvm::StringRef::npos) { + return false; + } + + // 2xi64 and i128 suggest an upconverted struct type, which are also unsupported + llvm::Type *V2xi64Ty = llvm::VectorType::get(llvm::Type::getInt64Ty(*Context), 2); + llvm::Type *Int128Ty = llvm::Type::getIntNTy(*Context, 128); + if (AllocType == V2xi64Ty || AllocType == Int128Ty) { + return false; + } + + return true; + } + // Get the actual value we should use to step through an allocation. // // Normally the value we use to step through an allocation is given to us by @@ -136,8 +173,7 @@ private: bccAssert(AllocType); bccAssert(OrigStep); llvm::PointerType *PT = llvm::dyn_cast<llvm::PointerType>(AllocType); - llvm::Type *VoidPtrTy = llvm::Type::getInt8PtrTy(*Context); - if (mEnableStepOpt && AllocType != VoidPtrTy && PT) { + if (isStepOptSupported(AllocType)) { llvm::Type *ET = PT->getElementType(); uint64_t ETSize = DL->getTypeAllocSize(ET); llvm::Type *Int32Ty = llvm::Type::getInt32Ty(*Context); |