This is an archive of the discontinued LLVM Phabricator instance.

[GISel] constrain regclas for 128->64 copy
ClosedPublic

Authored by tmatheson on Aug 25 2022, 8:19 AM.

Details

Summary

When selecting G_EXTRACT to COPY for extracting a 64-bit GPR from
a 128-bit register pair (XSeqPair) we know enough to constrain the
destination register class to gpr64. Without this it may have only
a register bank and some copy elimination code would assert while
assuming that a register class existed.

The register class has to be set explicitly because we might hit the
COPY -> COPY case where register class can't be inferred.

This would cause the following to crash in selection, where the store
is commented (otherwise the store constrains the register class):

define dso_local i128 @load_atomic_i128_unordered(i128* %p) {
  %pair = cmpxchg i128* %p, i128 0, i128 0 acquire acquire
  %val = extractvalue { i128, i1 } %pair, 0
  ; store i128 %val, i128* %p
  ret i128 %val
}

Diff Detail

Event Timeline

tmatheson created this revision.Aug 25 2022, 8:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2022, 8:19 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
tmatheson requested review of this revision.Aug 25 2022, 8:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2022, 8:19 AM
tmatheson edited the summary of this revision. (Show Details)
lenary accepted this revision.Aug 25 2022, 8:32 AM
This revision is now accepted and ready to land.Aug 25 2022, 8:32 AM
This revision was automatically updated to reflect the committed changes.