[llvm] [LoongArch] Fold constant condition for LoongArchISD::BRCOND (PR #215936)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 02:59:24 PDT 2026


================
@@ -0,0 +1,47 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
+; RUN: llc --mtriple=loongarch64 -mattr=+lsx < %s | FileCheck %s
+
+define i64 @brcond_const_1(i64 %0) {
+; CHECK-LABEL: brcond_const_1:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    b .LBB0_2
+; CHECK-NEXT:  # %bb.1:
+; CHECK-NEXT:    move $a0, $zero
+; CHECK-NEXT:    ret
+; CHECK-NEXT:  .LBB0_2:
+; CHECK-NEXT:    ori $a0, $zero, 1
+; CHECK-NEXT:    ret
----------------
heiher wrote:

LoongArch Late Branch Opt: https://github.com/llvm/llvm-project/commits/users/hev/loong-late-branch-opt

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


More information about the llvm-commits mailing list