Page MenuHomePhabricator

[InstCombine] fneg(X + C) --> -C - X

Authored by spatel on Jan 20 2020, 10:56 AM.



This is 1 of the potential folds uncovered by extending D72521.

We don't seem to do this in the backend either (unless I'm not seeing some target-specific transform).

icc and gcc (appears to be target-specific) do this transform.

Diff Detail

Event Timeline

spatel created this revision.Jan 20 2020, 10:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2020, 10:57 AM

Nit: are lowercase variables the standard format for tests? I see that they're uppercase in the source comments.

This revision is now accepted and ready to land.Jan 21 2020, 8:21 AM
spatel marked an inline comment as done.Jan 21 2020, 10:42 AM
spatel added inline comments.

There's no official standard for tests, but most IR tests seem to use lowercase. There are even (or at least used to be) tests that mixed variables that only differed in case (%x and %X), but that's obviously not good for scripts or humans.

Source code has a standard:
(there was a recent proposal for changing variable names to be lowerCamel, but seems to have died?)

Usually, I just copy the code comment to the test file for easier grepping, so I'm not sure why I changed it here. :)
If anyone has a preference, I can update to it.

This revision was automatically updated to reflect the committed changes.