mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
In SILInstruction::isTriviallyDuplicatable(): - Make deallocating instructions trivially duplicatable. They are by any useful definition--duplicating an instruction does not imply reordering it. Tail duplication was already treating deallocations as duplicatable, but doing it inconsistently. Sometimes it checks isTriviallyDuplicatable, and sometimes it doesn't, which appears to have been an accident. Disallowing duplication of deallocations will cause severe performance regressions. Instead, consistently allow them to be duplicated, making tail duplication more powerful, which could expose other bugs. - Do not duplicate on-stack AllocRefInst (without special consideration). This is a correctness fix that apparently was never exposed. Fix SILLoop::canDuplicate(): - Handle isDeallocatingStack. It's not clear how we were avoiding an assertion before when a stack allocatable reference was confined to a loop--probably just by luck. - Handle begin/end_access inside a loop. This is extremely important and probably prevented many loop optimizations from working with exclusivity. Update LoopRotate canDuplicateOrMoveToPreheader(). This is NFC.
17 KiB
17 KiB