Skip to content

Commit 54043da

Browse files
committed
!fixup use m_PtrAdd, thanks!
1 parent f09c575 commit 54043da

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9252,7 +9252,7 @@ bool llvm::matchSimpleRecurrence(const PHINode *P, Instruction *&BO,
92529252
switch (Opcode) {
92539253
default:
92549254
continue;
9255-
// TODO: Expand list -- xor, gep, uadd.sat etc.
9255+
// TODO: Expand list -- xor, uadd.sat etc.
92569256
case Instruction::LShr:
92579257
case Instruction::AShr:
92589258
case Instruction::Shl:
@@ -9277,12 +9277,11 @@ bool llvm::matchSimpleRecurrence(const PHINode *P, Instruction *&BO,
92779277
break; // Match!
92789278
}
92799279
case Instruction::GetElementPtr: {
9280-
if (LU->getNumOperands() != 2 ||
9281-
!cast<GetElementPtrInst>(L)->getSourceElementType()->isIntegerTy(8))
9280+
Value *LL;
9281+
Value *LR;
9282+
if (!match(L, m_PtrAdd(m_Value(LL), m_Value(LR))))
92829283
continue;
92839284

9284-
Value *LL = LU->getOperand(0);
9285-
Value *LR = LU->getOperand(1);
92869285
// Find a recurrence.
92879286
if (LL == P) {
92889287
// Found a match

0 commit comments

Comments
 (0)