@@ -578,50 +578,6 @@ convertIgnoredWrapper(omp::LoopWrapperInterface opInst,
578
578
});
579
579
}
580
580
581
- // / Populate a set of previously created llvm.alloca instructions that are only
582
- // / used inside of the given region but defined outside of it. Allocations of
583
- // / non-primitive types are skipped by this function.
584
- static void getSinkableAllocas (LLVM::ModuleTranslation &moduleTranslation,
585
- Region ®ion,
586
- SetVector<llvm::AllocaInst *> &allocasToSink) {
587
- Operation *op = region.getParentOp ();
588
-
589
- for (auto storeOp : region.getOps <LLVM::StoreOp>()) {
590
- Value storeAddr = storeOp.getAddr ();
591
- Operation *addrOp = storeAddr.getDefiningOp ();
592
-
593
- // The destination address is already defined in this region or it is not an
594
- // llvm.alloca operation, so skip it.
595
- if (!isa_and_present<LLVM::AllocaOp>(addrOp) || op->isAncestor (addrOp))
596
- continue ;
597
-
598
- // Get LLVM value to which the address is mapped. It has to be mapped to the
599
- // allocation instruction of a scalar type to be marked as sinkable by this
600
- // function.
601
- llvm::Value *llvmAddr = moduleTranslation.lookupValue (storeAddr);
602
- if (!isa_and_present<llvm::AllocaInst>(llvmAddr))
603
- continue ;
604
-
605
- auto *llvmAlloca = cast<llvm::AllocaInst>(llvmAddr);
606
- if (llvmAlloca->getAllocatedType ()->getPrimitiveSizeInBits () == 0 )
607
- continue ;
608
-
609
- // Check that the address is only used inside of the region.
610
- bool addressUsedOnlyInternally = true ;
611
- for (auto &addrUse : storeAddr.getUses ()) {
612
- if (!op->isAncestor (addrUse.getOwner ())) {
613
- addressUsedOnlyInternally = false ;
614
- break ;
615
- }
616
- }
617
-
618
- if (!addressUsedOnlyInternally)
619
- continue ;
620
-
621
- allocasToSink.insert (llvmAlloca);
622
- }
623
- }
624
-
625
581
// / Converts an OpenMP 'masked' operation into LLVM IR using OpenMPIRBuilder.
626
582
static LogicalResult
627
583
convertOmpMasked (Operation &opInst, llvm::IRBuilderBase &builder,
@@ -2452,9 +2408,6 @@ convertOmpLoopNest(Operation &opInst, llvm::IRBuilderBase &builder,
2452
2408
// Set up the source location value for OpenMP runtime.
2453
2409
llvm::OpenMPIRBuilder::LocationDescription ompLoc (builder);
2454
2410
2455
- SetVector<llvm::AllocaInst *> allocasToSink;
2456
- getSinkableAllocas (moduleTranslation, loopOp.getRegion (), allocasToSink);
2457
-
2458
2411
// Generator of the canonical loop body.
2459
2412
SmallVector<llvm::CanonicalLoopInfo *> loopInfos;
2460
2413
SmallVector<llvm::OpenMPIRBuilder::InsertPointTy> bodyInsertPoints;
@@ -2472,25 +2425,14 @@ convertOmpLoopNest(Operation &opInst, llvm::IRBuilderBase &builder,
2472
2425
if (loopInfos.size () != loopOp.getNumLoops () - 1 )
2473
2426
return llvm::Error::success ();
2474
2427
2475
- // Convert the body of the loop, adding lifetime markers to allocations that
2476
- // can be sunk into the new block.
2428
+ // Convert the body of the loop.
2477
2429
builder.restoreIP (ip);
2478
- for (auto *alloca : allocasToSink) {
2479
- unsigned size = alloca->getAllocatedType ()->getPrimitiveSizeInBits () / 8 ;
2480
- builder.CreateLifetimeStart (alloca, builder.getInt64 (size));
2481
- }
2482
-
2483
2430
llvm::Expected<llvm::BasicBlock *> regionBlock = convertOmpOpRegions (
2484
2431
loopOp.getRegion (), " omp.loop_nest.region" , builder, moduleTranslation);
2485
2432
if (!regionBlock)
2486
2433
return regionBlock.takeError ();
2487
2434
2488
2435
builder.SetInsertPoint (*regionBlock, (*regionBlock)->begin ());
2489
-
2490
- for (auto *alloca : allocasToSink) {
2491
- unsigned size = alloca->getAllocatedType ()->getPrimitiveSizeInBits () / 8 ;
2492
- builder.CreateLifetimeEnd (alloca, builder.getInt64 (size));
2493
- }
2494
2436
return llvm::Error::success ();
2495
2437
};
2496
2438
0 commit comments