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 83a3ab6 commit de49fdeCopy full SHA for de49fde
src/llvm-alloc-opt.cpp
@@ -436,7 +436,10 @@ ssize_t Optimizer::getGCAllocSize(Instruction *I)
436
if (call->getCalledValue() != pass.alloc_obj)
437
return -1;
438
assert(call->getNumArgOperands() == 3);
439
- size_t sz = (size_t)cast<ConstantInt>(call->getArgOperand(1))->getZExtValue();
+ auto CI = dyn_cast<ConstantInt>(call->getArgOperand(1));
440
+ if (!CI)
441
+ return -1;
442
+ size_t sz = (size_t)CI->getZExtValue();
443
if (sz < IntegerType::MAX_INT_BITS / 8 && sz < INT32_MAX)
444
return sz;
445
0 commit comments