[llvm] [UTC] Support to test annotated IR (PR #165419)
Kunqiu Chen via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 30 00:49:33 PDT 2025
================
@@ -98,11 +98,16 @@ define void @test3(i32 %x, i32 %y) {
; CHECK-NEXT: [[XZ:%.*]] = icmp eq i32 [[X:%.*]], 0
; CHECK-NEXT: [[YZ:%.*]] = icmp eq i32 [[Y:%.*]], 0
; CHECK-NEXT: [[Z:%.*]] = and i1 [[XZ]], [[YZ]]
-; CHECK: [[Z_0:%.*]] = bitcast i1 [[Z]] to i1
-; CHECK: [[XZ_0:%.*]] = bitcast i1 [[XZ]] to i1
-; CHECK: [[X_0:%.*]] = bitcast i32 [[X]] to i32
-; CHECK: [[YZ_0:%.*]] = bitcast i1 [[YZ]] to i1
-; CHECK: [[Y_0:%.*]] = bitcast i32 [[Y]] to i32
+; CHECK-NEXT: ; branch predicate info { TrueEdge: 0 Comparison: [[Z]] = and i1 [[XZ]], [[YZ]] Edge: [label [[TMP0:%.*]],label %nope], RenamedOp: [[Z]] }
----------------
Camsyn wrote:
> Maybe the wildcard is used to define `[[TMP0]]` when it first appears, and the following `[[TMP0]]]`s just reference the first definition, just like mermaid/dot grammar
I may have misunderstood earlier. If @nikic thinks that the `label %nope` in `... Edge: [label [[TMP0 :%.*]], label% nope],...` is mistakenly missing a wildcard, I think I have found the cause, not a version issue or "a missed space after the comma".
It's the incomplete variable regex `r"(\s*)(?:%([\w$.-]+?))([,\s\(\)\}]|\Z)"` that causes such an issue:
<img width="873" height="261" alt="image" src="https://github.com/user-attachments/assets/1307f0d7-4164-4136-819c-3b7795a1f3d0" />
TWO approaches to fix:
1. Change PredicateInfo's printing
2. Change the regex (maybe the regex is wrong? Why does it expect some character after a variable?)
https://github.com/llvm/llvm-project/pull/165419
More information about the llvm-commits
mailing list