Skip to content

Commit 982f8d8

Browse files
committed
[HashRecognize] Add test for TC % 8 != 0
1 parent 61296b6 commit 982f8d8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

llvm/test/Analysis/HashRecognize/cyclic-redundancy-check.ll

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,29 @@ exit: ; preds = %loop
404404
ret i16 %crc.next
405405
}
406406

407+
define i16 @not.crc.non.canonical.not.multiple.8(i16 %crc.init) {
408+
; CHECK-LABEL: 'not.crc.non.canonical.not.multiple.8'
409+
; CHECK-NEXT: Did not find a hash algorithm
410+
; CHECK-NEXT: Reason: Unable to find a small constant byte-multiple trip count
411+
;
412+
entry:
413+
br label %loop
414+
415+
loop: ; preds = %loop, %entry
416+
%iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
417+
%crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]
418+
%crc.shl = shl i16 %crc, 1
419+
%crc.xor = xor i16 %crc.shl, 4129
420+
%check.sb = icmp slt i16 %crc, 0
421+
%crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl
422+
%iv.next = add nuw nsw i32 %iv, 1
423+
%exit.cond = icmp samesign eq i32 %iv, 3
424+
br i1 %exit.cond, label %exit, label %loop
425+
426+
exit: ; preds = %loop
427+
ret i16 %crc.next
428+
}
429+
407430
define i16 @not.crc.non.canonical.loop.countdown(i16 %crc.init) {
408431
; CHECK-LABEL: 'not.crc.non.canonical.loop.countdown'
409432
; CHECK-NEXT: Did not find a hash algorithm

0 commit comments

Comments
 (0)