This is an archive of the discontinued LLVM Phabricator instance.

Avoid generating FGETSIGN for f16
ClosedPublic

Authored by scanon on Jul 18 2018, 4:59 PM.

Details

Summary

Current SimplifyDemandedBits attempts to generate FGETSIGN from a bitcast of f16->i16 that only wants the signbit. That on its own is fine, except that we end up producing a bad shift node downstream. If we fix *that*, we'll run into issues legalizing the FGETSIGN in such a way that we don't end up right back with a bitcast followed by a shift, which is what we started with.

So. Instead simply skip out if we have a f16, which is the same thing we do for f128. This maybe isn't ideal, but it fixes the immediate problem (a crash) and a long-term right fix is somewhat non-obvious, so this will do fine.

https://bugs.llvm.org/show_bug.cgi?id=38038

Diff Detail

Repository
rL LLVM

Event Timeline

scanon created this revision.Jul 18 2018, 4:59 PM
scanon updated this revision to Diff 156187.Jul 18 2018, 5:22 PM
scanon edited the summary of this revision. (Show Details)
ab accepted this revision.Jul 19 2018, 1:39 PM

LGTM. Not the biggest fan of CodeGen/Generic tests, but it gets the job done, I suppose ;) I wouldn't be surprised if it failed on some target that can't even handle half parameters, so you might want to load it instead, put it in x86, or wait and see - your pick.

This revision is now accepted and ready to land.Jul 19 2018, 1:39 PM
In D49524#1168723, @ab wrote:

I wouldn't be surprised if it failed on some target that can't even handle half parameters

This is a good point. I'll fix this somehow before committing.

This revision was automatically updated to reflect the committed changes.