OSDN Git Service

[DAGCombine] Remove the getNegatibleCost to avoid the out of sync with getNegatedExpr...
authorQingShan Zhang <qshanz@cn.ibm.com>
Wed, 20 May 2020 02:11:16 +0000 (02:11 +0000)
committerQingShan Zhang <qshanz@cn.ibm.com>
Wed, 20 May 2020 02:12:16 +0000 (02:12 +0000)
commit2b59e9f1bdd8d0f8a315f9ddba2cdc87a3e682fb
tree2ba578e11debf93733de5050eb66679bce5a1836
parent92577e6a0f7380f91387c04106b8aed0fe40cc8b
[DAGCombine] Remove the getNegatibleCost to avoid the out of sync with getNegatedExpression

We have the getNegatibleCost/getNegatedExpression to evaluate the cost and negate the expression.
However, during negating the expression, the cost might change as we are changing the DAG,
and then, hit the assertion if we negated the wrong expression as the cost is not trustful anymore.

This patch is target to remove the getNegatibleCost to avoid the out of sync with getNegatedExpression,
and check the cost during negating the expression. It also reduce the duplicated code between
getNegatibleCost and getNegatedExpression. And fix the crash for the test in D76638

Reviewed By: RKSimon, spatel

Differential Revision: https://reviews.llvm.org/D77319
llvm/include/llvm/CodeGen/TargetLowering.h
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.h
llvm/test/CodeGen/X86/neg_fp.ll