summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>2019-11-04 16:11:12 +0100
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>2019-11-04 16:22:00 +0100
commitbf6744dfb244dbd2a4abe635f57e45218292743f (patch)
tree7583fdb2fa1cc8f3347fa9afd1c526cc60a4f9aa /llvm
parentb7b170c9b46ab4c0a10ecf1d9d5832e70ca992d5 (diff)
downloadbcm5719-llvm-bf6744dfb244dbd2a4abe635f57e45218292743f.tar.gz
bcm5719-llvm-bf6744dfb244dbd2a4abe635f57e45218292743f.zip
[SystemZ] Use LivePhysRegs instead of isCCLiveOut() in SystemZElimCompare.cpp
Review: Ulrich Weigand https://reviews.llvm.org/D68267
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/SystemZ/SystemZElimCompare.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZElimCompare.cpp b/llvm/lib/Target/SystemZ/SystemZElimCompare.cpp
index 946eb2ba7c7..90f664a7f79 100644
--- a/llvm/lib/Target/SystemZ/SystemZElimCompare.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZElimCompare.cpp
@@ -18,6 +18,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
@@ -103,14 +104,6 @@ char SystemZElimCompare::ID = 0;
} // end anonymous namespace
-// Return true if CC is live out of MBB.
-static bool isCCLiveOut(MachineBasicBlock &MBB) {
- for (auto SI = MBB.succ_begin(), SE = MBB.succ_end(); SI != SE; ++SI)
- if ((*SI)->isLiveIn(SystemZ::CC))
- return true;
- return false;
-}
-
// Returns true if MI is an instruction whose output equals the value in Reg.
static bool preservesValueOf(MachineInstr &MI, unsigned Reg) {
switch (MI.getOpcode()) {
@@ -595,7 +588,9 @@ bool SystemZElimCompare::processBlock(MachineBasicBlock &MBB) {
// Walk backwards through the block looking for comparisons, recording
// all CC users as we go. The subroutines can delete Compare and
// instructions before it.
- bool CompleteCCUsers = !isCCLiveOut(MBB);
+ LivePhysRegs LiveRegs(*TRI);
+ LiveRegs.addLiveOuts(MBB);
+ bool CompleteCCUsers = !LiveRegs.contains(SystemZ::CC);
SmallVector<MachineInstr *, 4> CCUsers;
MachineBasicBlock::iterator MBBI = MBB.end();
while (MBBI != MBB.begin()) {
OpenPOWER on IntegriCloud