diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-07-06 07:11:42 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-07-06 07:11:42 +0000 |
| commit | 98c6bdf2518358a1acade0aafc117c6343e05e4d (patch) | |
| tree | 7335d777b40af923f8fd31a127843455fed07b96 | |
| parent | 7fd5f0745a6e9649c2d6a9e50566975b8adb9384 (diff) | |
| download | bcm5719-llvm-98c6bdf2518358a1acade0aafc117c6343e05e4d.tar.gz bcm5719-llvm-98c6bdf2518358a1acade0aafc117c6343e05e4d.zip | |
Fix a minor bug where we would go into infinite loops on some constants
llvm-svn: 14638
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index fad2730d84c..be1111fbd53 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -846,7 +846,8 @@ Instruction *InstCombiner::visitDiv(BinaryOperator &I) { Instruction *InstCombiner::visitRem(BinaryOperator &I) { if (I.getType()->isSigned()) if (Value *RHSNeg = dyn_castNegVal(I.getOperand(1))) - if (RHSNeg != I.getOperand(1)) { // Avoid problems with MININT + if (!isa<ConstantSInt>(RHSNeg) || + cast<ConstantSInt>(RHSNeg)->getValue() >= 0) { // X % -Y -> X % Y AddUsesToWorkList(I); I.setOperand(1, RHSNeg); |

