aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2006-02-17 07:26:20 +0000
committerNate Begeman <natebegeman@mac.com>2006-02-17 07:26:20 +0000
commitcd6a6ed0a9d4b63535b430bf4c5c4396cd9d4e86 (patch)
treed2f10ccb83147eb308b972ed8f4ffa3e1a2446b2
parentc2fe97e726407566871341337c3a11fa08491ab6 (diff)
downloadexternal_llvm-cd6a6ed0a9d4b63535b430bf4c5c4396cd9d4e86.zip
external_llvm-cd6a6ed0a9d4b63535b430bf4c5c4396cd9d4e86.tar.gz
external_llvm-cd6a6ed0a9d4b63535b430bf4c5c4396cd9d4e86.tar.bz2
Don't expand sdiv by power of two before legalize, since it will likely
generate illegal nodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26261 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 48bb202..4d5dcd7 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -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