aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-02 02:52:02 +0000
committerChris Lattner <sabre@nondot.org>2005-08-02 02:52:02 +0000
commit7e608bbb5dfe4f827e64e91b0bb68a1d95d737ae (patch)
tree8a77ee9bcb91fe62c5c518b6e14c832e9e5d426d /lib/Transforms
parente9100c69cbfbcc9298b663d80ef4ddf31d7bba69 (diff)
add a comment, make a check more lenient
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22581 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index a39ba6eda2..fcb7ad3dfd 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -71,6 +71,9 @@ namespace {
const TargetData *TD;
const Type *UIntPtrTy;
bool Changed;
+
+ /// MaxTargetAMSize - This is the maximum power-of-two scale value that the
+ /// target can handle for free with its addressing modes.
unsigned MaxTargetAMSize;
/// IVUsesByStride - Keep track of all uses of induction variables that we
@@ -649,15 +652,14 @@ void LoopStrengthReduce::runOnLoop(Loop *L) {
// compared against some value to decide loop termination.
if (PN->hasOneUse()) {
BinaryOperator *BO = dyn_cast<BinaryOperator>(*(PN->use_begin()));
- if (BO && BO->getOpcode() == Instruction::Add)
- if (BO->hasOneUse()) {
- if (PN == dyn_cast<PHINode>(*(BO->use_begin()))) {
- DeadInsts.insert(BO);
- // Break the cycle, then delete the PHI.
- PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
- PN->eraseFromParent();
- }
+ if (BO && BO->hasOneUse()) {
+ if (PN == *(BO->use_begin())) {
+ DeadInsts.insert(BO);
+ // Break the cycle, then delete the PHI.
+ PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
+ PN->eraseFromParent();
}
+ }
}
}
DeleteTriviallyDeadInstructions(DeadInsts);