Skip to content

Commit a695878

Browse files
committed
[HashRecognize] Fix some nits
1 parent 0db408f commit a695878

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

llvm/lib/Analysis/HashRecognize.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ using namespace SCEVPatternMatch;
7373

7474
#define DEBUG_TYPE "hash-recognize"
7575

76-
/// Checks that all instructions reachable from \p Roots on the use-def chain
77-
/// are contained within loop \p L, and that that are no stray instructions in
78-
/// the loop not visited by the use-def walk.
76+
/// Checks if there's a stray instruction in the loop \p L outside of the
77+
/// use-def chains from \p Roots, or if we escape the loop during the use-def
78+
/// walk.
7979
static bool containsUnreachable(const Loop &L,
8080
ArrayRef<const Instruction *> Roots) {
8181
SmallPtrSet<const Instruction *, 16> Visited;
@@ -157,8 +157,8 @@ struct RecurrenceInfo {
157157
/// compare are swapped). We check that the LHS is (ConditionalRecurrence.Phi
158158
/// [xor SimpleRecurrence.Phi]) in the big-endian case, and additionally check
159159
/// for an AND with one in the little-endian case. We then check AllowedByR
160-
/// against CheckAllowedByR, which is [0, smin) in the big-endian case, and
161-
/// against [0, 1) in the little-endian case: CheckAllowedByR checks for
160+
/// against CheckAllowedByR, which is [0, smin) in the big-endian case, and is
161+
/// [0, 1) in the little-endian case. CheckAllowedByR checks for
162162
/// significant-bit-clear, and we match the corresponding arms of the select
163163
/// against bit-shift and bit-shift-and-xor-gen-poly.
164164
static bool
@@ -196,10 +196,12 @@ isSignificantBitCheckWellFormed(const RecurrenceInfo &ConditionalRecurrence,
196196
BinaryOperator *BitShift = ConditionalRecurrence.BO;
197197
if (AllowedByR == CheckAllowedByR)
198198
return TV == BitShift &&
199-
match(FV, m_c_Xor(m_Specific(BitShift), m_Constant()));
199+
match(FV, m_c_Xor(m_Specific(BitShift),
200+
m_SpecificInt(*ConditionalRecurrence.ExtraConst)));
200201
if (AllowedByR.inverse() == CheckAllowedByR)
201202
return FV == BitShift &&
202-
match(TV, m_c_Xor(m_Specific(BitShift), m_Constant()));
203+
match(TV, m_c_Xor(m_Specific(BitShift),
204+
m_SpecificInt(*ConditionalRecurrence.ExtraConst)));
203205
return false;
204206
}
205207

0 commit comments

Comments
 (0)