Don't expand sdiv by power of two before legalize, since it will likely

generate illegal nodes.

llvm-svn: 26261
This commit is contained in:
Nate Begeman 2006-02-17 07:26:20 +00:00
parent 07a2677e43
commit 57b3567552
1 changed files with 2 additions and 2 deletions

View File

@ -731,8 +731,8 @@ SDOperand DAGCombiner::visitSDIV(SDNode *N) {
if (TLI.MaskedValueIsZero(N1, SignBit) &&
TLI.MaskedValueIsZero(N0, SignBit))
return DAG.getNode(ISD::UDIV, N1.getValueType(), N0, N1);
// fold (sdiv X, pow2) -> simple ops.
if (N1C && N1C->getValue() && !TLI.isIntDivCheap() &&
// fold (sdiv X, pow2) -> simple ops after legalize
if (N1C && N1C->getValue() && !TLI.isIntDivCheap() && AfterLegalize &&
(isPowerOf2_64(N1C->getSignExtended()) ||
isPowerOf2_64(-N1C->getSignExtended()))) {
// If dividing by powers of two is cheap, then don't perform the following