[llvm] [AArch64] New pass for code layout optimizations. (PR #184434)

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 11:10:35 PDT 2026


================
@@ -0,0 +1,263 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
+; NOTE: Test cases for FCMP-FCSEL and CMP/CMN-CSEL code layout optimization
+; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-apple-darwin -mcpu=apple-m4 -aarch64-code-layout-opt=fcmp-fcsel,cmp-csel | FileCheck %s
+; Default for -mcpu=apple-m4 enables both fcmp-fcsel and cmp-csel; expect identical output.
+; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-apple-darwin -mcpu=apple-m4 | FileCheck %s
+
+; Test coverage for optimizeForCodeLayout function:
+; 1. Basic FCMP-FCSEL instruction pair detection and function alignment (single/double precision)
+; 2. Multiple instruction pairs in same function (also tests different predicates)
+; 3. FCMP with immediate operand (#0.0) is excluded from optimization
+; 4. Instruction pairs with function calls
+; 5. Negative tests (no false positives)
+; 6. Basic CMP-CSEL and CMN-CSEL instruction pair detection and function alignment
+; 7. CMP/CMN with immediate <=15 qualifies; immediate >15 is excluded
+
+; Test 1: Basic single-precision FCMP-FCSEL instruction pair
----------------
jroelofs wrote:

Please don't number tests like this. It adds unnecessary friction next time someone needs to add another case to this file.

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


More information about the llvm-commits mailing list