Commit Graph

3 Commits

Author SHA1 Message Date
Slava Pestov
06b1aee360 Evaluator: Cache circular evaluation to avoid redundant diagnostics
Previously, if a request R evaluated itself N times, we would emit N
"circular reference" diagnostics. These add no value, so instead let's
cache the user-provided default value on the first circular evaluation.

This changes things slightly so that instead of returning an
llvm::Expected<Request::OutputType>, various evaluator methods take
a callback which can produce the default value.

The existing evaluateOrDefault() interface is unchanged, and a new
evaluateOrFatal() entry point replaces
llvm::cantFail(ctx.evaluator(...)).

Direct callers of the evaluator's operator() were updated to pass in
the callback. The benefit of the callback over evaluateOrDefault() is
that if the default value is expensive to constuct, like a dummy
generic signature, we will only construct it in the case where a
cycle actually happened, otherwise we just delete the callback.

(cherry picked from commit b8fcf1c709efa6cd28e1217bd0efe876f7c0d2b7)
2024-02-09 16:02:24 -08:00
Hamish Knight
a99f8e9d9c Introduce LoweredSILRequest
Add a request that produces lowered SIL for a file
or module and use it in IRGenRequest if no
SILModule is provided.
2020-07-28 10:37:37 -07:00
Michael Gottesman
15da505b2e [passmanager] Move SILOptimizerRequests.cpp into ./lib/SILOptimizer/PassManager/*
I am doing this move for two reasons:

1. This file only works directly with parts of the PassManager.
2. In the SILOptimizer, we do not have files in the top level of the file tree
and instead group them in one of the subject subfolders.
2020-03-22 16:22:40 -07:00