fix for PR20354 - Miscompile of fabs due to vectorization
authorSanjay Patel <spatel@rotateright.com>
Sun, 3 Aug 2014 22:48:23 +0000 (22:48 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sun, 3 Aug 2014 22:48:23 +0000 (22:48 +0000)
commit0f2bc4912655cd2d6aa276623ee21cf15ae42c5b
treeee8250a1fbd783cbfb45775002c9bff81dbb497e
parent48e1bd7287c9eb799cf0031b374ea1fe4f0c08c6
fix for PR20354 - Miscompile of fabs due to vectorization

This is intended to be 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214670 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/vec_fabs.ll