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 d97f248 commit 8003563Copy full SHA for 8003563
src/llvm-alloc-opt.cpp
@@ -312,7 +312,10 @@ ssize_t Optimizer::getGCAllocSize(Instruction *I)
312
if (call->getCalledOperand() != pass.alloc_obj_func)
313
return -1;
314
assert(call->arg_size() == 3);
315
- size_t sz = (size_t)cast<ConstantInt>(call->getArgOperand(1))->getZExtValue();
+ auto CI = dyn_cast<ConstantInt>(call->getArgOperand(1));
316
+ if (!CI)
317
+ return -1;
318
+ size_t sz = (size_t)CI->getZExtValue();
319
if (sz < IntegerType::MAX_INT_BITS / 8 && sz < INT32_MAX)
320
return sz;
321
0 commit comments