This is an archive of the discontinued LLVM Phabricator instance.

Address feedback in https://reviews.llvm.org/D133637
ClosedPublic

Authored by yozhu on Sep 12 2022, 10:55 PM.

Details

Summary

https://reviews.llvm.org/D133637 fixes the problem where we should hash raw content of
register mask instead of the pointer to it.

Fix the same issue in llvm::hash_value().

Remove the added API MachineOperand::getRegMaskSize() to avoid potential confusion.

Add an assert to emphasize that we probably should hash a machine operand iff it has
associated machine function, but keep the fallback logic in the original change.

Diff Detail

Event Timeline

yozhu created this revision.Sep 12 2022, 10:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2022, 10:55 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
yozhu requested review of this revision.Sep 12 2022, 10:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2022, 10:55 PM
yozhu edited the summary of this revision. (Show Details)Sep 12 2022, 10:59 PM
yozhu added reviewers: efriedma, kyulee, MatzeB, smeenai.
yozhu updated this revision to Diff 459800.Sep 13 2022, 10:33 AM

Make clang-format happy.

ellis added a subscriber: ellis.Sep 13 2022, 12:09 PM
ellis added inline comments.
llvm/lib/CodeGen/MachineOperand.cpp
396

I find it a bit strange that we are failing an assert but still returning something. Is this better suited for llvm_unreachable()?

MatzeB accepted this revision.Sep 13 2022, 1:14 PM

LGTM, thanks

llvm/lib/CodeGen/MachineOperand.cpp
329
387–388
llvm/lib/CodeGen/MachineStableHash.cpp
127
This revision is now accepted and ready to land.Sep 13 2022, 1:14 PM
yozhu added inline comments.Sep 13 2022, 1:29 PM
llvm/lib/CodeGen/MachineOperand.cpp
396

The assert() is mainly to get people's attention if a machine operand is hashed when it is not associated with any machine function (since later when it gets associated with a machine function, the hash value, if calculated again, would be different). But we are not sure if the above scenario is absolutely invalid or no one is actually using this, so we made the code still return something (at least the Release build will work if the scenario does exist).

yozhu updated this revision to Diff 459875.Sep 13 2022, 2:30 PM

Use static member function MachineOperand::getRegMaskSize() instead of
duplicating the logic in code.

yozhu marked 3 inline comments as done.Sep 13 2022, 2:31 PM
This revision was automatically updated to reflect the committed changes.