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

Repository
rL LLVM

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 ↗(On Diff #131561)

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
2 ↗(On Diff #131561)

Add -mattr=+noabicalls here.

4–7 ↗(On Diff #131561)

This metadata can be removed.

13 ↗(On Diff #131561)

This line can be removed.

14 ↗(On Diff #131561)

You can drop the 'local_unnamed_addr #0" here.

14–32 ↗(On Diff #131561)

This llvm-ir can all be simplified to:

define %struct.a* @d() {
entry:
  ret %struct.a* @b
}
34–40 ↗(On Diff #131561)

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.