This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Fix hashing for RegMask operands.
Changes PlannedPublic

Authored by efriedma on Nov 25 2019, 3:17 PM.

Details

Reviewers
arsenm
Summary

The code was hashing a pointer to the mask, not the mask itself.

The critical change here is the change to hash_value in MachineOperand.cpp; the other changes are just to pass around the size of the mask.

I'm not sure if this fixes any visible issues in the places hashing is currently used; this was found by inspection while looking into D61975.

Diff Detail

Event Timeline

efriedma created this revision.Nov 25 2019, 3:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 25 2019, 3:18 PM
arsenm added a comment.Dec 2 2019, 7:49 AM

I think the way register masks are used, the pointer value is almost OK. The typical case is a tablgenerated target constant, which will be a unique address. The IPRA case does use non-constants, and I don't think it tries to unique them (although I suppose it could)

llvm/unittests/CodeGen/MachineOperandTest.cpp
416–418

These should use EXPECT

The typical case is a tablgenerated target constant, which will be a unique address.

Are tablegen'ed constants guaranteed to be unique, or does it depend on the way each target writes its TableGen files?

(although I suppose it could)

Do you think this is worth doing?

arsenm added a comment.Jan 9 2020, 3:15 PM

The typical case is a tablgenerated target constant, which will be a unique address.

Are tablegen'ed constants guaranteed to be unique, or does it depend on the way each target writes its TableGen files?

I don't think these will be value unique. The dynamic RegMask case used for IPRA throws this away

(although I suppose it could)

Do you think this is worth doing?

Might as well fix it, but I doubt it's possible to really break anything with this

efriedma planned changes to this revision.Mar 16 2020, 9:10 PM