Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Utils/PredicateInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ class PredicateInfoAnnotatedWriter : public AssemblyAnnotationWriter {
OS << "]";
} else if (const auto *PS = dyn_cast<PredicateSwitch>(PI)) {
OS << "; switch predicate info { CaseValue: " << *PS->CaseValue
<< " Switch:" << *PS->Switch << " Edge: [";
<< " Edge: [";
PS->From->printAsOperand(OS);
OS << ",";
PS->To->printAsOperand(OS);
Expand Down
20 changes: 7 additions & 13 deletions llvm/test/Transforms/Util/PredicateInfo/condprop.ll
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,13 @@ define void @test4(i1 %b, i32 %x) {
; CHECK-LABEL: @test4(
; CHECK-NEXT: br i1 [[B:%.*]], label [[SW:%.*]], label [[CASE3:%.*]]
; CHECK: sw:
; CHECK: i32 0, label [[CASE0:%.*]]
; CHECK-NEXT: i32 1, label [[CASE1:%.*]]
; CHECK-NEXT: i32 2, label [[CASE0]]
; CHECK-NEXT: i32 3, label [[CASE3]]
; CHECK-NEXT: i32 4, label [[DEFAULT:%.*]]
; CHECK-NEXT: ] Edge: [label [[SW]],label %case1], RenamedOp: [[X:%.*]] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't use UTC to generate check lines... All outputs from -passes=print-predicateinfo are dropped :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is basically just checking bitcast placement.

It would be nice to add support to UTC for testing annotated IR -- this would also be useful for MemorySSA tests. Probably just a matter of not stripping line comments in the function?

Copy link
Contributor Author

@Camsyn Camsyn Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outputs from -passes=print-predicateinfo consist of TWO parts:

  1. Annotation of predicate info as comments
  2. no-op bitcasts

The UTC would drop all comments, i.e., the annotation part :(
However, it's too annoying to hand-write IR checks for such a big testcase.
Maybe we can add a new feature for UTC to let it check the generated comments? @dtcxzyw

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is basically just checking bitcast placement.

It would be nice to add support to UTC for testing annotated IR -- this would also be useful for MemorySSA tests. Probably just a matter of not stripping line comments in the function?

I will try to support this new feature.

; CHECK-NEXT: [[X_0:%.*]] = bitcast i32 [[X]] to i32
; CHECK-NEXT: switch i32 [[X]], label [[DEFAULT]] [
; CHECK-NEXT: i32 0, label [[CASE0]]
; CHECK-NEXT: i32 1, label [[CASE1]]
; CHECK-NEXT: i32 2, label [[CASE0]]
; CHECK-NEXT: i32 3, label [[CASE3]]
; CHECK-NEXT: i32 4, label [[DEFAULT]]
; CHECK: [[X_0:%.*]] = bitcast i32 [[X:%.*]] to i32
; CHECK-NEXT: switch i32 [[X]], label [[DEFAULT:%.*]] [
; CHECK-NEXT: i32 0, label [[CASE0:%.*]]
; CHECK-NEXT: i32 1, label [[CASE1:%.*]]
; CHECK-NEXT: i32 2, label [[CASE0]]
; CHECK-NEXT: i32 3, label [[CASE3]]
; CHECK-NEXT: i32 4, label [[DEFAULT]]
; CHECK-NEXT: ]
; CHECK: default:
; CHECK-NEXT: call void @bar(i32 [[X]])
Expand Down