Skip to content

Commit

Permalink
Have tapir stackframe be looked at by GC
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Sep 27, 2023
1 parent cfcd42b commit 32b54ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/llvm-late-gc-lowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1740,8 +1740,12 @@ State LateLowerGCFrame::LocalScan(Function &F) {
}
} else if (auto *AI = dyn_cast<AllocaInst>(&I)) {
Type *ElT = AI->getAllocatedType();
if (AI->isStaticAlloca() && isa<PointerType>(ElT) && ElT->getPointerAddressSpace() == AddressSpace::Tracked) {
S.Allocas.push_back(AI);
if (AI->isStaticAlloca()) {
if (isa<PointerType>(ElT) && ElT->getPointerAddressSpace() == AddressSpace::Tracked) {
S.Allocas.push_back(AI);
} else if (isa<StructType>(ElT) && dyn_cast<StructType>(ElT)->hasName() && CountTrackedPointers(ElT).count > 0) {
S.Allocas.push_back(AI);
}
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,11 @@ static void buildVectorPipeline(FunctionPassManager &FPM, PassBuilder *PB, Optim
static void buildIntrinsicLoweringPipeline(ModulePassManager &MPM, PassBuilder *PB, OptimizationLevel O, const OptimizationOptions &options) JL_NOTSAFEPOINT {
MPM.addPass(BeforeIntrinsicLoweringMarkerPass());
if (options.lower_intrinsics) {
#ifdef USE_TAPIR
MPM.addPass(TapirToTargetPass());
MPM.addPass(AlwaysInlinerPass(
/*InsertLifetimeIntrinsics*/false));
#endif
//TODO barrier pass?
{
FunctionPassManager FPM;
Expand All @@ -525,11 +530,6 @@ static void buildIntrinsicLoweringPipeline(ModulePassManager &MPM, PassBuilder *
// Needed **before** LateLowerGCFrame on LLVM < 12
// due to bug in `CreateAlignmentAssumption`.
JULIA_PASS(MPM.addPass(RemoveNIPass()));
#ifdef USE_TAPIR
MPM.addPass(TapirToTargetPass());
MPM.addPass(AlwaysInlinerPass(
/*InsertLifetimeIntrinsics*/false));
#endif
{
FunctionPassManager FPM;
JULIA_PASS(FPM.addPass(LateLowerGCPass()));
Expand Down Expand Up @@ -715,7 +715,7 @@ PIC.addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
#ifdef USE_TAPIR
// TapirTargetID::Lambda
// TapirTargetID::Serial
TLII->setTapirTarget(TapirTargetID::Serial);
TLII->setTapirTarget(TapirTargetID::Lambda);
// TLII->setTapirTargetOptions(
// std::make_unique<OpenCilkABIOptions>(CodeGenOpts.OpenCilkABIBitcodeFile));
// TLII->addTapirTargetLibraryFunctions();
Expand Down

0 comments on commit 32b54ed

Please sign in to comment.