This is an archive of the discontinued LLVM Phabricator instance.

[MIPS] Don't crash on unsized extern types with -mgpopt
ClosedPublic

Authored by arichardson on Jan 26 2018, 2:40 AM.

Diff Detail

Event Timeline

arichardson created this revision.Jan 26 2018, 2:40 AM

I've seen this patch in the CHERI fork, thanks for upstreaming it. Some nits inlined and can you use update_llc_test_checks.py to generate the CHECK lines?

Thanks.

lib/Target/Mips/MipsTargetObjectFile.cpp
140

Change this to: "It is possible that the type of the global is unsized, i.e. a declaration of a extern struct. In this case don't presume it is in the small data section. This happens e.g. when building the FreeBSD kernel."

test/CodeGen/Mips/unsized-global.ll
3

Add -mattr=+noabicalls here.

5–8

This metadata can be removed.

14

This line can be removed.

15

You can drop the 'local_unnamed_addr #0" here.

15–33

This llvm-ir can all be simplified to:

define %struct.a* @d() {
entry:
  ret %struct.a* @b
}
35–41

All of this can be dropped as well.

Addressed review comments

sdardis accepted this revision.Jan 26 2018, 6:33 AM

LGTM.

This revision is now accepted and ready to land.Jan 26 2018, 6:33 AM
This revision was automatically updated to reflect the committed changes.