Skip to content

Commit a9b3303

Browse files
author
Chen Zheng
committed
Revert "[NFC] [TargetRegisterInfo] add one use check to lookThruCopyLike."
This reverts commit 3bdf450. Post commit comments need to be addressed first.
1 parent 2d89ebd commit a9b3303

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

llvm/include/llvm/CodeGen/TargetRegisterInfo.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,10 @@ class TargetRegisterInfo : public MCRegisterInfo {
410410

411411
/// Returns the original SrcReg unless it is the target of a copy-like
412412
/// operation, in which case we chain backwards through all such operations
413-
/// to the ultimate source register. If a physical register is encountered,
413+
/// to the ultimate source register. If a physical register is encountered,
414414
/// we stop the search.
415-
/// If one definition in the copy chain has multiple uses, set \p
416-
/// AllDefHaveOneUser to false, otherwise set it to true.
417415
virtual Register lookThruCopyLike(Register SrcReg,
418-
const MachineRegisterInfo *MRI,
419-
bool *AllDefHaveOneUser = nullptr) const;
416+
const MachineRegisterInfo *MRI) const;
420417

421418
/// Return a null-terminated list of all of the callee-saved registers on
422419
/// this target. The register should be in the order of desired callee-save

llvm/lib/CodeGen/TargetRegisterInfo.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -510,19 +510,13 @@ TargetRegisterInfo::getRegSizeInBits(Register Reg,
510510
return getRegSizeInBits(*RC);
511511
}
512512

513-
Register TargetRegisterInfo::lookThruCopyLike(Register SrcReg,
514-
const MachineRegisterInfo *MRI,
515-
bool *AllDefHaveOneUser) const {
516-
if (AllDefHaveOneUser)
517-
*AllDefHaveOneUser = true;
518-
513+
Register
514+
TargetRegisterInfo::lookThruCopyLike(Register SrcReg,
515+
const MachineRegisterInfo *MRI) const {
519516
while (true) {
520517
const MachineInstr *MI = MRI->getVRegDef(SrcReg);
521-
if (!MI->isCopyLike()) {
522-
if (AllDefHaveOneUser && !MRI->hasOneNonDBGUse(SrcReg))
523-
*AllDefHaveOneUser = false;
518+
if (!MI->isCopyLike())
524519
return SrcReg;
525-
}
526520

527521
Register CopySrcReg;
528522
if (MI->isCopy())
@@ -532,11 +526,8 @@ Register TargetRegisterInfo::lookThruCopyLike(Register SrcReg,
532526
CopySrcReg = MI->getOperand(2).getReg();
533527
}
534528

535-
if (!CopySrcReg.isVirtual()) {
536-
if (AllDefHaveOneUser)
537-
*AllDefHaveOneUser = false;
529+
if (!CopySrcReg.isVirtual())
538530
return CopySrcReg;
539-
}
540531

541532
SrcReg = CopySrcReg;
542533
}

0 commit comments

Comments
 (0)