OSDN Git Service

Don't create ISD::FNEG nodes after legalize if they aren't legal.
authorDan Gohman <gohman@apple.com>
Thu, 22 Jan 2009 21:58:43 +0000 (21:58 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 22 Jan 2009 21:58:43 +0000 (21:58 +0000)
commit760f86f3395750ef6d03ecfe6f82d2867fbf568b
treebdf1046c3f79e9422ab88ada0c421ab4a687722c
parentedc4d69917df7dc34543adf719d5c93249fd5e27
Don't create ISD::FNEG nodes after legalize if they aren't legal.

Simplify x+0 to x in unsafe-fp-math mode. This avoids a bunch of
redundant work in many cases, because in unsafe-fp-math mode,
ISD::FADD with a constant is considered free to negate, so the
DAGCombiner often negates x+0 to -0-x thinking it's free, when
in reality the end result is -x, which is more expensive than x.

Also, combine x*0 to 0.

This fixes PR3374.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62789 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
test/CodeGen/X86/negate-add-zero.ll [new file with mode: 0644]