Skip to content

Commit a9e2dbc

Browse files
committed
[HashRecognize] Fix excess.tc coverage
1 parent 0d22e28 commit a9e2dbc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ exit: ; preds = %loop
696696
ret i16 %crc.next
697697
}
698698

699-
define i16 @not.crc.excess.tc(i16 %msg, i16 %checksum) {
699+
define i16 @not.crc.excess.tc(i8 %msg, i16 %checksum) {
700700
; CHECK-LABEL: 'not.crc.excess.tc'
701701
; CHECK-NEXT: Did not find a hash algorithm
702702
; CHECK-NEXT: Reason: Loop iterations exceed bitwidth of data
@@ -707,16 +707,17 @@ entry:
707707
loop: ; preds = %loop, %entry
708708
%iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]
709709
%crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]
710-
%data = phi i16 [ %msg, %entry ], [ %data.next, %loop ]
711-
%xor.crc.data = xor i16 %crc, %data
712-
%and.crc.data = and i16 %xor.crc.data, 1
713-
%data.next = lshr i16 %data, 1
714-
%check.sb = icmp eq i16 %and.crc.data, 0
710+
%data = phi i8 [ %msg, %entry ], [ %data.next, %loop ]
711+
%crc.trunc = trunc i16 %crc to i8
712+
%xor.crc.data = xor i8 %crc.trunc, %data
713+
%and.crc.data = and i8 %xor.crc.data, 1
714+
%data.next = lshr i8 %data, 1
715+
%check.sb = icmp eq i8 %and.crc.data, 0
715716
%crc.lshr = lshr i16 %crc, 1
716717
%crc.xor = xor i16 %crc.lshr, -24575
717718
%crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %crc.xor
718719
%iv.next = add nuw nsw i8 %iv, 1
719-
%exit.cond = icmp samesign ult i8 %iv, 31
720+
%exit.cond = icmp samesign ult i8 %iv, 15
720721
br i1 %exit.cond, label %loop, label %exit
721722

722723
exit: ; preds = %loop

0 commit comments

Comments
 (0)