[all-commits] [llvm/llvm-project] 6641c5: [AVR] Always expand STDSPQRr & STDWSPQRr

Patryk Wychowaniec via All-commits all-commits at lists.llvm.org
Wed May 4 20:11:33 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6641c57aebc688b365587b990bb206c7f2e43c19
  Author: Patryk Wychowaniec <pwychowaniec at pm.me>
  Date:   2022-05-05 (Thu, 05 May 2022)

  Changed paths:
    M llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp
    M llvm/lib/Target/AVR/AVRFrameLowering.cpp
    A llvm/test/CodeGen/AVR/stdwstk.ll

  Log Message:
  [AVR] Always expand STDSPQRr & STDWSPQRr

Currently, STDSPQRr and STDWSPQRr are expanded only during
AVRFrameLowering - this means that if any of those instructions happen
to appear _outside_ of the typical FrameSetup / FrameDestroy
context, they wouldn't get substituted, eventually leading to a crash:

LLVM ERROR: Not supported instr: <MCInst XXX <MCOperand Reg:1>
<MCOperand Imm:15> <MCOperand Reg:53>>

This commit fixes this issue by moving expansion of those two opcodes
into AVRExpandPseudo.

This bug was originally discovered due to the Rust compiler_builtins
library. Its 0.1.37 release contained a 128-bit software
division/remainder routine that exercised this buggy branch in the code.

Reviewed By: benshi001

Differential Revision: https://reviews.llvm.org/D123528

More information about the All-commits mailing list