This is an archive of the discontinued LLVM Phabricator instance.

Minimal fix for PR20354 - Miscompile of fabs due to vectorization
ClosedPublic

Authored by spatel on Aug 3 2014, 3:36 PM.

Details

Summary

I think this is the minimal change needed to fix PR20354 ( http://llvm.org/bugs/show_bug.cgi?id=20354 ). The check for a vector operation was wrong; we need to check that the fabs itself is not a vector operation.

This patch will not generate the optimal code. A constant pool load and 'and' op will be generated instead of just returning a value that we can calculate in advance (as we do for the scalar case). I've put a 'TODO' comment for that here and expect to have that patch ready soon.

There is a very similar optimization that we can do in visitFNEG, so I've put another 'TODO' there and expect to have another patch for that too.

Diff Detail

Event Timeline

spatel updated this revision to Diff 12148.Aug 3 2014, 3:36 PM
spatel retitled this revision from to Minimal fix for PR20354 - Miscompile of fabs due to vectorization.
spatel updated this object.
spatel edited the test plan for this revision. (Show Details)
spatel added reviewers: pete, chandlerc, rengolin.
spatel added a subscriber: Unknown Object (MLST).
pete edited edge metadata.Aug 3 2014, 3:44 PM

Hi Sanjay

Thanks for spinning this off in to its own fix. LGTM.

Pete

spatel accepted this revision.Aug 3 2014, 4:02 PM
spatel added a reviewer: spatel.

Thanks for the rapid review, Pete.

I forgot to add the magic tag to the svn checkin comment. Fix checked in at r214670.

This revision is now accepted and ready to land.Aug 3 2014, 4:02 PM
spatel closed this revision.Aug 3 2014, 4:03 PM
spatel added a comment.Aug 3 2014, 4:33 PM

The test case caused buildbot failures because some platforms have a leading '.' when referencing the const pool labels.
Hopefully, that's fixed with:
http://llvm.org/viewvc/llvm-project?view=revision&revision=214674

Note that this testcase will have to be changed when the optimization to avoid const pool loads is added.