Skip to content

Commit 30e2e1b

Browse files
committed
[HashRecognize] Add call.sb.check test
1 parent 886b494 commit 30e2e1b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,3 +1215,29 @@ exit: ; preds = %loop
12151215
}
12161216

12171217
declare void @print(i16)
1218+
1219+
define i16 @not.crc.call.sb.check(i16 %crc.init) {
1220+
; CHECK-LABEL: 'not.crc.call.sb.check'
1221+
; CHECK-NEXT: Did not find a hash algorithm
1222+
; CHECK-NEXT: Reason: Found stray unvisited instructions
1223+
;
1224+
entry:
1225+
br label %loop
1226+
1227+
loop: ; preds = %loop, %entry
1228+
%iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
1229+
%crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]
1230+
%crc.shl = shl i16 %crc, 1
1231+
%crc.xor = xor i16 %crc.shl, 4129
1232+
%call = call i16 @side.effect()
1233+
%check.sb = icmp slt i16 %call, 0
1234+
%crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl
1235+
%iv.next = add nuw nsw i32 %iv, 1
1236+
%exit.cond = icmp samesign ult i32 %iv, 7
1237+
br i1 %exit.cond, label %loop, label %exit
1238+
1239+
exit: ; preds = %loop
1240+
ret i16 %crc.next
1241+
}
1242+
1243+
declare i16 @side.effect()

0 commit comments

Comments
 (0)