[PATCH] D123528: [AVR] Always expand STDSPQRr & STDWSPQRr

Patryk Wychowaniec via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 11:13:08 PDT 2022


Patryk27 created this revision.
Herald added subscribers: Jim, JDevlieghere, hiraditya, dylanmckay.
Herald added a project: All.
Patryk27 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123528

Files:
  llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp
  llvm/lib/Target/AVR/AVRFrameLowering.cpp
  llvm/test/CodeGen/AVR/stdwstk.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123528.421976.patch
Type: text/x-patch
Size: 9908 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220411/f5d0bc81/attachment.bin>


More information about the llvm-commits mailing list