SimplifyCFG: fix try_apply -> apply transformation for indirect error results

Indirect error results must not be included in the final apply arguments which they are not present in the callee.
This commit is contained in:
Erik Eckstein
2023-11-21 20:43:55 +01:00
parent 699b165e4a
commit 3ba935605e
3 changed files with 68 additions and 4 deletions

View File

@@ -242,6 +242,12 @@ public:
return 0;
}
bool isArgumentIndexOfIndirectErrorResult(unsigned idx) {
unsigned indirectResults = getNumIndirectSILResults();
return idx >= indirectResults &&
idx < indirectResults + getNumIndirectSILErrorResults();
}
/// Are any SIL results passed as address-typed arguments?
bool hasIndirectSILResults() const { return getNumIndirectSILResults() != 0; }
bool hasIndirectSILErrorResults() const { return getNumIndirectSILErrorResults() != 0; }