Skip to content

Commit ad8cc68

Browse files
committed
Fix the usage issue of getRegMask.
1 parent 62cae9c commit ad8cc68

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/CodeGen/MachineOperand.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ bool MachineOperand::isIdenticalTo(const MachineOperand &Other) const {
350350
case MachineOperand::MO_RegisterMask:
351351
case MachineOperand::MO_RegisterLiveOut: {
352352
// Shallow compare of the two RegMasks
353-
const uint32_t *RegMask = getRegMask();
354-
const uint32_t *OtherRegMask = Other.getRegMask();
353+
const uint32_t *RegMask = isRegMask() ? getRegMask() : getRegLiveOut();
354+
const uint32_t *OtherRegMask = isRegMask() ? Other.getRegMask() : Other.getRegLiveOut();
355355
if (RegMask == OtherRegMask)
356356
return true;
357357

@@ -421,7 +421,7 @@ hash_code llvm::hash_value(const MachineOperand &MO) {
421421
if (const MachineFunction *MF = getMFIfAvailable(MO)) {
422422
const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo();
423423
unsigned RegMaskSize = MachineOperand::getRegMaskSize(TRI->getNumRegs());
424-
const uint32_t *RegMask = MO.getRegMask();
424+
const uint32_t *RegMask = MO.isRegMask() ? MO.getRegMask() : MO.getRegLiveOut();
425425
std::vector<stable_hash> RegMaskHashes(RegMask, RegMask + RegMaskSize);
426426
return hash_combine(MO.getType(), MO.getTargetFlags(),
427427
stable_hash_combine(RegMaskHashes));

llvm/lib/CodeGen/MachineStableHash.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ stable_hash llvm::stableHashValue(const MachineOperand &MO) {
136136
const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo();
137137
unsigned RegMaskSize =
138138
MachineOperand::getRegMaskSize(TRI->getNumRegs());
139-
const uint32_t *RegMask = MO.getRegMask();
139+
const uint32_t *RegMask = MO.isRegMask() ? MO.getRegMask() : MO.getRegLiveOut();
140140
std::vector<llvm::stable_hash> RegMaskHashes(RegMask,
141141
RegMask + RegMaskSize);
142142
return stable_hash_combine(MO.getType(), MO.getTargetFlags(),

0 commit comments

Comments
 (0)