[llvm] [PGO] Add ProfileInjector and ProfileVerifier passes (PR #147388)

David Li via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 7 15:59:24 PDT 2025


================
@@ -0,0 +1,19 @@
+; Test that prof-inject only injects missing metadata
+
+; RUN: opt -passes=prof-inject %s -S -o - | FileCheck %s
+
+define void @foo(i32 %i) {
+  %c = icmp eq i32 %i, 0
+  br i1 %c, label %yes, label %no, !prof !0
+yes:
+  br i1 %c, label %yes2, label %no
+yes2:
+  ret void
+no:
+  ret void
+}
+
+!0 = !{!"branch_weights", i32 1, i32 2}
+; CHECK: br i1 %c, label %yes, label %no, !prof !0
----------------
david-xl wrote:

should it check the second branch too?

https://github.com/llvm/llvm-project/pull/147388


More information about the llvm-commits mailing list