git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129287
91177308-0d34-0410-b5e6-
96231b3b80d8
if (!FoundCSE) {
// Look for trivial copy coalescing opportunities.
if (PerformTrivialCoalescing(MI, MBB)) {
if (!FoundCSE) {
// Look for trivial copy coalescing opportunities.
if (PerformTrivialCoalescing(MI, MBB)) {
// After coalescing MI itself may become a copy.
if (MI->isCopyLike())
continue;
// After coalescing MI itself may become a copy.
if (MI->isCopyLike())
continue;
if (NewMI) {
Commuted = true;
FoundCSE = VNT.count(NewMI);
if (NewMI) {
Commuted = true;
FoundCSE = VNT.count(NewMI);
// New instruction. It doesn't need to be kept.
NewMI->eraseFromParent();
// New instruction. It doesn't need to be kept.
NewMI->eraseFromParent();
+ Changed = true;
+ } else if (!FoundCSE)
// MI was changed but it didn't help, commute it back!
(void)TII->commuteInstruction(MI);
}
// MI was changed but it didn't help, commute it back!
(void)TII->commuteInstruction(MI);
}
++NumPhysCSEs;
if (Commuted)
++NumCommutes;
++NumPhysCSEs;
if (Commuted)
++NumCommutes;
} else {
DEBUG(dbgs() << "*** Not profitable, avoid CSE!\n");
VNT.insert(MI, CurrVN++);
} else {
DEBUG(dbgs() << "*** Not profitable, avoid CSE!\n");
VNT.insert(MI, CurrVN++);
if (MI->isDebugValue())
continue;
if (MI->isDebugValue())
continue;
- if (PerformTrivialForwardCoalescing(MI, &MBB))
+ bool Joined = PerformTrivialForwardCoalescing(MI, &MBB);
+ if (Joined) {
+ MadeChange = true;
if (SinkInstruction(MI, SawStore))
++NumSunk, MadeChange = true;
if (SinkInstruction(MI, SawStore))
++NumSunk, MadeChange = true;