File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -1458,7 +1458,33 @@ State LateLowerGCFrame::LocalScan(Function &F) {
1458
1458
S.ArrayAllocas [SRet] = tracked.count * cast<ConstantInt>(SRet->getArraySize ())->getZExtValue ();
1459
1459
}
1460
1460
else {
1461
- AllocaInst *SRet_gc = dyn_cast<AllocaInst>((CI->arg_begin ()[1 ])->stripInBoundsOffsets ());
1461
+ Value *arg1 = (CI->arg_begin ()[1 ])->stripInBoundsOffsets ();
1462
+ AllocaInst *SRet_gc = nullptr ;
1463
+ if (PHINode *Phi = dyn_cast<PHINode>(arg1)) {
1464
+ for (Value *V : Phi->incoming_values ()) {
1465
+ if (AllocaInst *Alloca = dyn_cast<AllocaInst>(V->stripInBoundsOffsets ())) {
1466
+ if (SRet_gc == nullptr ) {
1467
+ SRet_gc = Alloca;
1468
+ } else if (SRet_gc == Alloca) {
1469
+ continue ;
1470
+ } else {
1471
+ llvm_dump (Alloca);
1472
+ llvm_dump (SRet_gc);
1473
+ assert (false && " Allocas in Phi node should match" );
1474
+ }
1475
+ } else {
1476
+ llvm_dump (V->stripInBoundsOffsets ());
1477
+ assert (false && " Expected alloca" );
1478
+ }
1479
+ }
1480
+ } else {
1481
+ SRet_gc = dyn_cast<AllocaInst>(arg1);
1482
+ }
1483
+ if (!SRet_gc) {
1484
+ llvm_dump (CI);
1485
+ llvm_dump (arg1);
1486
+ assert (false && " Expected alloca" );
1487
+ }
1462
1488
Type *ElT = SRet_gc->getAllocatedType ();
1463
1489
if (!(SRet_gc->isStaticAlloca () && isa<PointerType>(ElT) && ElT->getPointerAddressSpace () == AddressSpace::Tracked)) {
1464
1490
S.ArrayAllocas [SRet_gc] = tracked.count * cast<ConstantInt>(SRet_gc->getArraySize ())->getZExtValue ();
You can’t perform that action at this time.
0 commit comments