Skip to content

Commit ac55688

Browse files
authored
llvm-reduce: Add test for token handling in operands-skip (llvm#133857)
Seems to work correctly but wasn't tested.
1 parent 664e847 commit ac55688

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
; Check token values are correctly handled by operands-skip
2+
3+
; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=operands-skip --test FileCheck --test-arg --check-prefix=INTERESTING --test-arg %s --test-arg --input-file %s -o %t
4+
; RUN: FileCheck -check-prefix=RESULT %s < %t
5+
6+
; INTERESTING-LABEL: define void @tokens(
7+
; INTERESTING: call void @llvm.token.consumer
8+
9+
; RESULT-LABEL: define void @tokens(ptr %ptr) {
10+
; RESULT-NEXT: %token = call token @llvm.token.producer()
11+
; RESULT-NEXT:store i32 0, ptr %ptr, align 4
12+
; RESULT-NEXT:%chain = call token @llvm.token.chain(token %token)
13+
; RESULT-NEXT:call void @llvm.token.consumer(token %token)
14+
; RESULT-NEXT:store i32 1, ptr %ptr, align 4
15+
; RESULT-NEXT:ret void
16+
define void @tokens(ptr %ptr) {
17+
%token = call token @llvm.token.producer()
18+
store i32 0, ptr %ptr
19+
%chain = call token @llvm.token.chain(token %token)
20+
call void @llvm.token.consumer(token %chain) ; -> rewrite to use %token directly
21+
store i32 1, ptr %ptr
22+
ret void
23+
}
24+
25+
declare token @llvm.token.producer()
26+
declare token @llvm.token.chain(token)
27+
declare void @llvm.token.consumer(token)

0 commit comments

Comments
 (0)