AccessUtils: support computing "constant" access paths

Add `Value.constantAccessPath`. It is like `accessPath`, but ensures that the projectionPath only contains "constant" elements.
This means: if the access contains an `index_addr` projection with a non-constant index, the `projectionPath` does _not_ contain the `index_addr`.
Instead, the `base` is an `AccessBase.index` which refers to the `index_addr`.
This commit is contained in:
Erik Eckstein
2024-10-25 13:59:03 +02:00
parent af036feb50
commit f0633d5638
8 changed files with 152 additions and 24 deletions

View File

@@ -467,7 +467,7 @@ private extension AccessBase {
return .decidedInCaller(arg)
case .yield, .pointer:
return .unknown
case .unidentified:
case .index, .unidentified:
// In the rare case of an unidentified access, just ignore it.
// This should not happen in regular SIL, anyway.
return .no