Skip to content

Commit 0d22e28

Browse files
committed
[HashRecognize] Add negative init.arg.excess.tc test
1 parent b7f1192 commit 0d22e28

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
@@ -723,6 +723,29 @@ exit: ; preds = %loop
723723
ret i16 %crc.next
724724
}
725725

726+
define i16 @not.crc.init.arg.excess.tc(i16 %crc.init) {
727+
; CHECK-LABEL: 'not.crc.init.arg.excess.tc'
728+
; CHECK-NEXT: Did not find a hash algorithm
729+
; CHECK-NEXT: Reason: Loop iterations exceed bitwidth of data
730+
;
731+
entry:
732+
br label %loop
733+
734+
loop: ; preds = %loop, %entry
735+
%iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
736+
%crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]
737+
%crc.shl = shl i16 %crc, 1
738+
%crc.xor = xor i16 %crc.shl, 4129
739+
%check.sb = icmp slt i16 %crc, 0
740+
%crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl
741+
%iv.next = add nuw nsw i32 %iv, 1
742+
%exit.cond = icmp samesign ult i32 %iv, 31
743+
br i1 %exit.cond, label %loop, label %exit
744+
745+
exit: ; preds = %loop
746+
ret i16 %crc.next
747+
}
748+
726749
define i32 @not.crc.unknown.icmp.rhs(i32 %checksum, i32 %msg, i32 %unknown) {
727750
; CHECK-LABEL: 'not.crc.unknown.icmp.rhs'
728751
; CHECK-NEXT: Did not find a hash algorithm

0 commit comments

Comments
 (0)