blob: ed88070882c027d03bb405d5653f2c7a9e028bfc [file] [log] [blame]
Evan Cheng00b1a3c2012-01-07 03:02:36 +00001//===- MachineCopyPropagation.cpp - Machine Copy Propagation Pass ---------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
Geoff Berry51f52c42017-08-17 23:06:55 +000010// This is a simple MachineInstr-level copy forwarding pass. It may be run at
11// two places in the codegen pipeline:
12// - After register allocation but before virtual registers have been remapped
13// to physical registers.
14// - After physical register remapping.
15//
16// The optimizations done vary slightly based on whether virtual registers are
17// still present. In both cases, this pass forwards the source of COPYs to the
18// users of their destinations when doing so is legal. For example:
19//
20// %vreg1 = COPY %vreg0
21// ...
22// ... = OP %vreg1
23//
24// If
25// - the physical register assigned to %vreg0 has not been clobbered by the
26// time of the use of %vreg1
27// - the register class constraints are satisfied
28// - the COPY def is the only value that reaches OP
29// then this pass replaces the above with:
30//
31// %vreg1 = COPY %vreg0
32// ...
33// ... = OP %vreg0
34//
35// and updates the relevant state required by VirtRegMap (e.g. LiveIntervals).
36// COPYs whose LiveIntervals become dead as a result of this forwarding (i.e. if
37// all uses of %vreg1 are changed to %vreg0) are removed.
38//
39// When being run with only physical registers, this pass will also remove some
40// redundant COPYs. For example:
41//
42// %R1 = COPY %R0
43// ... // No clobber of %R1
44// %R0 = COPY %R1 <<< Removed
45//
46// or
47//
48// %R1 = COPY %R0
49// ... // No clobber of %R0
50// %R1 = COPY %R0 <<< Removed
Evan Cheng00b1a3c2012-01-07 03:02:36 +000051//
52//===----------------------------------------------------------------------===//
53
Geoff Berry51f52c42017-08-17 23:06:55 +000054#include "LiveDebugVariables.h"
Evan Cheng00b1a3c2012-01-07 03:02:36 +000055#include "llvm/ADT/DenseMap.h"
56#include "llvm/ADT/SetVector.h"
57#include "llvm/ADT/SmallVector.h"
58#include "llvm/ADT/Statistic.h"
Geoff Berry51f52c42017-08-17 23:06:55 +000059#include "llvm/CodeGen/LiveRangeEdit.h"
60#include "llvm/CodeGen/LiveStackAnalysis.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000061#include "llvm/CodeGen/MachineFunction.h"
62#include "llvm/CodeGen/MachineFunctionPass.h"
63#include "llvm/CodeGen/MachineRegisterInfo.h"
Chandler Carruth6bda14b2017-06-06 11:49:48 +000064#include "llvm/CodeGen/Passes.h"
Geoff Berry51f52c42017-08-17 23:06:55 +000065#include "llvm/CodeGen/VirtRegMap.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000066#include "llvm/Pass.h"
67#include "llvm/Support/Debug.h"
Geoff Berry51f52c42017-08-17 23:06:55 +000068#include "llvm/Support/DebugCounter.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000069#include "llvm/Support/raw_ostream.h"
70#include "llvm/Target/TargetInstrInfo.h"
71#include "llvm/Target/TargetRegisterInfo.h"
Eric Christopherd9134482014-08-04 21:25:23 +000072#include "llvm/Target/TargetSubtargetInfo.h"
Evan Cheng00b1a3c2012-01-07 03:02:36 +000073using namespace llvm;
74
Matthias Braun1527baa2017-05-25 21:26:32 +000075#define DEBUG_TYPE "machine-cp"
Chandler Carruth1b9dde02014-04-22 02:02:50 +000076
Evan Cheng00b1a3c2012-01-07 03:02:36 +000077STATISTIC(NumDeletes, "Number of dead copies deleted");
Geoff Berry51f52c42017-08-17 23:06:55 +000078STATISTIC(NumCopyForwards, "Number of copy uses forwarded");
79DEBUG_COUNTER(FwdCounter, "machine-cp-fwd",
80 "Controls which register COPYs are forwarded");
Evan Cheng00b1a3c2012-01-07 03:02:36 +000081
82namespace {
Matthias Braune39ff702016-02-26 03:18:50 +000083 typedef SmallVector<unsigned, 4> RegList;
84 typedef DenseMap<unsigned, RegList> SourceMap;
85 typedef DenseMap<unsigned, MachineInstr*> Reg2MIMap;
86
Geoff Berry51f52c42017-08-17 23:06:55 +000087 class MachineCopyPropagation : public MachineFunctionPass,
88 private LiveRangeEdit::Delegate {
Evan Cheng00b1a3c2012-01-07 03:02:36 +000089 const TargetRegisterInfo *TRI;
Jakob Stoklund Olesenbb1e9832012-11-30 23:53:00 +000090 const TargetInstrInfo *TII;
Geoff Berry51f52c42017-08-17 23:06:55 +000091 MachineRegisterInfo *MRI;
92 MachineFunction *MF;
93 SlotIndexes *Indexes;
94 LiveIntervals *LIS;
95 const VirtRegMap *VRM;
96 // True if this pass being run before virtual registers are remapped to
97 // physical ones.
98 bool PreRegRewrite;
99 bool NoSubRegLiveness;
100
101 protected:
102 MachineCopyPropagation(char &ID, bool PreRegRewrite)
103 : MachineFunctionPass(ID), PreRegRewrite(PreRegRewrite) {}
Andrew Trick9e761992012-02-08 21:22:43 +0000104
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000105 public:
106 static char ID; // Pass identification, replacement for typeid
Geoff Berry51f52c42017-08-17 23:06:55 +0000107 MachineCopyPropagation() : MachineCopyPropagation(ID, false) {
Matthias Braun273575d2016-02-20 03:56:36 +0000108 initializeMachineCopyPropagationPass(*PassRegistry::getPassRegistry());
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000109 }
110
Matt Arsenault8f4d43a2016-06-02 00:04:26 +0000111 void getAnalysisUsage(AnalysisUsage &AU) const override {
Geoff Berry51f52c42017-08-17 23:06:55 +0000112 if (PreRegRewrite) {
113 AU.addRequired<SlotIndexes>();
114 AU.addPreserved<SlotIndexes>();
115 AU.addRequired<LiveIntervals>();
116 AU.addPreserved<LiveIntervals>();
117 AU.addRequired<VirtRegMap>();
118 AU.addPreserved<VirtRegMap>();
119 AU.addPreserved<LiveDebugVariables>();
120 AU.addPreserved<LiveStacks>();
121 }
Matt Arsenault8f4d43a2016-06-02 00:04:26 +0000122 AU.setPreservesCFG();
123 MachineFunctionPass::getAnalysisUsage(AU);
124 }
125
Craig Topper4584cd52014-03-07 09:26:03 +0000126 bool runOnMachineFunction(MachineFunction &MF) override;
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000127
Derek Schuffad154c82016-03-28 17:05:30 +0000128 MachineFunctionProperties getRequiredProperties() const override {
Geoff Berry51f52c42017-08-17 23:06:55 +0000129 if (PreRegRewrite)
130 return MachineFunctionProperties()
131 .set(MachineFunctionProperties::Property::NoPHIs)
132 .set(MachineFunctionProperties::Property::TracksLiveness);
Derek Schuffad154c82016-03-28 17:05:30 +0000133 return MachineFunctionProperties().set(
Matthias Braun1eb47362016-08-25 01:27:13 +0000134 MachineFunctionProperties::Property::NoVRegs);
Derek Schuffad154c82016-03-28 17:05:30 +0000135 }
136
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000137 private:
Matthias Braune39ff702016-02-26 03:18:50 +0000138 void ClobberRegister(unsigned Reg);
Matthias Braun82e7f4d2017-02-04 02:27:20 +0000139 void ReadRegister(unsigned Reg);
Matthias Braunbd18d752016-02-20 03:56:39 +0000140 void CopyPropagateBlock(MachineBasicBlock &MBB);
Matthias Braun9dcd65f2016-02-26 03:18:55 +0000141 bool eraseIfRedundant(MachineInstr &Copy, unsigned Src, unsigned Def);
Geoff Berry51f52c42017-08-17 23:06:55 +0000142 unsigned getPhysReg(unsigned Reg, unsigned SubReg);
143 unsigned getPhysReg(const MachineOperand &Opnd) {
144 return getPhysReg(Opnd.getReg(), Opnd.getSubReg());
145 }
146 unsigned getFullPhysReg(const MachineOperand &Opnd) {
147 return getPhysReg(Opnd.getReg(), 0);
148 }
149 void forwardUses(MachineInstr &MI);
150 bool isForwardableRegClassCopy(const MachineInstr &Copy,
151 const MachineInstr &UseI);
152 std::tuple<unsigned, unsigned, bool>
153 checkUseSubReg(const MachineOperand &CopySrc, const MachineOperand &MOUse);
154 bool hasImplicitOverlap(const MachineInstr &MI, const MachineOperand &Use);
155 void narrowRegClass(const MachineInstr &MI, const MachineOperand &MOUse,
156 unsigned NewUseReg, unsigned NewUseSubReg);
157 void updateForwardedCopyLiveInterval(const MachineInstr &Copy,
158 const MachineInstr &UseMI,
159 unsigned OrigUseReg,
160 unsigned NewUseReg,
161 unsigned NewUseSubReg);
162 /// LiveRangeEdit callback for eliminateDeadDefs().
163 void LRE_WillEraseInstruction(MachineInstr *MI) override;
Matthias Braunbd18d752016-02-20 03:56:39 +0000164
165 /// Candidates for deletion.
166 SmallSetVector<MachineInstr*, 8> MaybeDeadCopies;
167 /// Def -> available copies map.
Matthias Braunc65e9042016-02-20 03:56:41 +0000168 Reg2MIMap AvailCopyMap;
Matthias Braunbd18d752016-02-20 03:56:39 +0000169 /// Def -> copies map.
Matthias Braunc65e9042016-02-20 03:56:41 +0000170 Reg2MIMap CopyMap;
Matthias Braunbd18d752016-02-20 03:56:39 +0000171 /// Src -> Def map
172 SourceMap SrcMap;
173 bool Changed;
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000174 };
Geoff Berry51f52c42017-08-17 23:06:55 +0000175
176 class MachineCopyPropagationPreRegRewrite : public MachineCopyPropagation {
177 public:
178 static char ID; // Pass identification, replacement for typeid
179 MachineCopyPropagationPreRegRewrite()
180 : MachineCopyPropagation(ID, true) {
181 initializeMachineCopyPropagationPreRegRewritePass(*PassRegistry::getPassRegistry());
182 }
183 };
Alexander Kornienkof00654e2015-06-23 09:49:53 +0000184}
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000185char MachineCopyPropagation::ID = 0;
Andrew Trick1fa5bcb2012-02-08 21:23:13 +0000186char &llvm::MachineCopyPropagationID = MachineCopyPropagation::ID;
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000187
Matthias Braun1527baa2017-05-25 21:26:32 +0000188INITIALIZE_PASS(MachineCopyPropagation, DEBUG_TYPE,
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000189 "Machine Copy Propagation Pass", false, false)
190
Geoff Berry51f52c42017-08-17 23:06:55 +0000191/// We have two separate passes that are very similar, the only difference being
192/// where they are meant to be run in the pipeline. This is done for several
193/// reasons:
194/// - the two passes have different dependencies
195/// - some targets want to disable the later run of this pass, but not the
196/// earlier one (e.g. NVPTX and WebAssembly)
197/// - it allows for easier debugging via llc
198
199char MachineCopyPropagationPreRegRewrite::ID = 0;
200char &llvm::MachineCopyPropagationPreRegRewriteID = MachineCopyPropagationPreRegRewrite::ID;
201
202INITIALIZE_PASS_BEGIN(MachineCopyPropagationPreRegRewrite,
203 "machine-cp-prerewrite",
204 "Machine Copy Propagation Pre-Register Rewrite Pass",
205 false, false)
206INITIALIZE_PASS_DEPENDENCY(SlotIndexes)
207INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
208INITIALIZE_PASS_DEPENDENCY(VirtRegMap)
209INITIALIZE_PASS_END(MachineCopyPropagationPreRegRewrite,
210 "machine-cp-prerewrite",
211 "Machine Copy Propagation Pre-Register Rewrite Pass", false,
212 false)
213
Matthias Braune39ff702016-02-26 03:18:50 +0000214/// Remove any entry in \p Map where the register is a subregister or equal to
215/// a register contained in \p Regs.
216static void removeRegsFromMap(Reg2MIMap &Map, const RegList &Regs,
217 const TargetRegisterInfo &TRI) {
218 for (unsigned Reg : Regs) {
219 // Source of copy is no longer available for propagation.
220 for (MCSubRegIterator SR(Reg, &TRI, true); SR.isValid(); ++SR)
221 Map.erase(*SR);
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000222 }
223}
224
Matthias Braune39ff702016-02-26 03:18:50 +0000225/// Remove any entry in \p Map that is marked clobbered in \p RegMask.
226/// The map will typically have a lot fewer entries than the regmask clobbers,
227/// so this is more efficient than iterating the clobbered registers and calling
228/// ClobberRegister() on them.
229static void removeClobberedRegsFromMap(Reg2MIMap &Map,
230 const MachineOperand &RegMask) {
231 for (Reg2MIMap::iterator I = Map.begin(), E = Map.end(), Next; I != E;
232 I = Next) {
233 Next = std::next(I);
234 unsigned Reg = I->first;
235 if (RegMask.clobbersPhysReg(Reg))
236 Map.erase(I);
Evan Cheng520730f2012-01-08 19:52:28 +0000237 }
Matthias Braune39ff702016-02-26 03:18:50 +0000238}
239
240void MachineCopyPropagation::ClobberRegister(unsigned Reg) {
241 for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI) {
242 CopyMap.erase(*AI);
243 AvailCopyMap.erase(*AI);
244
245 SourceMap::iterator SI = SrcMap.find(*AI);
246 if (SI != SrcMap.end()) {
247 removeRegsFromMap(AvailCopyMap, SI->second, *TRI);
248 SrcMap.erase(SI);
249 }
250 }
Evan Cheng520730f2012-01-08 19:52:28 +0000251}
252
Matthias Braun82e7f4d2017-02-04 02:27:20 +0000253void MachineCopyPropagation::ReadRegister(unsigned Reg) {
Geoff Berry51f52c42017-08-17 23:06:55 +0000254 // We don't track MaybeDeadCopies when running pre-VirtRegRewriter.
255 if (PreRegRewrite)
256 return;
257
Matthias Braun82e7f4d2017-02-04 02:27:20 +0000258 // If 'Reg' is defined by a copy, the copy is no longer a candidate
259 // for elimination.
260 for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI) {
261 Reg2MIMap::iterator CI = CopyMap.find(*AI);
262 if (CI != CopyMap.end()) {
263 DEBUG(dbgs() << "MCP: Copy is used - not dead: "; CI->second->dump());
264 MaybeDeadCopies.remove(CI->second);
265 }
266 }
267}
268
Matthias Braun9dcd65f2016-02-26 03:18:55 +0000269/// Return true if \p PreviousCopy did copy register \p Src to register \p Def.
270/// This fact may have been obscured by sub register usage or may not be true at
271/// all even though Src and Def are subregisters of the registers used in
272/// PreviousCopy. e.g.
273/// isNopCopy("ecx = COPY eax", AX, CX) == true
274/// isNopCopy("ecx = COPY eax", AH, CL) == false
275static bool isNopCopy(const MachineInstr &PreviousCopy, unsigned Src,
276 unsigned Def, const TargetRegisterInfo *TRI) {
277 unsigned PreviousSrc = PreviousCopy.getOperand(1).getReg();
278 unsigned PreviousDef = PreviousCopy.getOperand(0).getReg();
279 if (Src == PreviousSrc) {
280 assert(Def == PreviousDef);
Evan Cheng63618f92012-02-20 23:28:17 +0000281 return true;
Evan Cheng63618f92012-02-20 23:28:17 +0000282 }
Matthias Braun9dcd65f2016-02-26 03:18:55 +0000283 if (!TRI->isSubRegister(PreviousSrc, Src))
284 return false;
285 unsigned SubIdx = TRI->getSubRegIndex(PreviousSrc, Src);
286 return SubIdx == TRI->getSubRegIndex(PreviousDef, Def);
287}
Evan Cheng63618f92012-02-20 23:28:17 +0000288
Geoff Berry51f52c42017-08-17 23:06:55 +0000289/// Return the physical register assigned to \p Reg if it is a virtual register,
290/// otherwise just return the physical reg from the operand itself.
291///
292/// If \p SubReg is 0 then return the full physical register assigned to the
293/// virtual register ignoring subregs. If we aren't tracking sub-reg liveness
294/// then we need to use this to be more conservative with clobbers by killing
295/// all super reg and their sub reg COPYs as well. This is to prevent COPY
296/// forwarding in cases like the following:
297///
298/// %vreg2 = COPY %vreg1:sub1
299/// %vreg3 = COPY %vreg1:sub0
300/// ... = OP1 %vreg2
301/// ... = OP2 %vreg3
302///
303/// After forward %vreg2 (assuming this is the last use of %vreg1) and
304/// VirtRegRewriter adding kill markers we have:
305///
306/// %vreg3 = COPY %vreg1:sub0
307/// ... = OP1 %vreg1:sub1<kill>
308/// ... = OP2 %vreg3
309///
310/// If %vreg3 is assigned to a sub-reg of %vreg1, then after rewriting we have:
311///
312/// ... = OP1 R0:sub1, R0<imp-use,kill>
313/// ... = OP2 R0:sub0
314///
315/// and the use of R0 by OP2 will not have a valid definition.
316unsigned MachineCopyPropagation::getPhysReg(unsigned Reg, unsigned SubReg) {
317
318 // Physical registers cannot have subregs.
319 if (!TargetRegisterInfo::isVirtualRegister(Reg))
320 return Reg;
321
322 assert(PreRegRewrite && "Unexpected virtual register encountered");
323 Reg = VRM->getPhys(Reg);
324 if (SubReg && !NoSubRegLiveness)
325 Reg = TRI->getSubReg(Reg, SubReg);
326 return Reg;
327}
328
Matthias Braun9dcd65f2016-02-26 03:18:55 +0000329/// Remove instruction \p Copy if there exists a previous copy that copies the
330/// register \p Src to the register \p Def; This may happen indirectly by
331/// copying the super registers.
332bool MachineCopyPropagation::eraseIfRedundant(MachineInstr &Copy, unsigned Src,
333 unsigned Def) {
334 // Avoid eliminating a copy from/to a reserved registers as we cannot predict
335 // the value (Example: The sparc zero register is writable but stays zero).
336 if (MRI->isReserved(Src) || MRI->isReserved(Def))
337 return false;
338
339 // Search for an existing copy.
340 Reg2MIMap::iterator CI = AvailCopyMap.find(Def);
341 if (CI == AvailCopyMap.end())
342 return false;
343
344 // Check that the existing copy uses the correct sub registers.
345 MachineInstr &PrevCopy = *CI->second;
346 if (!isNopCopy(PrevCopy, Src, Def, TRI))
347 return false;
348
349 DEBUG(dbgs() << "MCP: copy is a NOP, removing: "; Copy.dump());
350
351 // Copy was redundantly redefining either Src or Def. Remove earlier kill
352 // flags between Copy and PrevCopy because the value will be reused now.
353 assert(Copy.isCopy());
354 unsigned CopyDef = Copy.getOperand(0).getReg();
355 assert(CopyDef == Src || CopyDef == Def);
356 for (MachineInstr &MI :
357 make_range(PrevCopy.getIterator(), Copy.getIterator()))
358 MI.clearRegisterKills(CopyDef, TRI);
359
360 Copy.eraseFromParent();
361 Changed = true;
362 ++NumDeletes;
363 return true;
Evan Cheng63618f92012-02-20 23:28:17 +0000364}
365
Geoff Berry51f52c42017-08-17 23:06:55 +0000366
367/// Decide whether we should forward the destination of \param Copy to its use
368/// in \param UseI based on the register class of the Copy operands. Same-class
369/// COPYs are always accepted by this function, but cross-class COPYs are only
370/// accepted if they are forwarded to another COPY with the operand register
371/// classes reversed. For example:
372///
373/// RegClassA = COPY RegClassB // Copy parameter
374/// ...
375/// RegClassB = COPY RegClassA // UseI parameter
376///
377/// which after forwarding becomes
378///
379/// RegClassA = COPY RegClassB
380/// ...
381/// RegClassB = COPY RegClassB
382///
383/// so we have reduced the number of cross-class COPYs and potentially
384/// introduced a no COPY that can be removed.
385bool MachineCopyPropagation::isForwardableRegClassCopy(
386 const MachineInstr &Copy, const MachineInstr &UseI) {
387 auto isCross = [&](const MachineOperand &Dst, const MachineOperand &Src) {
388 unsigned DstReg = Dst.getReg();
389 unsigned SrcPhysReg = getPhysReg(Src);
390 const TargetRegisterClass *DstRC;
391 if (TargetRegisterInfo::isVirtualRegister(DstReg)) {
392 DstRC = MRI->getRegClass(DstReg);
393 unsigned DstSubReg = Dst.getSubReg();
394 if (DstSubReg)
395 SrcPhysReg = TRI->getMatchingSuperReg(SrcPhysReg, DstSubReg, DstRC);
396 } else
397 DstRC = TRI->getMinimalPhysRegClass(DstReg);
398
399 return !DstRC->contains(SrcPhysReg);
400 };
401
402 const MachineOperand &CopyDst = Copy.getOperand(0);
403 const MachineOperand &CopySrc = Copy.getOperand(1);
404
405 if (!isCross(CopyDst, CopySrc))
406 return true;
407
408 if (!UseI.isCopy())
409 return false;
410
411 assert(getFullPhysReg(UseI.getOperand(1)) == getFullPhysReg(CopyDst));
412 return !isCross(UseI.getOperand(0), CopySrc);
413}
414
415/// Check that the subregs on the copy source operand (\p CopySrc) and the use
416/// operand to be forwarded to (\p MOUse) are compatible with doing the
417/// forwarding. Also computes the new register and subregister to be used in
418/// the forwarded-to instruction.
419std::tuple<unsigned, unsigned, bool> MachineCopyPropagation::checkUseSubReg(
420 const MachineOperand &CopySrc, const MachineOperand &MOUse) {
421 unsigned NewUseReg = CopySrc.getReg();
422 unsigned NewUseSubReg;
423
424 if (TargetRegisterInfo::isPhysicalRegister(NewUseReg)) {
425 // If MOUse is a virtual reg, we need to apply it to the new physical reg
426 // we're going to replace it with.
427 if (MOUse.getSubReg())
428 NewUseReg = TRI->getSubReg(NewUseReg, MOUse.getSubReg());
429 // If the original use subreg isn't valid on the new src reg, we can't
430 // forward it here.
431 if (!NewUseReg)
432 return std::make_tuple(0, 0, false);
433 NewUseSubReg = 0;
434 } else {
435 // %v1 = COPY %v2:sub1
436 // USE %v1:sub2
437 // The new use is %v2:sub1:sub2
438 NewUseSubReg =
439 TRI->composeSubRegIndices(CopySrc.getSubReg(), MOUse.getSubReg());
440 // Check that NewUseSubReg is valid on NewUseReg
441 if (NewUseSubReg &&
442 !TRI->getSubClassWithSubReg(MRI->getRegClass(NewUseReg), NewUseSubReg))
443 return std::make_tuple(0, 0, false);
444 }
445
446 return std::make_tuple(NewUseReg, NewUseSubReg, true);
447}
448
449/// Check that \p MI does not have implicit uses that overlap with it's \p Use
450/// operand (the register being replaced), since these can sometimes be
451/// implicitly tied to other operands. For example, on AMDGPU:
452///
453/// V_MOVRELS_B32_e32 %VGPR2, %M0<imp-use>, %EXEC<imp-use>, %VGPR2_VGPR3_VGPR4_VGPR5<imp-use>
454///
455/// the %VGPR2 is implicitly tied to the larger reg operand, but we have no
456/// way of knowing we need to update the latter when updating the former.
457bool MachineCopyPropagation::hasImplicitOverlap(const MachineInstr &MI,
458 const MachineOperand &Use) {
459 if (!TargetRegisterInfo::isPhysicalRegister(Use.getReg()))
460 return false;
461
462 for (const MachineOperand &MIUse : MI.uses())
463 if (&MIUse != &Use && MIUse.isReg() && MIUse.isImplicit() &&
464 TRI->regsOverlap(Use.getReg(), MIUse.getReg()))
465 return true;
466
467 return false;
468}
469
470/// Narrow the register class of the forwarded vreg so it matches any
471/// instruction constraints. \p MI is the instruction being forwarded to. \p
472/// MOUse is the operand being replaced in \p MI (which hasn't yet been updated
473/// at the time this function is called). \p NewUseReg and \p NewUseSubReg are
474/// what the \p MOUse will be changed to after forwarding.
475///
476/// If we are forwarding
477/// A:RCA = COPY B:RCB
478/// into
479/// ... = OP A:RCA
480///
481/// then we need to narrow the register class of B so that it is a subclass
482/// of RCA so that it meets the instruction register class constraints.
483void MachineCopyPropagation::narrowRegClass(const MachineInstr &MI,
484 const MachineOperand &MOUse,
485 unsigned NewUseReg,
486 unsigned NewUseSubReg) {
487 if (!TargetRegisterInfo::isVirtualRegister(NewUseReg))
488 return;
489
490 // Make sure the virtual reg class allows the subreg.
491 if (NewUseSubReg) {
492 const TargetRegisterClass *CurUseRC = MRI->getRegClass(NewUseReg);
493 const TargetRegisterClass *NewUseRC =
494 TRI->getSubClassWithSubReg(CurUseRC, NewUseSubReg);
495 if (CurUseRC != NewUseRC) {
496 DEBUG(dbgs() << "MCP: Setting regclass of " << PrintReg(NewUseReg, TRI)
497 << " to " << TRI->getRegClassName(NewUseRC) << "\n");
498 MRI->setRegClass(NewUseReg, NewUseRC);
499 }
500 }
501
502 unsigned MOUseOpNo = &MOUse - &MI.getOperand(0);
503 const TargetRegisterClass *InstRC =
504 TII->getRegClass(MI.getDesc(), MOUseOpNo, TRI, *MF);
505 if (InstRC) {
506 const TargetRegisterClass *CurUseRC = MRI->getRegClass(NewUseReg);
507 if (NewUseSubReg)
508 InstRC = TRI->getMatchingSuperRegClass(CurUseRC, InstRC, NewUseSubReg);
509 if (!InstRC->hasSubClassEq(CurUseRC)) {
510 const TargetRegisterClass *NewUseRC =
511 TRI->getCommonSubClass(InstRC, CurUseRC);
512 DEBUG(dbgs() << "MCP: Setting regclass of " << PrintReg(NewUseReg, TRI)
513 << " to " << TRI->getRegClassName(NewUseRC) << "\n");
514 MRI->setRegClass(NewUseReg, NewUseRC);
515 }
516 }
517}
518
519/// Update the LiveInterval information to reflect the destination of \p Copy
520/// being forwarded to a use in \p UseMI. \p OrigUseReg is the register being
521/// forwarded through. It should be the destination register of \p Copy and has
522/// already been replaced in \p UseMI at the point this function is called. \p
523/// NewUseReg and \p NewUseSubReg are the register and subregister being
524/// forwarded. They should be the source register of the \p Copy and should be
525/// the value of the \p UseMI operand being forwarded at the point this function
526/// is called.
527void MachineCopyPropagation::updateForwardedCopyLiveInterval(
528 const MachineInstr &Copy, const MachineInstr &UseMI, unsigned OrigUseReg,
529 unsigned NewUseReg, unsigned NewUseSubReg) {
530
531 assert(TRI->isSubRegisterEq(getPhysReg(OrigUseReg, 0),
532 getFullPhysReg(Copy.getOperand(0))) &&
533 "OrigUseReg mismatch");
534 assert(TRI->isSubRegisterEq(getFullPhysReg(Copy.getOperand(1)),
535 getPhysReg(NewUseReg, 0)) &&
536 "NewUseReg mismatch");
537
538 // Extend live range starting from COPY early-clobber slot, since that
539 // is where the original src live range ends.
540 SlotIndex CopyUseIdx =
541 Indexes->getInstructionIndex(Copy).getRegSlot(true /*=EarlyClobber*/);
542 SlotIndex UseIdx = Indexes->getInstructionIndex(UseMI).getRegSlot();
543 if (TargetRegisterInfo::isVirtualRegister(NewUseReg)) {
544 LiveInterval &LI = LIS->getInterval(NewUseReg);
545 LI.extendInBlock(CopyUseIdx, UseIdx);
546 LaneBitmask UseMask = TRI->getSubRegIndexLaneMask(NewUseSubReg);
547 for (auto &S : LI.subranges())
548 if ((S.LaneMask & UseMask).any() && S.find(CopyUseIdx))
549 S.extendInBlock(CopyUseIdx, UseIdx);
550 } else {
551 assert(NewUseSubReg == 0 && "Unexpected subreg on physical register!");
552 for (MCRegUnitIterator UI(NewUseReg, TRI); UI.isValid(); ++UI) {
553 LiveRange &LR = LIS->getRegUnit(*UI);
554 LR.extendInBlock(CopyUseIdx, UseIdx);
555 }
556 }
557
558 if (!TargetRegisterInfo::isVirtualRegister(OrigUseReg))
559 return;
560
561 LiveInterval &LI = LIS->getInterval(OrigUseReg);
562
563 // Can happen for undef uses.
564 if (LI.empty())
565 return;
566
567 SlotIndex UseIndex = Indexes->getInstructionIndex(UseMI);
568 const LiveRange::Segment *UseSeg = LI.getSegmentContaining(UseIndex);
569
570 // Only shrink if forwarded use is the end of a segment.
571 if (UseSeg->end != UseIndex.getRegSlot())
572 return;
573
574 SmallVector<MachineInstr *, 4> DeadInsts;
575 LIS->shrinkToUses(&LI, &DeadInsts);
576 if (!DeadInsts.empty()) {
577 SmallVector<unsigned, 8> NewRegs;
578 LiveRangeEdit(nullptr, NewRegs, *MF, *LIS, nullptr, this)
579 .eliminateDeadDefs(DeadInsts);
580 }
581}
582
583void MachineCopyPropagation::LRE_WillEraseInstruction(MachineInstr *MI) {
584 // Remove this COPY from further consideration for forwarding.
585 ClobberRegister(getFullPhysReg(MI->getOperand(0)));
586 Changed = true;
587}
588
589/// Look for available copies whose destination register is used by \p MI and
590/// replace the use in \p MI with the copy's source register.
591void MachineCopyPropagation::forwardUses(MachineInstr &MI) {
592 // We can't generally forward uses after virtual registers have been renamed
593 // because some targets generate code that has implicit dependencies on the
594 // physical register numbers. For example, in PowerPC, when spilling
595 // condition code registers, the following code pattern is generated:
596 //
597 // %CR7 = COPY %CR0
598 // %R6 = MFOCRF %CR7
599 // %R6 = RLWINM %R6, 29, 31, 31
600 //
601 // where the shift amount in the RLWINM instruction depends on the source
602 // register number of the MFOCRF instruction. If we were to forward %CR0 to
603 // the MFOCRF instruction, the shift amount would no longer be correct.
604 //
605 // FIXME: It may be possible to define a target hook that checks the register
606 // class or user opcode and allows some cases, but prevents cases like the
607 // above from being broken to enable later register copy forwarding.
608 if (!PreRegRewrite)
609 return;
610
611 if (AvailCopyMap.empty())
612 return;
613
614 // Look for non-tied explicit vreg uses that have an active COPY
615 // instruction that defines the physical register allocated to them.
616 // Replace the vreg with the source of the active COPY.
617 for (MachineOperand &MOUse : MI.explicit_uses()) {
618 // Don't forward into undef use operands since doing so can cause problems
619 // with the machine verifier, since it doesn't treat undef reads as reads,
620 // so we can end up with a live range the ends on an undef read, leading to
621 // an error that the live range doesn't end on a read of the live range
622 // register.
623 if (!MOUse.isReg() || MOUse.isTied() || MOUse.isUndef())
624 continue;
625
626 unsigned UseReg = MOUse.getReg();
627 if (!UseReg)
628 continue;
629
630 // See comment above check for !PreRegRewrite regarding forwarding changing
631 // physical registers.
632 if (!TargetRegisterInfo::isVirtualRegister(UseReg))
633 continue;
634
635 UseReg = VRM->getPhys(UseReg);
636
637 // Don't forward COPYs via non-allocatable regs since they can have
638 // non-standard semantics.
639 if (!MRI->isAllocatable(UseReg))
640 continue;
641
642 auto CI = AvailCopyMap.find(UseReg);
643 if (CI == AvailCopyMap.end())
644 continue;
645
646 MachineInstr &Copy = *CI->second;
647 MachineOperand &CopyDst = Copy.getOperand(0);
648 MachineOperand &CopySrc = Copy.getOperand(1);
649
650 // Don't forward COPYs that are already NOPs due to register assignment.
651 if (getPhysReg(CopyDst) == getPhysReg(CopySrc))
652 continue;
653
654 // FIXME: Don't handle partial uses of wider COPYs yet.
655 if (CopyDst.getSubReg() != 0 || UseReg != getPhysReg(CopyDst))
656 continue;
657
658 // Don't forward COPYs of non-allocatable regs unless they are constant.
659 unsigned CopySrcReg = CopySrc.getReg();
660 if (TargetRegisterInfo::isPhysicalRegister(CopySrcReg) &&
661 !MRI->isAllocatable(CopySrcReg) && !MRI->isConstantPhysReg(CopySrcReg))
662 continue;
663
664 if (!isForwardableRegClassCopy(Copy, MI))
665 continue;
666
667 unsigned NewUseReg, NewUseSubReg;
668 bool SubRegOK;
669 std::tie(NewUseReg, NewUseSubReg, SubRegOK) =
670 checkUseSubReg(CopySrc, MOUse);
671 if (!SubRegOK)
672 continue;
673
674 if (hasImplicitOverlap(MI, MOUse))
675 continue;
676
677 if (!DebugCounter::shouldExecute(FwdCounter))
678 continue;
679
680 DEBUG(dbgs() << "MCP: Replacing "
681 << PrintReg(MOUse.getReg(), TRI, MOUse.getSubReg())
682 << "\n with "
683 << PrintReg(NewUseReg, TRI, CopySrc.getSubReg())
684 << "\n in "
685 << MI
686 << " from "
687 << Copy);
688
689 narrowRegClass(MI, MOUse, NewUseReg, NewUseSubReg);
690
691 unsigned OrigUseReg = MOUse.getReg();
692 MOUse.setReg(NewUseReg);
693 MOUse.setSubReg(NewUseSubReg);
694
695 DEBUG(dbgs() << "MCP: After replacement: " << MI << "\n");
696
697 if (PreRegRewrite)
698 updateForwardedCopyLiveInterval(Copy, MI, OrigUseReg, NewUseReg,
699 NewUseSubReg);
700 else
701 for (MachineInstr &KMI :
702 make_range(Copy.getIterator(), std::next(MI.getIterator())))
703 KMI.clearRegisterKills(NewUseReg, TRI);
704
705 ++NumCopyForwards;
706 Changed = true;
707 }
708}
709
Matthias Braunbd18d752016-02-20 03:56:39 +0000710void MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) {
James Molloyd787d3e2014-01-22 09:12:27 +0000711 DEBUG(dbgs() << "MCP: CopyPropagateBlock " << MBB.getName() << "\n");
712
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000713 for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end(); I != E; ) {
714 MachineInstr *MI = &*I;
715 ++I;
716
717 if (MI->isCopy()) {
Geoff Berry51f52c42017-08-17 23:06:55 +0000718 unsigned Def = getPhysReg(MI->getOperand(0));
719 unsigned Src = getPhysReg(MI->getOperand(1));
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000720
Matthias Braun9dcd65f2016-02-26 03:18:55 +0000721 // The two copies cancel out and the source of the first copy
722 // hasn't been overridden, eliminate the second one. e.g.
723 // %ECX<def> = COPY %EAX
724 // ... nothing clobbered EAX.
725 // %EAX<def> = COPY %ECX
726 // =>
727 // %ECX<def> = COPY %EAX
728 //
729 // or
730 //
731 // %ECX<def> = COPY %EAX
732 // ... nothing clobbered EAX.
733 // %ECX<def> = COPY %EAX
734 // =>
735 // %ECX<def> = COPY %EAX
Geoff Berry51f52c42017-08-17 23:06:55 +0000736 if (!PreRegRewrite)
737 if (eraseIfRedundant(*MI, Def, Src) || eraseIfRedundant(*MI, Src, Def))
738 continue;
739
740 forwardUses(*MI);
741
742 // Src may have been changed by forwardUses()
743 Src = getPhysReg(MI->getOperand(1));
744 unsigned DefClobber = getFullPhysReg(MI->getOperand(0));
745 unsigned SrcClobber = getFullPhysReg(MI->getOperand(1));
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000746
Jun Bum Lim59df5e82016-02-03 15:56:27 +0000747 // If Src is defined by a previous copy, the previous copy cannot be
748 // eliminated.
Matthias Braun82e7f4d2017-02-04 02:27:20 +0000749 ReadRegister(Src);
750 for (const MachineOperand &MO : MI->implicit_operands()) {
751 if (!MO.isReg() || !MO.readsReg())
752 continue;
753 unsigned Reg = MO.getReg();
754 if (!Reg)
755 continue;
756 ReadRegister(Reg);
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000757 }
758
James Molloyd787d3e2014-01-22 09:12:27 +0000759 DEBUG(dbgs() << "MCP: Copy is a deletion candidate: "; MI->dump());
760
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000761 // Copy is now a candidate for deletion.
Geoff Berry51f52c42017-08-17 23:06:55 +0000762 // Only look for dead COPYs if we're not running just before
763 // VirtRegRewriter, since presumably these COPYs will have already been
764 // removed.
765 if (!PreRegRewrite && !MRI->isReserved(Def))
Matthias Braun273575d2016-02-20 03:56:36 +0000766 MaybeDeadCopies.insert(MI);
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000767
Jun Bum Lim59df5e82016-02-03 15:56:27 +0000768 // If 'Def' is previously source of another copy, then this earlier copy's
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000769 // source is no longer available. e.g.
770 // %xmm9<def> = copy %xmm2
771 // ...
772 // %xmm2<def> = copy %xmm0
773 // ...
774 // %xmm2<def> = copy %xmm9
Geoff Berry51f52c42017-08-17 23:06:55 +0000775 ClobberRegister(DefClobber);
Matthias Braun82e7f4d2017-02-04 02:27:20 +0000776 for (const MachineOperand &MO : MI->implicit_operands()) {
777 if (!MO.isReg() || !MO.isDef())
778 continue;
Geoff Berry51f52c42017-08-17 23:06:55 +0000779 unsigned Reg = getFullPhysReg(MO);
Matthias Braun82e7f4d2017-02-04 02:27:20 +0000780 if (!Reg)
781 continue;
782 ClobberRegister(Reg);
783 }
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000784
785 // Remember Def is defined by the copy.
Chad Rosierabdb1d62013-05-22 23:17:36 +0000786 for (MCSubRegIterator SR(Def, TRI, /*IncludeSelf=*/true); SR.isValid();
787 ++SR) {
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000788 CopyMap[*SR] = MI;
789 AvailCopyMap[*SR] = MI;
790 }
791
792 // Remember source that's copied to Def. Once it's clobbered, then
793 // it's no longer available for copy propagation.
Geoff Berry51f52c42017-08-17 23:06:55 +0000794 RegList &DestList = SrcMap[SrcClobber];
795 if (!is_contained(DestList, DefClobber))
796 DestList.push_back(DefClobber);
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000797
798 continue;
799 }
800
Geoff Berry51f52c42017-08-17 23:06:55 +0000801 // Clobber any earlyclobber regs first.
802 for (const MachineOperand &MO : MI->operands())
803 if (MO.isReg() && MO.isEarlyClobber()) {
804 unsigned Reg = getFullPhysReg(MO);
805 // If we have a tied earlyclobber, that means it is also read by this
806 // instruction, so we need to make sure we don't remove it as dead
807 // later.
808 if (MO.isTied())
809 ReadRegister(Reg);
810 ClobberRegister(Reg);
811 }
812
813 forwardUses(*MI);
814
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000815 // Not a copy.
816 SmallVector<unsigned, 2> Defs;
Matthias Braun273575d2016-02-20 03:56:36 +0000817 const MachineOperand *RegMask = nullptr;
818 for (const MachineOperand &MO : MI->operands()) {
Jakob Stoklund Olesen8610a592012-02-08 22:37:35 +0000819 if (MO.isRegMask())
Matthias Braun273575d2016-02-20 03:56:36 +0000820 RegMask = &MO;
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000821 if (!MO.isReg())
822 continue;
Geoff Berry51f52c42017-08-17 23:06:55 +0000823 unsigned Reg = getFullPhysReg(MO);
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000824 if (!Reg)
825 continue;
826
Geoff Berry51f52c42017-08-17 23:06:55 +0000827 if (MO.isDef() && !MO.isEarlyClobber()) {
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000828 Defs.push_back(Reg);
829 continue;
Matthias Braun82e7f4d2017-02-04 02:27:20 +0000830 } else if (MO.readsReg())
831 ReadRegister(Reg);
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000832 }
833
Jakob Stoklund Olesen8610a592012-02-08 22:37:35 +0000834 // The instruction has a register mask operand which means that it clobbers
Matthias Braune39ff702016-02-26 03:18:50 +0000835 // a large set of registers. Treat clobbered registers the same way as
836 // defined registers.
Matthias Braun273575d2016-02-20 03:56:36 +0000837 if (RegMask) {
Jakob Stoklund Olesen938b4d22012-02-09 00:19:08 +0000838 // Erase any MaybeDeadCopies whose destination register is clobbered.
Jun Bum Lim36c53fe2016-03-25 21:15:35 +0000839 for (SmallSetVector<MachineInstr *, 8>::iterator DI =
840 MaybeDeadCopies.begin();
841 DI != MaybeDeadCopies.end();) {
842 MachineInstr *MaybeDead = *DI;
Matthias Braun273575d2016-02-20 03:56:36 +0000843 unsigned Reg = MaybeDead->getOperand(0).getReg();
844 assert(!MRI->isReserved(Reg));
Jun Bum Lim36c53fe2016-03-25 21:15:35 +0000845
846 if (!RegMask->clobbersPhysReg(Reg)) {
847 ++DI;
Jakob Stoklund Olesen938b4d22012-02-09 00:19:08 +0000848 continue;
Jun Bum Lim36c53fe2016-03-25 21:15:35 +0000849 }
850
James Molloyd787d3e2014-01-22 09:12:27 +0000851 DEBUG(dbgs() << "MCP: Removing copy due to regmask clobbering: ";
Matthias Braun273575d2016-02-20 03:56:36 +0000852 MaybeDead->dump());
Jun Bum Lim36c53fe2016-03-25 21:15:35 +0000853
854 // erase() will return the next valid iterator pointing to the next
855 // element after the erased one.
856 DI = MaybeDeadCopies.erase(DI);
Matthias Braun273575d2016-02-20 03:56:36 +0000857 MaybeDead->eraseFromParent();
Jakob Stoklund Olesen938b4d22012-02-09 00:19:08 +0000858 Changed = true;
859 ++NumDeletes;
860 }
Matthias Braune39ff702016-02-26 03:18:50 +0000861
862 removeClobberedRegsFromMap(AvailCopyMap, *RegMask);
863 removeClobberedRegsFromMap(CopyMap, *RegMask);
864 for (SourceMap::iterator I = SrcMap.begin(), E = SrcMap.end(), Next;
865 I != E; I = Next) {
866 Next = std::next(I);
867 if (RegMask->clobbersPhysReg(I->first)) {
868 removeRegsFromMap(AvailCopyMap, I->second, *TRI);
869 SrcMap.erase(I);
870 }
871 }
Jakob Stoklund Olesen8610a592012-02-08 22:37:35 +0000872 }
873
Matthias Braune39ff702016-02-26 03:18:50 +0000874 // Any previous copy definition or reading the Defs is no longer available.
Matthias Braun9dcd65f2016-02-26 03:18:55 +0000875 for (unsigned Reg : Defs)
Matthias Braune39ff702016-02-26 03:18:50 +0000876 ClobberRegister(Reg);
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000877 }
878
879 // If MBB doesn't have successors, delete the copies whose defs are not used.
880 // If MBB does have successors, then conservative assume the defs are live-out
881 // since we don't want to trust live-in lists.
882 if (MBB.succ_empty()) {
Matthias Braun273575d2016-02-20 03:56:36 +0000883 for (MachineInstr *MaybeDead : MaybeDeadCopies) {
Geoff Berry51f52c42017-08-17 23:06:55 +0000884 DEBUG(dbgs() << "MCP: Removing copy due to no live-out succ: ";
885 MaybeDead->dump());
Matthias Braun273575d2016-02-20 03:56:36 +0000886 assert(!MRI->isReserved(MaybeDead->getOperand(0).getReg()));
887 MaybeDead->eraseFromParent();
888 Changed = true;
889 ++NumDeletes;
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000890 }
891 }
892
Matthias Braunbd18d752016-02-20 03:56:39 +0000893 MaybeDeadCopies.clear();
894 AvailCopyMap.clear();
895 CopyMap.clear();
896 SrcMap.clear();
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000897}
898
899bool MachineCopyPropagation::runOnMachineFunction(MachineFunction &MF) {
Andrew Kayloraa641a52016-04-22 22:06:11 +0000900 if (skipFunction(*MF.getFunction()))
Paul Robinson7c99ec52014-03-31 17:43:35 +0000901 return false;
902
Matthias Braunbd18d752016-02-20 03:56:39 +0000903 Changed = false;
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000904
Eric Christopherfc6de422014-08-05 02:39:49 +0000905 TRI = MF.getSubtarget().getRegisterInfo();
906 TII = MF.getSubtarget().getInstrInfo();
Jakob Stoklund Olesenc30a9af2012-10-15 21:57:41 +0000907 MRI = &MF.getRegInfo();
Geoff Berry51f52c42017-08-17 23:06:55 +0000908 this->MF = &MF;
909 if (PreRegRewrite) {
910 Indexes = &getAnalysis<SlotIndexes>();
911 LIS = &getAnalysis<LiveIntervals>();
912 VRM = &getAnalysis<VirtRegMap>();
913 }
914 NoSubRegLiveness = !MRI->subRegLivenessEnabled();
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000915
Matthias Braun273575d2016-02-20 03:56:36 +0000916 for (MachineBasicBlock &MBB : MF)
Matthias Braunbd18d752016-02-20 03:56:39 +0000917 CopyPropagateBlock(MBB);
Evan Cheng00b1a3c2012-01-07 03:02:36 +0000918
919 return Changed;
920}