[SDAG] Now that we have a way to communicate the exact bit on sdiv use it to simplify...
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 27 Jun 2015 20:33:26 +0000 (20:33 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 27 Jun 2015 20:33:26 +0000 (20:33 +0000)
commit45b5f7e457423d324c24bf8ebdbcad687faec2b2
tree521791e6ac523a43b416394cf06376d93d545ddf
parent6b2ae13ea345c1b5811f94614a63b07a983886b4
[SDAG] Now that we have a way to communicate the exact bit on sdiv use it to simplify sdiv by a constant.

We had a hack in SDAGBuilder in place to work around this but now we
can avoid that. Call BuildExactSDIV from BuildSDIV so DAGCombiner can
perform this trick automatically.

The added check in DAGCombiner is necessary to prevent exact sdiv by pow2
from regressing as the target-specific pow2 lowering is not aware of
exact bits yet.

This is mostly covered by existing tests. One side effect is that we
get the better lowering for exact vector sdivs now too :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240891 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/SelectionDAG/TargetLowering.cpp
test/CodeGen/X86/sdiv-exact.ll