diff options
author | Gil Pitney <gil.pitney@linaro.org> | 2015-01-28 03:23:13 +0000 |
---|---|---|
committer | Gil Pitney <gil.pitney@linaro.org> | 2015-01-28 03:23:13 +0000 |
commit | b79f5c9e92414cec2ab6c5e29ac4817427e793e2 (patch) | |
tree | 135073feda7497831f51e806c6cd2d5202c126eb | |
parent | 1fa92da24decc0eff0d6b6a7e92b25d9cc3b62be (diff) |
LLVM 3.6: Update handling of reqd_work_group_size kernel attribute
Previous casting to attempt to get the name of the node was erroneous,
and led to seg fault.
This has been fixed.
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
-rw-r--r-- | src/core/kernel.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/core/kernel.cpp b/src/core/kernel.cpp index 47e52db..0c1196c 100644 --- a/src/core/kernel.cpp +++ b/src/core/kernel.cpp @@ -460,7 +460,6 @@ boost::tuple<uint,uint,uint> Kernel::reqdWorkGroupSize(llvm::Module *module) con /*--------------------------------------------------------------------- * Each node has only one operand : a llvm::Function *--------------------------------------------------------------------*/ - // future DEBUG point, we're not sure this works. llvm::Value *value = llvm::dyn_cast<llvm::ValueAsMetadata>(node->getOperand(0))->getValue(); @@ -475,9 +474,8 @@ boost::tuple<uint,uint,uint> Kernel::reqdWorkGroupSize(llvm::Module *module) con if (node->getNumOperands() <= 1) return zeros; llvm::MDNode *meta = llvm::cast<llvm::MDNode>(node->getOperand(1)); - llvm::Value *value_tmp = dyn_cast<ValueAsMetadata>(meta->getOperand(0))->getValue(); - if (meta->getNumOperands() == 4 && - value_tmp->getName().str() == std::string("reqd_work_group_size")) + std::string meta_name = llvm::cast<MDString>(meta->getOperand(0))->getString().str(); + if ((meta->getNumOperands() == 4) && (meta_name == "reqd_work_group_size")) { // See comments in http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantInt.html auto x = llvm::mdconst::dyn_extract<ConstantInt>(meta->getOperand(1))->getLimitedValue(); |