-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[HashRecognize] Strip excess-TC check #157479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Checking if trip-count exceeds 256 is no longer necessary, as we have moved away from KnownBits computations to pattern-matching, which is very cheap and independent of TC.
|
@llvm/pr-subscribers-llvm-analysis Author: Ramkumar Ramachandra (artagnon) ChangesChecking if trip-count exceeds 256 is no longer necessary, as we have moved away from KnownBits computations to pattern-matching, which is very cheap and independent of TC. Full diff: https://github.com/llvm/llvm-project/pull/157479.diff 2 Files Affected:
diff --git a/llvm/lib/Analysis/HashRecognize.cpp b/llvm/lib/Analysis/HashRecognize.cpp
index 5b3448f5df35d..1b608870d28a8 100644
--- a/llvm/lib/Analysis/HashRecognize.cpp
+++ b/llvm/lib/Analysis/HashRecognize.cpp
@@ -446,7 +446,7 @@ std::variant<PolynomialInfo, StringRef> HashRecognize::recognizeCRC() const {
if (!Latch || !Exit || !IndVar || L.getNumBlocks() != 1)
return "Loop not in canonical form";
unsigned TC = SE.getSmallConstantTripCount(&L);
- if (!TC || TC > 256 || TC % 8)
+ if (!TC || TC % 8)
return "Unable to find a small constant byte-multiple trip count";
auto R = getRecurrences(Latch, IndVar, L);
diff --git a/llvm/test/Analysis/HashRecognize/cyclic-redundancy-check.ll b/llvm/test/Analysis/HashRecognize/cyclic-redundancy-check.ll
index 432a4d72fafb4..7dec2f8f96906 100644
--- a/llvm/test/Analysis/HashRecognize/cyclic-redundancy-check.ll
+++ b/llvm/test/Analysis/HashRecognize/cyclic-redundancy-check.ll
@@ -574,10 +574,10 @@ exit: ; preds = %loop
ret i16 %crc.next
}
-define i16 @not.crc.tc.limit(i16 %crc.init) {
-; CHECK-LABEL: 'not.crc.tc.limit'
+define i16 @not.crc.tc.exceeds.data.bw(i16 %crc.init) {
+; CHECK-LABEL: 'not.crc.tc.exceeds.data.bw'
; CHECK-NEXT: Did not find a hash algorithm
-; CHECK-NEXT: Reason: Unable to find a small constant byte-multiple trip count
+; CHECK-NEXT: Reason: Loop iterations exceed bitwidth of data
;
entry:
br label %loop
@@ -590,7 +590,7 @@ loop: ; preds = %loop, %entry
%check.sb = icmp slt i16 %crc, 0
%crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl
%iv.next = add nuw nsw i32 %iv, 1
- %exit.cond = icmp samesign ult i32 %iv, 512
+ %exit.cond = icmp samesign ult i32 %iv, 511
br i1 %exit.cond, label %loop, label %exit
exit: ; preds = %loop
|
pfusik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/181/builds/27441 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/116/builds/18047 Here is the relevant piece of the build log for the reference |
Checking if trip-count exceeds 256 is no longer necessary, as we have moved away from KnownBits computations to pattern-matching, which is very cheap and independent of TC.