diff options
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index e7a1f07..d39efb2 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -9071,6 +9071,7 @@ bool llvm::matchSimpleRecurrence(const PHINode *P, BinaryOperator *&BO, // Handle the case of a simple two-predecessor recurrence PHI. // There's a lot more that could theoretically be done here, but // this is sufficient to catch some interesting cases. + // TODO: Expand list -- gep, uadd.sat etc. if (P->getNumIncomingValues() != 2) return false; @@ -9081,35 +9082,16 @@ bool llvm::matchSimpleRecurrence(const PHINode *P, BinaryOperator *&BO, if (!LU) continue; unsigned Opcode = LU->getOpcode(); - - switch (Opcode) { - default: - continue; - // TODO: Expand list -- xor, gep, uadd.sat etc. - case Instruction::LShr: - case Instruction::AShr: - case Instruction::Shl: - case Instruction::Add: - case Instruction::Sub: - case Instruction::UDiv: - case Instruction::URem: - case Instruction::And: - case Instruction::Or: - case Instruction::Mul: - case Instruction::FMul: { - Value *LL = LU->getOperand(0); - Value *LR = LU->getOperand(1); - // Find a recurrence. - if (LL == P) - L = LR; - else if (LR == P) - L = LL; - else - continue; // Check for recurrence with L and R flipped. - - break; // Match! - } - }; + Value *LL = LU->getOperand(0); + Value *LR = LU->getOperand(1); + + // Find a recurrence. + if (LL == P) + L = LR; + else if (LR == P) + L = LL; + else + continue; // Check for recurrence with L and R flipped. // We have matched a recurrence of the form: // %iv = [R, %entry], [%iv.next, %backedge] |