From: Max Kazantsev Date: Mon, 1 Mar 2021 06:22:42 +0000 (+0700) Subject: [NFC] Detect IV increment expressed as uadd_with_overflow and usub_with_overflow X-Git-Tag: llvmorg-14-init~13807 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9fac8496eae809c288096037d7a3f5a1a3d04c7a;p=platform%2Fupstream%2Fllvm.git [NFC] Detect IV increment expressed as uadd_with_overflow and usub_with_overflow Current callers do not call it with such argument, so this is NFC. But for further changes, it can be very useful to detect such cases. --- diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 2c2f667b..d87d500 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -1293,6 +1293,12 @@ getIVIncrement(const PHINode *PN, const LoopInfo *LI) { return std::make_pair(IVInc, ConstantExpr::getNeg(Step)); if (match(IVInc, m_Add(m_Specific(PN), m_Constant(Step)))) return std::make_pair(IVInc, Step); + if (match(IVInc, m_ExtractValue<0>(m_Intrinsic( + m_Specific(PN), m_Constant(Step))))) + return std::make_pair(IVInc, ConstantExpr::getNeg(Step)); + if (match(IVInc, m_ExtractValue<0>(m_Intrinsic( + m_Specific(PN), m_Constant(Step))))) + return std::make_pair(IVInc, Step); return None; }