[llvm] [LoongArch] Fold conditional branches with constant conditions (PR #185161)

via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 7 00:07:14 PST 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 170846 tests passed
* 3020 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### LLVM
<details>
<summary>LLVM.CodeGen/LoongArch/jr-without-ra.ll</summary>

```
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc --mtriple=loongarch64 -mattr=+d < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/LoongArch/jr-without-ra.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/LoongArch/jr-without-ra.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc --mtriple=loongarch64 -mattr=+d
# .---command stderr------------
# | llc: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/BranchFolding.cpp:1683: bool llvm::BranchFolder::OptimizeBlock(MachineBasicBlock *): Assertion `(*SI)->isEHPad() && "Bad CFG"' failed.
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
# | Stack dump:
# | 0.	Program arguments: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc --mtriple=loongarch64 -mattr=+d
# | 1.	Running pass 'Function Pass Manager' on module '<stdin>'.
# | 2.	Running pass 'Control Flow Optimizer' on function '@jr_without_ra'
# |  #0 0x0000000008504c78 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:880:13
# |  #1 0x0000000008501c25 llvm::sys::RunSignalHandlers() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:109:18
# |  #2 0x0000000008505a91 SignalHandler(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:448:38
# |  #3 0x00007eb4c158a330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
# |  #4 0x00007eb4c15e3b2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
# |  #5 0x00007eb4c158a27e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
# |  #6 0x00007eb4c156d8ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
# |  #7 0x00007eb4c156d81b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
# |  #8 0x00007eb4c1580517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
# |  #9 0x0000000006fb88ed IsBranchOnlyBlock /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/BranchFolding.cpp:1283:3
# | #10 0x0000000006fb88ed llvm::BranchFolder::OptimizeBlock(llvm::MachineBasicBlock*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/BranchFolding.cpp:1623:9
# | #11 0x0000000006fb243d llvm::BranchFolder::OptimizeBranches(llvm::MachineFunction&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/BranchFolding.cpp:1259:16
# | #12 0x0000000006fb0f6b llvm::BranchFolder::OptimizeFunction(llvm::MachineFunction&, llvm::TargetInstrInfo const*, llvm::TargetRegisterInfo const*, llvm::MachineLoopInfo*, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/BranchFolding.cpp:250:31
# | #13 0x0000000006fba7ec (anonymous namespace)::BranchFolderLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/BranchFolding.cpp:171:17
# | #14 0x00000000071c5e43 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:0:10
# | #15 0x0000000007734168 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:0:27
# | #16 0x000000000773bc12 llvm::FPPassManager::runOnModule(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1444:13
# | #17 0x0000000007734bdb runOnModule /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1513:27
# | #18 0x0000000007734bdb llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:531:44
# | #19 0x0000000004f292fc compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:871:17
# | #20 0x0000000004f265c3 main /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:459:13
# | #21 0x00007eb4c156f1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
# | #22 0x00007eb4c156f28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
# | #23 0x0000000004f220e5 _start (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc+0x4f220e5)
# `-----------------------------
# error: command failed with exit status: -6
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/LoongArch/jr-without-ra.ll
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/LoongArch/jr-without-ra.ll
# `-----------------------------
# error: command failed with exit status: 2

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

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


More information about the llvm-commits mailing list