[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Oct 8 11:17:01 PDT 2002
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.59 -> 1.60
---
Log message:
Fold ashr -1, X into -1
---
Diffs of the changes:
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.59 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.60
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.59 Tue Oct 1 17:38:41 2002
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Oct 8 11:16:40 2002
@@ -503,6 +503,12 @@
return BinaryOperator::create(Instruction::Add, Op0, Op0, I.getName());
}
+
+ // shr int -1, X = -1 (for any arithmetic shift rights of ~0)
+ if (ConstantSInt *CSI = dyn_cast<ConstantSInt>(Op0))
+ if (I.getOpcode() == Instruction::Shr && CSI->isAllOnesValue())
+ return ReplaceInstUsesWith(I, CSI);
+
return 0;
}
More information about the llvm-commits
mailing list