[llvm] [LoopPeel] Remove known trip count restriction when peeling last. (PR #140792)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue May 27 00:30:45 PDT 2025


mstorsjo wrote:

I also bisected a failure down to this revision, noted when building ffmpeg. (It is also possible to reproduce with the ffmpeg build integration in llvm-test-suite, but only if building in `CMAKE_BUILD_TYPE=RelWithDebInfo` mode.

It can be reproduced with this reduced case:
```c
int fastaudio_decode_avctx_0, fastaudio_decode_i;
void fastaudio_decode() {
  float m_2;
  for (int index5;; fastaudio_decode_i++) {
    for (int j = 0; j < 21; j++)
      if (j == 20)
        index5 = index5 % 2;
    m_2 = fastaudio_decode_avctx_0;
  }
}
```

```console
$ clang -target x86_64-linux-gnu -c -O2 repro.c -g
clang: ../lib/IR/Instruction.cpp:161: void llvm::Instruction::insertBefore(llvm:
:BasicBlock&, llvm::iplist_impl<llvm::simple_ilist<llvm::Instruction, llvm::ilis
t_iterator_bits<true>, llvm::ilist_parent<llvm::BasicBlock> >, llvm::SymbolTable
ListTraits<llvm::Instruction, llvm::ilist_iterator_bits<true>, llvm::ilist_paren
t<llvm::BasicBlock> > >::iterator): Assertion `!isa<PHINode>(this) && "Inserting
 PHI after debug-records!"' failed.
```

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


More information about the llvm-commits mailing list