mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[semantic-sil] Add ValueOwnershipKind field to SILPHIArgument and split Argument creation methods into one for SILPHIArgument and another for SILFunctionArgument.
We preserve the current behavior of assuming Any ownership always and use
default arguments to hide this change most of the time. There are asserts now in
the SILBasicBlock::{create,replace,insert}{PHI,Function}Argument to ensure that
the people can only create SILFunctionArguments in entry blocks and
SILPHIArguments in non-entry blocks. This will ensure that the code in tree
maintains the API distinction even if we are not using the full distinction in
between the two.
Once the verifier is finished being upstreamed, I am going to audit the
createPHIArgument cases for the proper ownership. This is b/c I will be able to
use the verifier to properly debug the code. At that point, I will also start
serializing/printing/parsing the ownershipkind of SILPHIArguments, but lets take
things one step at a time and move incrementally.
In the process, I also discovered a CSE bug. I am not sure how it ever worked.
Basically we replace an argument with a new argument type but return the uses of
the old argument to refer to the old argument instead of a new argument.
rdar://29671437
This commit is contained in:
@@ -1982,7 +1982,7 @@ public:
|
||||
// Clone the arguments.
|
||||
for (auto &Arg : StartBB->getArguments()) {
|
||||
SILValue MappedArg =
|
||||
ClonedStartBB->createArgument(getOpType(Arg->getType()));
|
||||
ClonedStartBB->createPHIArgument(getOpType(Arg->getType()));
|
||||
ValueMap.insert(std::make_pair(Arg, MappedArg));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user