[llvm] [CodeGen][NewPM] Port `machine-block-freq` to new pass manager (PR #98317)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 06:26:54 PDT 2024


================
@@ -0,0 +1,45 @@
+# RUN: llc --passes='print<machine-block-freq>' -filetype=null -filetype=null 2>&1 %s | FileCheck %s
+
+--- |
+  define i32 @is_odd(i32 noundef %n) {
+    %result = srem i32 %n, 2
+    %is_odd = icmp eq i32 %result, 1
+    br i1 %is_odd, label %odd, label %even
+  odd:
+    ret i32 1
+  even:
+    ret i32 0
+  }
+...
+---
+name:            is_odd
+tracksRegLiveness: true
+body:             |
+  bb.0 (%ir-block.0):
+    successors: %bb.2(0x40000000), %bb.1(0x40000000)
+    liveins: $edi
+  
+    %0:gr32 = COPY $edi
+    %1:gr32 = COPY killed %0
+    %4:gr32 = MOV32ri 2
+    $eax = COPY %1
+    CDQ implicit-def $eax, implicit-def $edx, implicit $eax
+    IDIV32r %4, implicit-def $eax, implicit-def $edx, implicit-def $eflags, implicit $eax, implicit $edx
+    %5:gr32 = COPY $edx
+    CMP32ri %5, 1, implicit-def $eflags
+    JCC_1 %bb.2, 5, implicit $eflags
+  
+  bb.1.odd:
----------------
arsenm wrote:

If you remove the block names you can drop the IR section 

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


More information about the llvm-commits mailing list