[llvm] ac55688 - llvm-reduce: Add test for token handling in operands-skip (#133857)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 1 08:17:48 PDT 2025


Author: Matt Arsenault
Date: 2025-04-01T22:17:44+07:00
New Revision: ac55688482637ce625edaa8a25ad6eced8992a22

URL: https://github.com/llvm/llvm-project/commit/ac55688482637ce625edaa8a25ad6eced8992a22
DIFF: https://github.com/llvm/llvm-project/commit/ac55688482637ce625edaa8a25ad6eced8992a22.diff

LOG: llvm-reduce: Add test for token handling in operands-skip (#133857)

Seems to work correctly but wasn't tested.

Added: 
    llvm/test/tools/llvm-reduce/reduce-operands-skip-token.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-reduce/reduce-operands-skip-token.ll b/llvm/test/tools/llvm-reduce/reduce-operands-skip-token.ll
new file mode 100644
index 0000000000000..1202974333b5b
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/reduce-operands-skip-token.ll
@@ -0,0 +1,27 @@
+; Check token values are correctly handled by operands-skip
+
+; 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
+; RUN: FileCheck -check-prefix=RESULT %s < %t
+
+; INTERESTING-LABEL: define void @tokens(
+; INTERESTING: call void @llvm.token.consumer
+
+; RESULT-LABEL: define void @tokens(ptr %ptr) {
+; RESULT-NEXT: %token = call token @llvm.token.producer()
+; RESULT-NEXT:store i32 0, ptr %ptr, align 4
+; RESULT-NEXT:%chain = call token @llvm.token.chain(token %token)
+; RESULT-NEXT:call void @llvm.token.consumer(token %token)
+; RESULT-NEXT:store i32 1, ptr %ptr, align 4
+; RESULT-NEXT:ret void
+define void @tokens(ptr %ptr) {
+  %token = call token @llvm.token.producer()
+  store i32 0, ptr %ptr
+  %chain = call token @llvm.token.chain(token %token)
+  call void @llvm.token.consumer(token %chain) ; -> rewrite to use %token directly
+  store i32 1, ptr %ptr
+  ret void
+}
+
+declare token @llvm.token.producer()
+declare token @llvm.token.chain(token)
+declare void @llvm.token.consumer(token)


        


More information about the llvm-commits mailing list