mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-17 06:47:17 +00:00
Don't try to reanalyse suboptimal, non-local modules when using
Estimated hours taken: 10 Branches: main compiler/make.program_target.m: Don't try to reanalyse suboptimal, non-local modules when using `--intermodule-analysis'. compiler/exception_analysis.m: compiler/trailing_analysis.m: compiler/unused_args.m: When looking up an analysis result, if the result is from a non-local module and is `suboptimal', just assume it is `optimal' since we can't make requests to or reanalyse the non-local module anyway. On the other hand, if we look up a result from a local module which doesn't yet exist, record the default (suboptimal) result that we are using into the module's analysis registry, so that when the module is reanalysed, if the answer pattern changes we will know that it changed and the modules which made use of the default result can be marked.
This commit is contained in:
@@ -1015,16 +1015,27 @@ search_analysis_status_2(ModuleInfo, PPId, Result, AnalysisStatus, CallerSCC,
|
||||
MaybeBestStatus = no,
|
||||
% If we do not have any information about the callee procedure then
|
||||
% assume that it throws an exception.
|
||||
top(Call) = exception_analysis_answer(Result),
|
||||
AnalysisStatus = suboptimal,
|
||||
top(Call) = Answer,
|
||||
Answer = exception_analysis_answer(Result),
|
||||
module_is_local(mmc, ModuleId, IsLocal, !IO),
|
||||
(
|
||||
MakeAnalysisRegistry = yes,
|
||||
record_request(analysis_name, ModuleId, FuncId, Call,
|
||||
!AnalysisInfo),
|
||||
record_dependencies(ModuleId, FuncId, Call, ModuleInfo, CallerSCC,
|
||||
!AnalysisInfo)
|
||||
IsLocal = yes,
|
||||
AnalysisStatus = suboptimal,
|
||||
(
|
||||
MakeAnalysisRegistry = yes,
|
||||
analysis.record_result(ModuleId, FuncId,
|
||||
Call, Answer, AnalysisStatus, !AnalysisInfo),
|
||||
analysis.record_request(analysis_name, ModuleId, FuncId, Call,
|
||||
!AnalysisInfo),
|
||||
record_dependencies(ModuleId, FuncId, Call,
|
||||
ModuleInfo, CallerSCC, !AnalysisInfo)
|
||||
;
|
||||
MakeAnalysisRegistry = no
|
||||
)
|
||||
;
|
||||
MakeAnalysisRegistry = no
|
||||
IsLocal = no,
|
||||
% We can't do any better anyway.
|
||||
AnalysisStatus = optimal
|
||||
)
|
||||
).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user