Skip to content

Commit 6bac8ea

Browse files
author
git apple-llvm automerger
committed
Merge commit 'bf6744dfb244' from llvm.org/master into apple/master
2 parents 33d22c7 + bf6744d commit 6bac8ea

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

llvm/lib/Target/SystemZ/SystemZElimCompare.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "llvm/ADT/SmallVector.h"
1919
#include "llvm/ADT/Statistic.h"
2020
#include "llvm/ADT/StringRef.h"
21+
#include "llvm/CodeGen/LivePhysRegs.h"
2122
#include "llvm/CodeGen/MachineBasicBlock.h"
2223
#include "llvm/CodeGen/MachineFunction.h"
2324
#include "llvm/CodeGen/MachineFunctionPass.h"
@@ -103,14 +104,6 @@ char SystemZElimCompare::ID = 0;
103104

104105
} // end anonymous namespace
105106

106-
// Return true if CC is live out of MBB.
107-
static bool isCCLiveOut(MachineBasicBlock &MBB) {
108-
for (auto SI = MBB.succ_begin(), SE = MBB.succ_end(); SI != SE; ++SI)
109-
if ((*SI)->isLiveIn(SystemZ::CC))
110-
return true;
111-
return false;
112-
}
113-
114107
// Returns true if MI is an instruction whose output equals the value in Reg.
115108
static bool preservesValueOf(MachineInstr &MI, unsigned Reg) {
116109
switch (MI.getOpcode()) {
@@ -595,7 +588,9 @@ bool SystemZElimCompare::processBlock(MachineBasicBlock &MBB) {
595588
// Walk backwards through the block looking for comparisons, recording
596589
// all CC users as we go. The subroutines can delete Compare and
597590
// instructions before it.
598-
bool CompleteCCUsers = !isCCLiveOut(MBB);
591+
LivePhysRegs LiveRegs(*TRI);
592+
LiveRegs.addLiveOuts(MBB);
593+
bool CompleteCCUsers = !LiveRegs.contains(SystemZ::CC);
599594
SmallVector<MachineInstr *, 4> CCUsers;
600595
MachineBasicBlock::iterator MBBI = MBB.end();
601596
while (MBBI != MBB.begin()) {

0 commit comments

Comments
 (0)