@@ -578,50 +578,6 @@ convertIgnoredWrapper(omp::LoopWrapperInterface opInst,
578578 });
579579}
580580
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-
625581// / Converts an OpenMP 'masked' operation into LLVM IR using OpenMPIRBuilder.
626582static LogicalResult
627583convertOmpMasked (Operation &opInst, llvm::IRBuilderBase &builder,
@@ -2453,9 +2409,6 @@ convertOmpLoopNest(Operation &opInst, llvm::IRBuilderBase &builder,
24532409 // Set up the source location value for OpenMP runtime.
24542410 llvm::OpenMPIRBuilder::LocationDescription ompLoc (builder);
24552411
2456- SetVector<llvm::AllocaInst *> allocasToSink;
2457- getSinkableAllocas (moduleTranslation, loopOp.getRegion (), allocasToSink);
2458-
24592412 // Generator of the canonical loop body.
24602413 SmallVector<llvm::CanonicalLoopInfo *> loopInfos;
24612414 SmallVector<llvm::OpenMPIRBuilder::InsertPointTy> bodyInsertPoints;
@@ -2473,25 +2426,14 @@ convertOmpLoopNest(Operation &opInst, llvm::IRBuilderBase &builder,
24732426 if (loopInfos.size () != loopOp.getNumLoops () - 1 )
24742427 return llvm::Error::success ();
24752428
2476- // Convert the body of the loop, adding lifetime markers to allocations that
2477- // can be sunk into the new block.
2429+ // Convert the body of the loop.
24782430 builder.restoreIP (ip);
2479- for (auto *alloca : allocasToSink) {
2480- unsigned size = alloca->getAllocatedType ()->getPrimitiveSizeInBits () / 8 ;
2481- builder.CreateLifetimeStart (alloca, builder.getInt64 (size));
2482- }
2483-
24842431 llvm::Expected<llvm::BasicBlock *> regionBlock = convertOmpOpRegions (
24852432 loopOp.getRegion (), " omp.loop_nest.region" , builder, moduleTranslation);
24862433 if (!regionBlock)
24872434 return regionBlock.takeError ();
24882435
24892436 builder.SetInsertPoint (*regionBlock, (*regionBlock)->begin ());
2490-
2491- for (auto *alloca : allocasToSink) {
2492- unsigned size = alloca->getAllocatedType ()->getPrimitiveSizeInBits () / 8 ;
2493- builder.CreateLifetimeEnd (alloca, builder.getInt64 (size));
2494- }
24952437 return llvm::Error::success ();
24962438 };
24972439
0 commit comments