This is an archive of the discontinued LLVM Phabricator instance.

Prevent vregs leaking into the MC layer via TargetRegisterClass::contains()
ClosedPublic

Authored by dsanders on Jul 31 2019, 8:44 PM.

Details

Summary

The MC layer doesn't expect to deal with vregs but
TargetRegisterClass::contains() forwards into MCRegisterClass::contains()
and this can cause vregs to turn up in the MC layer APIs. Add guards
against this to prevent this becoming a problem as we replace unsigned
with a new MCRegister object for improved type safety.

Event Timeline

dsanders created this revision.Jul 31 2019, 8:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2019, 8:44 PM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm added inline comments.Jul 31 2019, 8:51 PM
llvm/include/llvm/CodeGen/TargetRegisterInfo.h
90–91

I think this should be a hard assert. Any of the users of this almost certainly do not intend to reach this

dsanders marked an inline comment as done.Jul 31 2019, 9:19 PM
dsanders added inline comments.
llvm/include/llvm/CodeGen/TargetRegisterInfo.h
90–91

Unfortunately they do expect it at the moment. This is what happens when you make it a hard assert:

Expected Passes    : 31313
Expected Failures  : 154
Unsupported Tests  : 435
Unexpected Failures: 894

It affects Hexagon, X86, ARM, AMDGPU, and AArch64 primarily.

arsenm added inline comments.Jul 31 2019, 9:26 PM
llvm/include/llvm/CodeGen/TargetRegisterInfo.h
90–91

Should add a FIXME

dsanders updated this revision to Diff 212874.Aug 1 2019, 12:00 PM
  • add fixme
arsenm accepted this revision.Aug 1 2019, 12:15 PM

LGTM

This revision is now accepted and ready to land.Aug 1 2019, 12:15 PM
This revision was automatically updated to reflect the committed changes.