[all-commits] [llvm/llvm-project] 227607: [RISCV] Fix crash in PEI with empty entry block wi...

Nemanja Ivanovic via All-commits all-commits at lists.llvm.org
Fri Nov 17 07:18:58 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 227607190e68c303920bcbd148043dbb1aa5d3b1
      https://github.com/llvm/llvm-project/commit/227607190e68c303920bcbd148043dbb1aa5d3b1
  Author: Nemanja Ivanovic <nemanja.i.ibm at gmail.com>
  Date:   2023-11-17 (Fri, 17 Nov 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
    A llvm/test/CodeGen/RISCV/pei-crash.ll

  Log Message:
  -----------
  [RISCV] Fix crash in PEI with empty entry block with Zcmp (#72117)

We check the opcode of the first instruction in the block where the
prologue is inserted without checking if the iterator points to any
instructions. When the basic block is empty, that causes a crash. One
way the prologue block can be empty is when it starts with a call to
__builtin_readcyclecounter on RV32 since that produces a loop.

Co-authored-by: Nemanja Ivanovic <nemanja at synopsys.com>




More information about the All-commits mailing list