[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)
commit5b455f0b62fbd0767ac4faa1cbb01f41799834a3
treeb4adbcfae0c8f3bbc5d51347195381e0ad085040
parent57c7a62b973e909c29a7da46bae11051b16a5de8
[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 :)

llvm-svn: 240891
llvm/include/llvm/Target/TargetLowering.h
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/X86/sdiv-exact.ll