This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Disable a GCC optimization when building LLVM for MIPS
ClosedPublic

Authored by sdardis on Jun 12 2018, 3:16 AM.

Details

Summary

GCC when compiling LLVM for MIPS can introduce a jump to an uninitialized value
when shrink wrapping is enabled. As shrink wrapping is enabled in GCC at all
optimization levels, it must be disabled. This bug exists for all versions of
GCC since 4.9.2.

This partially resolves PR37701 / GCC PR target/86069.

Diff Detail

Event Timeline

sdardis created this revision.Jun 12 2018, 3:16 AM
emaste added a subscriber: emaste.Nov 25 2018, 7:34 AM

I think this is reasonable.

Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2019, 4:08 AM
Herald added a subscriber: jdoerfert. · View Herald Transcript

Is there a specific version range of GCC that this miscompile occurs with?

Is there a specific version range of GCC that this miscompile occurs with?

Based on activity in the listed GCC PR/target there's been no activity on fixing the bug. GCC 4.9.2 was the version I had to hand when I posted this patch.

Looking at the blame history and a read through the GCC mailing lists shows that the current 'ghost gp' instruction implementation have been present on GCC trunk since Sept, 2009. So that'd probably mean every version since 4.5 could be affected. Older ones might not have the bug, but they're not supported for building LLVM.

I believe it would be safer to simply disable the shrink wrapping optimization outright until the issue in GCC is addressed.

beanz accepted this revision.Apr 26 2019, 3:00 PM

Seems reasonable to me.

This revision is now accepted and ready to land.Apr 26 2019, 3:00 PM
This revision was automatically updated to reflect the committed changes.