mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
LoopRotate: Fix avoiding copy_value hoisted to the pre-header
copy_value is marked as having no side effects. Teach LoopRotate to avoid moving it to the pre header and instead duplicate it while rotating the loop.
This commit is contained in:
@@ -116,6 +116,7 @@ canDuplicateOrMoveToPreheader(SILLoop *loop, SILBasicBlock *preheader,
|
||||
if (!inst->mayHaveSideEffects() && !inst->mayReadFromMemory() &&
|
||||
!isa<TermInst>(inst) &&
|
||||
!isa<AllocationInst>(inst) && /* not marked mayhavesideeffects */
|
||||
!isa<CopyValueInst>(inst) &&
|
||||
hasLoopInvariantOperands(inst, loop, invariants)) {
|
||||
moves.push_back(inst);
|
||||
invariants.insert(inst);
|
||||
|
||||
Reference in New Issue
Block a user