2017-09-12 07:00:48 +08:00
|
|
|
//===- OptimizePHIs.cpp - Optimize machine instruction PHIs ---------------===//
|
2010-02-12 09:30:21 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2010-02-12 09:30:21 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This pass optimizes machine instruction PHIs to take advantage of
|
|
|
|
// opportunities created during DAG legalization.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-12-04 00:50:05 +08:00
|
|
|
#include "llvm/ADT/SmallPtrSet.h"
|
|
|
|
#include "llvm/ADT/Statistic.h"
|
2017-09-12 07:00:48 +08:00
|
|
|
#include "llvm/CodeGen/MachineBasicBlock.h"
|
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2010-02-12 09:30:21 +08:00
|
|
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
|
|
|
#include "llvm/CodeGen/MachineInstr.h"
|
2017-09-12 07:00:48 +08:00
|
|
|
#include "llvm/CodeGen/MachineOperand.h"
|
2010-02-12 09:30:21 +08:00
|
|
|
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
2017-11-17 09:07:10 +08:00
|
|
|
#include "llvm/CodeGen/TargetSubtargetInfo.h"
|
Sink all InitializePasses.h includes
This file lists every pass in LLVM, and is included by Pass.h, which is
very popular. Every time we add, remove, or rename a pass in LLVM, it
caused lots of recompilation.
I found this fact by looking at this table, which is sorted by the
number of times a file was changed over the last 100,000 git commits
multiplied by the number of object files that depend on it in the
current checkout:
recompiles touches affected_files header
342380 95 3604 llvm/include/llvm/ADT/STLExtras.h
314730 234 1345 llvm/include/llvm/InitializePasses.h
307036 118 2602 llvm/include/llvm/ADT/APInt.h
213049 59 3611 llvm/include/llvm/Support/MathExtras.h
170422 47 3626 llvm/include/llvm/Support/Compiler.h
162225 45 3605 llvm/include/llvm/ADT/Optional.h
158319 63 2513 llvm/include/llvm/ADT/Triple.h
140322 39 3598 llvm/include/llvm/ADT/StringRef.h
137647 59 2333 llvm/include/llvm/Support/Error.h
131619 73 1803 llvm/include/llvm/Support/FileSystem.h
Before this change, touching InitializePasses.h would cause 1345 files
to recompile. After this change, touching it only causes 550 compiles in
an incremental rebuild.
Reviewers: bkramer, asbirlea, bollu, jdoerfert
Differential Revision: https://reviews.llvm.org/D70211
2019-11-14 05:15:01 +08:00
|
|
|
#include "llvm/InitializePasses.h"
|
2017-09-12 07:00:48 +08:00
|
|
|
#include "llvm/Pass.h"
|
|
|
|
#include <cassert>
|
|
|
|
|
2010-02-12 09:30:21 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2017-05-26 05:26:32 +08:00
|
|
|
#define DEBUG_TYPE "opt-phis"
|
2014-04-22 10:02:50 +08:00
|
|
|
|
2010-02-12 09:30:21 +08:00
|
|
|
STATISTIC(NumPHICycles, "Number of PHI cycles replaced");
|
2010-02-13 08:31:44 +08:00
|
|
|
STATISTIC(NumDeadPHICycles, "Number of dead PHI cycles");
|
2010-02-12 09:30:21 +08:00
|
|
|
|
|
|
|
namespace {
|
2017-09-12 07:00:48 +08:00
|
|
|
|
2010-02-12 09:30:21 +08:00
|
|
|
class OptimizePHIs : public MachineFunctionPass {
|
|
|
|
MachineRegisterInfo *MRI;
|
|
|
|
const TargetInstrInfo *TII;
|
|
|
|
|
|
|
|
public:
|
|
|
|
static char ID; // Pass identification
|
2017-09-12 07:00:48 +08:00
|
|
|
|
2010-10-20 01:21:58 +08:00
|
|
|
OptimizePHIs() : MachineFunctionPass(ID) {
|
|
|
|
initializeOptimizePHIsPass(*PassRegistry::getPassRegistry());
|
|
|
|
}
|
2010-02-12 09:30:21 +08:00
|
|
|
|
2018-07-17 02:51:40 +08:00
|
|
|
bool runOnMachineFunction(MachineFunction &Fn) override;
|
2010-02-12 09:30:21 +08:00
|
|
|
|
2014-03-07 17:26:03 +08:00
|
|
|
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
2010-02-12 09:30:21 +08:00
|
|
|
AU.setPreservesCFG();
|
|
|
|
MachineFunctionPass::getAnalysisUsage(AU);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2017-09-12 07:00:48 +08:00
|
|
|
using InstrSet = SmallPtrSet<MachineInstr *, 16>;
|
|
|
|
using InstrSetIterator = SmallPtrSetIterator<MachineInstr *>;
|
2010-02-13 08:31:44 +08:00
|
|
|
|
|
|
|
bool IsSingleValuePHICycle(MachineInstr *MI, unsigned &SingleValReg,
|
|
|
|
InstrSet &PHIsInCycle);
|
|
|
|
bool IsDeadPHICycle(MachineInstr *MI, InstrSet &PHIsInCycle);
|
|
|
|
bool OptimizeBB(MachineBasicBlock &MBB);
|
2010-02-12 09:30:21 +08:00
|
|
|
};
|
2017-09-12 07:00:48 +08:00
|
|
|
|
|
|
|
} // end anonymous namespace
|
2010-02-12 09:30:21 +08:00
|
|
|
|
|
|
|
char OptimizePHIs::ID = 0;
|
2017-09-12 07:00:48 +08:00
|
|
|
|
2012-02-09 05:23:13 +08:00
|
|
|
char &llvm::OptimizePHIsID = OptimizePHIs::ID;
|
2017-09-12 07:00:48 +08:00
|
|
|
|
2017-05-26 05:26:32 +08:00
|
|
|
INITIALIZE_PASS(OptimizePHIs, DEBUG_TYPE,
|
2010-10-08 06:25:06 +08:00
|
|
|
"Optimize machine instruction PHIs", false, false)
|
2010-02-12 09:30:21 +08:00
|
|
|
|
|
|
|
bool OptimizePHIs::runOnMachineFunction(MachineFunction &Fn) {
|
2017-12-16 06:22:58 +08:00
|
|
|
if (skipFunction(Fn.getFunction()))
|
2014-04-01 01:43:35 +08:00
|
|
|
return false;
|
|
|
|
|
2010-02-12 09:30:21 +08:00
|
|
|
MRI = &Fn.getRegInfo();
|
2014-08-05 10:39:49 +08:00
|
|
|
TII = Fn.getSubtarget().getInstrInfo();
|
2010-02-12 09:30:21 +08:00
|
|
|
|
2010-02-13 08:31:44 +08:00
|
|
|
// Find dead PHI cycles and PHI cycles that can be replaced by a single
|
|
|
|
// value. InstCombine does these optimizations, but DAG legalization may
|
|
|
|
// introduce new opportunities, e.g., when i64 values are split up for
|
|
|
|
// 32-bit targets.
|
2010-02-12 09:30:21 +08:00
|
|
|
bool Changed = false;
|
2021-02-18 15:58:46 +08:00
|
|
|
for (MachineBasicBlock &MBB : Fn)
|
|
|
|
Changed |= OptimizeBB(MBB);
|
2010-02-12 09:30:21 +08:00
|
|
|
|
|
|
|
return Changed;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// IsSingleValuePHICycle - Check if MI is a PHI where all the source operands
|
2018-12-15 22:37:01 +08:00
|
|
|
/// are copies of SingleValReg, possibly via copies through other PHIs. If
|
2010-02-12 09:30:21 +08:00
|
|
|
/// SingleValReg is zero on entry, it is set to the register with the single
|
2018-12-15 22:37:01 +08:00
|
|
|
/// non-copy value. PHIsInCycle is a set used to keep track of the PHIs that
|
|
|
|
/// have been scanned. PHIs may be grouped by cycle, several cycles or chains.
|
2010-02-13 08:31:44 +08:00
|
|
|
bool OptimizePHIs::IsSingleValuePHICycle(MachineInstr *MI,
|
2010-02-12 09:30:21 +08:00
|
|
|
unsigned &SingleValReg,
|
2010-02-13 08:31:44 +08:00
|
|
|
InstrSet &PHIsInCycle) {
|
2010-02-12 09:30:21 +08:00
|
|
|
assert(MI->isPHI() && "IsSingleValuePHICycle expects a PHI instruction");
|
Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM
Summary:
This clang-tidy check is looking for unsigned integer variables whose initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).
Partial reverts in:
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
X86FixupLEAs.cpp - Some functions return unsigned and arguably should be MCRegister
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
HexagonBitSimplify.cpp - Function takes BitTracker::RegisterRef which appears to be unsigned&
MachineVerifier.cpp - Ambiguous operator==() given MCRegister and const Register
PPCFastISel.cpp - No Register::operator-=()
PeepholeOptimizer.cpp - TargetInstrInfo::optimizeLoadInstr() takes an unsigned&
MachineTraceMetrics.cpp - MachineTraceMetrics lacks a suitable constructor
Manual fixups in:
ARMFastISel.cpp - ARMEmitLoad() now takes a Register& instead of unsigned&
HexagonSplitDouble.cpp - Ternary operator was ambiguous between unsigned/Register
HexagonConstExtenders.cpp - Has a local class named Register, used llvm::Register instead of Register.
PPCFastISel.cpp - PPCEmitLoad() now takes a Register& instead of unsigned&
Depends on D65919
Reviewers: arsenm, bogner, craig.topper, RKSimon
Reviewed By: arsenm
Subscribers: RKSimon, craig.topper, lenary, aemerson, wuzish, jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65962
llvm-svn: 369041
2019-08-16 03:22:08 +08:00
|
|
|
Register DstReg = MI->getOperand(0).getReg();
|
2010-02-12 09:30:21 +08:00
|
|
|
|
|
|
|
// See if we already saw this register.
|
2014-11-19 15:49:26 +08:00
|
|
|
if (!PHIsInCycle.insert(MI).second)
|
2010-02-12 09:30:21 +08:00
|
|
|
return true;
|
|
|
|
|
|
|
|
// Don't scan crazily complex things.
|
2010-02-13 08:31:44 +08:00
|
|
|
if (PHIsInCycle.size() == 16)
|
2010-02-12 09:30:21 +08:00
|
|
|
return false;
|
|
|
|
|
|
|
|
// Scan the PHI operands.
|
|
|
|
for (unsigned i = 1; i != MI->getNumOperands(); i += 2) {
|
Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM
Summary:
This clang-tidy check is looking for unsigned integer variables whose initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).
Partial reverts in:
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
X86FixupLEAs.cpp - Some functions return unsigned and arguably should be MCRegister
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
HexagonBitSimplify.cpp - Function takes BitTracker::RegisterRef which appears to be unsigned&
MachineVerifier.cpp - Ambiguous operator==() given MCRegister and const Register
PPCFastISel.cpp - No Register::operator-=()
PeepholeOptimizer.cpp - TargetInstrInfo::optimizeLoadInstr() takes an unsigned&
MachineTraceMetrics.cpp - MachineTraceMetrics lacks a suitable constructor
Manual fixups in:
ARMFastISel.cpp - ARMEmitLoad() now takes a Register& instead of unsigned&
HexagonSplitDouble.cpp - Ternary operator was ambiguous between unsigned/Register
HexagonConstExtenders.cpp - Has a local class named Register, used llvm::Register instead of Register.
PPCFastISel.cpp - PPCEmitLoad() now takes a Register& instead of unsigned&
Depends on D65919
Reviewers: arsenm, bogner, craig.topper, RKSimon
Reviewed By: arsenm
Subscribers: RKSimon, craig.topper, lenary, aemerson, wuzish, jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65962
llvm-svn: 369041
2019-08-16 03:22:08 +08:00
|
|
|
Register SrcReg = MI->getOperand(i).getReg();
|
2010-02-12 09:30:21 +08:00
|
|
|
if (SrcReg == DstReg)
|
|
|
|
continue;
|
2010-02-13 08:31:44 +08:00
|
|
|
MachineInstr *SrcMI = MRI->getVRegDef(SrcReg);
|
2010-02-12 09:30:21 +08:00
|
|
|
|
|
|
|
// Skip over register-to-register moves.
|
2019-08-02 07:27:28 +08:00
|
|
|
if (SrcMI && SrcMI->isCopy() && !SrcMI->getOperand(0).getSubReg() &&
|
2010-07-16 12:45:42 +08:00
|
|
|
!SrcMI->getOperand(1).getSubReg() &&
|
2019-08-02 07:27:28 +08:00
|
|
|
Register::isVirtualRegister(SrcMI->getOperand(1).getReg())) {
|
2018-12-15 22:37:01 +08:00
|
|
|
SrcReg = SrcMI->getOperand(1).getReg();
|
|
|
|
SrcMI = MRI->getVRegDef(SrcReg);
|
|
|
|
}
|
2010-02-12 09:30:21 +08:00
|
|
|
if (!SrcMI)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (SrcMI->isPHI()) {
|
2010-02-13 08:31:44 +08:00
|
|
|
if (!IsSingleValuePHICycle(SrcMI, SingleValReg, PHIsInCycle))
|
2010-02-12 09:30:21 +08:00
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
// Fail if there is more than one non-phi/non-move register.
|
2018-12-15 22:37:01 +08:00
|
|
|
if (SingleValReg != 0 && SingleValReg != SrcReg)
|
2010-02-12 09:30:21 +08:00
|
|
|
return false;
|
|
|
|
SingleValReg = SrcReg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-02-13 08:31:44 +08:00
|
|
|
/// IsDeadPHICycle - Check if the register defined by a PHI is only used by
|
|
|
|
/// other PHIs in a cycle.
|
|
|
|
bool OptimizePHIs::IsDeadPHICycle(MachineInstr *MI, InstrSet &PHIsInCycle) {
|
|
|
|
assert(MI->isPHI() && "IsDeadPHICycle expects a PHI instruction");
|
Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM
Summary:
This clang-tidy check is looking for unsigned integer variables whose initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).
Partial reverts in:
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
X86FixupLEAs.cpp - Some functions return unsigned and arguably should be MCRegister
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
HexagonBitSimplify.cpp - Function takes BitTracker::RegisterRef which appears to be unsigned&
MachineVerifier.cpp - Ambiguous operator==() given MCRegister and const Register
PPCFastISel.cpp - No Register::operator-=()
PeepholeOptimizer.cpp - TargetInstrInfo::optimizeLoadInstr() takes an unsigned&
MachineTraceMetrics.cpp - MachineTraceMetrics lacks a suitable constructor
Manual fixups in:
ARMFastISel.cpp - ARMEmitLoad() now takes a Register& instead of unsigned&
HexagonSplitDouble.cpp - Ternary operator was ambiguous between unsigned/Register
HexagonConstExtenders.cpp - Has a local class named Register, used llvm::Register instead of Register.
PPCFastISel.cpp - PPCEmitLoad() now takes a Register& instead of unsigned&
Depends on D65919
Reviewers: arsenm, bogner, craig.topper, RKSimon
Reviewed By: arsenm
Subscribers: RKSimon, craig.topper, lenary, aemerson, wuzish, jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65962
llvm-svn: 369041
2019-08-16 03:22:08 +08:00
|
|
|
Register DstReg = MI->getOperand(0).getReg();
|
2019-08-02 07:27:28 +08:00
|
|
|
assert(Register::isVirtualRegister(DstReg) &&
|
2010-02-13 08:31:44 +08:00
|
|
|
"PHI destination is not a virtual register");
|
|
|
|
|
|
|
|
// See if we already saw this register.
|
2014-11-19 15:49:26 +08:00
|
|
|
if (!PHIsInCycle.insert(MI).second)
|
2010-02-13 08:31:44 +08:00
|
|
|
return true;
|
|
|
|
|
|
|
|
// Don't scan crazily complex things.
|
|
|
|
if (PHIsInCycle.size() == 16)
|
|
|
|
return false;
|
|
|
|
|
2017-12-07 15:01:21 +08:00
|
|
|
for (MachineInstr &UseMI : MRI->use_nodbg_instructions(DstReg)) {
|
2014-03-18 03:36:09 +08:00
|
|
|
if (!UseMI.isPHI() || !IsDeadPHICycle(&UseMI, PHIsInCycle))
|
2010-02-13 08:31:44 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// OptimizeBB - Remove dead PHI cycles and PHI cycles that can be replaced by
|
|
|
|
/// a single value.
|
|
|
|
bool OptimizePHIs::OptimizeBB(MachineBasicBlock &MBB) {
|
2010-02-12 09:30:21 +08:00
|
|
|
bool Changed = false;
|
|
|
|
for (MachineBasicBlock::iterator
|
|
|
|
MII = MBB.begin(), E = MBB.end(); MII != E; ) {
|
|
|
|
MachineInstr *MI = &*MII++;
|
|
|
|
if (!MI->isPHI())
|
|
|
|
break;
|
|
|
|
|
2010-02-13 08:31:44 +08:00
|
|
|
// Check for single-value PHI cycles.
|
2010-02-12 09:30:21 +08:00
|
|
|
unsigned SingleValReg = 0;
|
2010-02-13 08:31:44 +08:00
|
|
|
InstrSet PHIsInCycle;
|
|
|
|
if (IsSingleValuePHICycle(MI, SingleValReg, PHIsInCycle) &&
|
2010-02-12 09:30:21 +08:00
|
|
|
SingleValReg != 0) {
|
Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM
Summary:
This clang-tidy check is looking for unsigned integer variables whose initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).
Partial reverts in:
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
X86FixupLEAs.cpp - Some functions return unsigned and arguably should be MCRegister
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
HexagonBitSimplify.cpp - Function takes BitTracker::RegisterRef which appears to be unsigned&
MachineVerifier.cpp - Ambiguous operator==() given MCRegister and const Register
PPCFastISel.cpp - No Register::operator-=()
PeepholeOptimizer.cpp - TargetInstrInfo::optimizeLoadInstr() takes an unsigned&
MachineTraceMetrics.cpp - MachineTraceMetrics lacks a suitable constructor
Manual fixups in:
ARMFastISel.cpp - ARMEmitLoad() now takes a Register& instead of unsigned&
HexagonSplitDouble.cpp - Ternary operator was ambiguous between unsigned/Register
HexagonConstExtenders.cpp - Has a local class named Register, used llvm::Register instead of Register.
PPCFastISel.cpp - PPCEmitLoad() now takes a Register& instead of unsigned&
Depends on D65919
Reviewers: arsenm, bogner, craig.topper, RKSimon
Reviewed By: arsenm
Subscribers: RKSimon, craig.topper, lenary, aemerson, wuzish, jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65962
llvm-svn: 369041
2019-08-16 03:22:08 +08:00
|
|
|
Register OldReg = MI->getOperand(0).getReg();
|
2011-10-18 05:54:46 +08:00
|
|
|
if (!MRI->constrainRegClass(SingleValReg, MRI->getRegClass(OldReg)))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
MRI->replaceRegWith(OldReg, SingleValReg);
|
2010-02-12 09:30:21 +08:00
|
|
|
MI->eraseFromParent();
|
2019-02-12 23:02:57 +08:00
|
|
|
|
|
|
|
// The kill flags on OldReg and SingleValReg may no longer be correct.
|
|
|
|
MRI->clearKillFlags(SingleValReg);
|
|
|
|
|
2010-02-12 09:30:21 +08:00
|
|
|
++NumPHICycles;
|
|
|
|
Changed = true;
|
2010-02-13 08:31:44 +08:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check for dead PHI cycles.
|
|
|
|
PHIsInCycle.clear();
|
|
|
|
if (IsDeadPHICycle(MI, PHIsInCycle)) {
|
2021-02-18 15:58:46 +08:00
|
|
|
for (MachineInstr *PhiMI : PHIsInCycle) {
|
2016-08-17 08:43:59 +08:00
|
|
|
if (MII == PhiMI)
|
2010-02-13 08:31:44 +08:00
|
|
|
++MII;
|
|
|
|
PhiMI->eraseFromParent();
|
|
|
|
}
|
|
|
|
++NumDeadPHICycles;
|
|
|
|
Changed = true;
|
2010-02-12 09:30:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return Changed;
|
|
|
|
}
|