This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombine] Checking the cost directly to improve the code readability
ClosedPublic

Authored by steven.zhang on Apr 16 2020, 11:49 PM.

Details

Summary

This is a prerequisite patch for D77319. Now, we have to call getCheaperNegatedExpression() first, and it failed, call getNegatedExpression() again. It could be improved to call getNegatedExpression(Cost) and check the Cost to make the code more clear.

During negating the expression of N0 and N1, we are changing the DAG which change the combine order of the nodes though those negated node will be deleted immediately if combine is not profitable. And that this reason of the case change, which LGTM.

Diff Detail