diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-01-28 00:58:18 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-01-28 00:58:18 +0000 |
| commit | 710b441174a8b065ef62c425228f4f6f0360134e (patch) | |
| tree | e30e3beac062c0c3af4ccf47197bf0ce5b611576 /llvm/lib/Transforms | |
| parent | 2f2427e5aa6c9a4780b287832ae9def8104ecced (diff) | |
| download | bcm5719-llvm-710b441174a8b065ef62c425228f4f6f0360134e.tar.gz bcm5719-llvm-710b441174a8b065ef62c425228f4f6f0360134e.zip | |
Fix PR1932 by disabling an xform invalid for fdiv.
llvm-svn: 46429
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 49f1c45f395..5ba48572a5d 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2494,14 +2494,15 @@ Instruction *InstCombiner::commonDivTransforms(BinaryOperator &I) { if (isa<UndefValue>(Op1)) return ReplaceInstUsesWith(I, Op1); - // Handle cases involving: div X, (select Cond, Y, Z) + // Handle cases involving: [su]div X, (select Cond, Y, Z) + // This does not apply for fdiv. if (SelectInst *SI = dyn_cast<SelectInst>(Op1)) { - // div X, (Cond ? 0 : Y) -> div X, Y. If the div and the select are in the - // same basic block, then we replace the select with Y, and the condition - // of the select with false (if the cond value is in the same BB). If the - // select has uses other than the div, this allows them to be simplified - // also. Note that div X, Y is just as good as div X, 0 (undef) - if (Constant *ST = dyn_cast<Constant>(SI->getOperand(1))) + // [su]div X, (Cond ? 0 : Y) -> div X, Y. If the div and the select are in + // the same basic block, then we replace the select with Y, and the + // condition of the select with false (if the cond value is in the same BB). + // If the select has uses other than the div, this allows them to be + // simplified also. Note that div X, Y is just as good as div X, 0 (undef) + if (ConstantInt *ST = dyn_cast<ConstantInt>(SI->getOperand(1))) if (ST->isNullValue()) { Instruction *CondI = dyn_cast<Instruction>(SI->getOperand(0)); if (CondI && CondI->getParent() == I.getParent()) @@ -2513,8 +2514,8 @@ Instruction *InstCombiner::commonDivTransforms(BinaryOperator &I) { return &I; } - // Likewise for: div X, (Cond ? Y : 0) -> div X, Y - if (Constant *ST = dyn_cast<Constant>(SI->getOperand(2))) + // Likewise for: [su]div X, (Cond ? Y : 0) -> div X, Y + if (ConstantInt *ST = dyn_cast<ConstantInt>(SI->getOperand(2))) if (ST->isNullValue()) { Instruction *CondI = dyn_cast<Instruction>(SI->getOperand(0)); if (CondI && CondI->getParent() == I.getParent()) |

