Skip to content

Commit b8c73d3

Browse files
authored
ModRefSummarizer: Add allowlist for blocking all simple allocas from the extern set (#1935)
1 parent 9dbdfba commit b8c73d3

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎jlm/llvm/opt/alias-analyses/RegionAwareModRefSummarizer.cpp‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ static const bool ENABLE_FUNCTION_SIMPLE_ALLOCA_ALLOWLIST =
7373
static const bool ENABLE_CALL_SIMPLE_ALLOCA_ALLOWLIST =
7474
!std::getenv("JLM_DISABLE_CALL_SIMPLE_ALLOCA_ALLOWLIST");
7575

76+
/**
77+
* When creating a ModRefSet representing memory effects in external functions,
78+
* simple allocas can always be excluded, since they by definition cannot be
79+
* passed via external functions or otherwise be accessible from external modules.
80+
*/
81+
static const bool ENABLE_EXTERN_SIMPLE_ALLOCA_ALLOWLIST =
82+
!std::getenv("JLM_DISABLE_EXTERN_SIMPLE_ALLOCA_ALLOWLIST");
83+
7684
/** \brief Region-aware mod/ref summarizer statistics
7785
*
7886
* The statistics collected when running the region-aware mod/ref summarizer.
@@ -919,6 +927,12 @@ RegionAwareModRefSummarizer::SummarizeModRefs(
919927

920928
removeSimpleAllocasAroundSetjmp();
921929

930+
if (ENABLE_EXTERN_SIMPLE_ALLOCA_ALLOWLIST)
931+
{
932+
// Use an empty allowlist, since all simple allocas should be blocked
933+
addModRefSetSimpleAllocaAllowlist(ModRefSummary_->getExternModRefSet(), {});
934+
}
935+
922936
statistics->StartAnnotationStatistics();
923937
// Go through and recursively annotate all functions, regions and nodes
924938
for (const auto & scc : Context_->SccFunctions)

0 commit comments

Comments
 (0)