[PATCH] D114611: [AVR] Expand STDWSPQRr & STDSPQRr, approach #2

Patryk Wychowaniec via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 18 03:32:36 PST 2021


Patryk27 added a comment.

I've got some progress!

https://pastebin.com/PUSLqL46 (sorry for pastebin, but I wanted to avoid spamming this thread with even more code)

`llc`-ing that code with `-march=avr` returns what seems to be valid code, but with `-march=avr -mcpu=atmega328p` the `st` / `std` look shady:

  .LBB0_60:                               ; %_ZN17compiler_builtins3int19specialized_div_rem11u32_div_rem17h69a9140ee9b21fa0E.exit.i
          ldi     r24, 0
          cpi     r30, 0
          cpc     r31, r24
          breq    .LBB0_62
  ; %bb.61:                               ; %bb2.i
          st      Z, r12
          std     Z+1, r13
          std     Z+2, r6
          std     Z+3, r7

The stack-corruption flow goes: `cpi` -> `cpc` -> `breq` (not taken) -> `st` (and here we refer to unitialized `Z`).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114611/new/

https://reviews.llvm.org/D114611



More information about the llvm-commits mailing list