[PATCH] D56145: [DAGCombiner] After performing the division by constant optimization for a DIV or REM node, replace the users of the corresponding REM or DIV node if it exists.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 28 23:29:13 PST 2018


craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel, efriedma.

Currently we expand the two nodes separately. This gives DAG combiner an opportunity to optimize the expanded sequence taking into account only one set of users. When we expand the other node we'll create the expansion again, but might not be able to optimize it the same way. So the nodes won't CSE and we'll have two similarish sequences in the same basic block. By expanding both nodes at the same time we'll avoid prematurely optimizing the expansion until both the division and remainder have been replaced.

Improves the test case from PR38217. There may be additional opportunities after this.


Repository:
  rL LLVM

https://reviews.llvm.org/D56145

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/X86/divide-by-constant.ll
  test/CodeGen/X86/pr38217.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56145.179677.patch
Type: text/x-patch
Size: 4697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181229/9d5207f2/attachment-0001.bin>


More information about the llvm-commits mailing list