We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 187177d commit ce06aa6Copy full SHA for ce06aa6
src/llvm-alloc-opt.cpp
@@ -425,7 +425,10 @@ ssize_t Optimizer::getGCAllocSize(Instruction *I)
425
if (call->getCalledOperand() != pass.alloc_obj_func)
426
return -1;
427
assert(call->getNumArgOperands() == 3);
428
- size_t sz = (size_t)cast<ConstantInt>(call->getArgOperand(1))->getZExtValue();
+ auto CI = dyn_cast<ConstantInt>(call->getArgOperand(1));
429
+ if (!CI)
430
+ return -1;
431
+ size_t sz = (size_t)CI->getZExtValue();
432
if (sz < IntegerType::MAX_INT_BITS / 8 && sz < INT32_MAX)
433
return sz;
434
0 commit comments