mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[sil] Use FullApplySite instead of ApplyInst in SILInstruction::getMemoryBehavior().
We were giving special handling to ApplyInst when we were attempting to use
getMemoryBehavior(). This commit changes the special handling to work on all
full apply sites instead of just AI. Additionally, we look through partial
applies and thin to thick functions.
I also added a dumper called BasicInstructionPropertyDumper that just dumps the
results of SILInstruction::get{Memory,Releasing}Behavior() for all instructions
in order to verify this behavior.
This commit is contained in:
@@ -167,7 +167,7 @@ static bool isPromotableAllocInst(SILInstruction *I) {
|
||||
// Check for array buffer allocation.
|
||||
auto *AI = dyn_cast<ApplyInst>(I);
|
||||
if (AI && AI->getNumArguments() == 3) {
|
||||
if (auto *Callee = AI->getCalleeFunction()) {
|
||||
if (auto *Callee = AI->getReferencedFunction()) {
|
||||
if (Callee->getName() == "swift_bufferAllocate")
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user