diff options
| author | Nadav Rotem <nrotem@apple.com> | 2012-08-30 11:23:20 +0000 |
|---|---|---|
| committer | Nadav Rotem <nrotem@apple.com> | 2012-08-30 11:23:20 +0000 |
| commit | d5f5777b773986aeda4f3bad5025805bf96b8721 (patch) | |
| tree | 53b14cc78c6c3fec069a0e9b4598b12121a0ff58 /llvm/lib/Transforms | |
| parent | ca9f384ff83d7d0f6c97a9228e88217747a9af45 (diff) | |
| download | bcm5719-llvm-d5f5777b773986aeda4f3bad5025805bf96b8721.tar.gz bcm5719-llvm-d5f5777b773986aeda4f3bad5025805bf96b8721.zip | |
It is illegal to transform (sdiv (ashr X c1) c2) -> (sdiv x (2^c1 * c2)),
because C always rounds towards zero.
Thanks Dirk and Ben.
llvm-svn: 162899
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index 2119115ca71..003dc55a03f 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -543,16 +543,6 @@ Instruction *InstCombiner::visitSDiv(BinaryOperator &I) { ConstantExpr::getNeg(RHS)); } - // Sdiv ((Ashl x, C1) , C2) -> x / (C2 * 1<<C1); - if (ConstantInt *C2 = dyn_cast<ConstantInt>(Op1)) { - Value *X; - ConstantInt *C1; - if (match(Op0, m_AShr(m_Value(X), m_ConstantInt(C1)))) { - APInt NC = C2->getValue().shl(C1->getLimitedValue(C1->getBitWidth()-1)); - return BinaryOperator::CreateSDiv(X, Builder->getInt(NC)); - } - } - // If the sign bits of both operands are zero (i.e. we can prove they are // unsigned inputs), turn this into a udiv. if (I.getType()->isIntegerTy()) { |

