File tree 1 file changed +16
-1
lines changed 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -450,6 +450,18 @@ class YkIRWriter {
450
450
451
451
void serialiseAllocaInst (AllocaInst *I, FuncLowerCtxt &FLCtxt, unsigned BBIdx,
452
452
unsigned &InstIdx) {
453
+ // We don't yet support:
454
+ // - the `inalloca` keyword.
455
+ // - non-zero address spaces.
456
+ // - dynamic alloca (because stackmaps can't handle them).
457
+ // - allocating an array with more than SIZE_MAX elements.
458
+ if ((I->isUsedWithInAlloca ()) || (I->getAddressSpace () != 0 ) ||
459
+ (!isa<Constant>(I->getArraySize ())) ||
460
+ cast<ConstantInt>(I->getArraySize ())->getValue ().ugt (SIZE_MAX)) {
461
+ serialiseUnimplementedInstruction (I, FLCtxt, BBIdx, InstIdx);
462
+ return ;
463
+ }
464
+
453
465
// opcode:
454
466
serialiseOpcode (OpCodeAlloca);
455
467
@@ -458,9 +470,12 @@ class YkIRWriter {
458
470
459
471
// number of objects to allocate
460
472
ConstantInt *CI = cast<ConstantInt>(I->getArraySize ());
461
- // XXX guard cast
473
+ static_assert ( sizeof ( size_t ) <= sizeof ( uint64_t ));
462
474
OutStreamer.emitSizeT (CI->getZExtValue ());
463
475
476
+ // align:
477
+ OutStreamer.emitInt64 (I->getAlign ().value ());
478
+
464
479
FLCtxt.updateVLMap (I, InstIdx);
465
480
InstIdx++;
466
481
}
You can’t perform that action at this time.
0 commit comments