MemoryLifetimeVerifier: be more precise with indirect function arguments.

Optimizations can rely on alias analysis to know that an in-argument (or parts of it) is not actually read.
We have to do the same in the verifier: if alias analysis says that an in-argument is not read, there is no need that the memory location is initialized.

Fixes a false verifier error.
rdar://106806899
This commit is contained in:
Erik Eckstein
2023-05-02 20:45:07 +02:00
parent e6d6a682c4
commit 4b33b99ee2
14 changed files with 127 additions and 39 deletions

View File

@@ -38,6 +38,7 @@ class SILFunctionBuilder;
class SILProfiler;
class BasicBlockBitfield;
class NodeBitfield;
class SILPassManager;
namespace Lowering {
class TypeLowering;
@@ -1410,18 +1411,19 @@ public:
/// verify - Run the SIL verifier to make sure that the SILFunction follows
/// invariants.
void verify(bool SingleFunction = true,
void verify(SILPassManager *passManager = nullptr,
bool SingleFunction = true,
bool isCompleteOSSA = true,
bool checkLinearLifetime = true) const;
/// Run the SIL verifier without assuming OSSA lifetimes end at dead end
/// blocks.
void verifyIncompleteOSSA() const {
verify(/*SingleFunction=*/true, /*completeOSSALifetimes=*/false);
verify(/*passManager*/nullptr, /*SingleFunction=*/true, /*completeOSSALifetimes=*/false);
}
/// Verifies the lifetime of memory locations in the function.
void verifyMemoryLifetime();
void verifyMemoryLifetime(SILPassManager *passManager);
/// Run the SIL ownership verifier to check that all values with ownership
/// have a linear lifetime. Regular OSSA invariants are checked separately in