[AVR] Do not clear r0 at interrupt entry
authorAyke van Laethem <aykevanlaethem@gmail.com>
Thu, 6 Jan 2022 17:22:06 +0000 (18:22 +0100)
committerAyke van Laethem <aykevanlaethem@gmail.com>
Wed, 19 Jan 2022 13:22:13 +0000 (14:22 +0100)
commitca27b026f990da2e67cbcc371480af9cad6a65d7
tree97e3b03b6b386b7db52770c7544e83505fdc3333
parent3d59d94a206a840d780c8f34610977734095149a
[AVR] Do not clear r0 at interrupt entry

There is no reason to do this: it's a scratch register and can therefore
hold any arbitrary value. And because it is in an interrupt, this code
is performance critical so it should be as short as possible.

I believe r0 was cleared because of the following:

 1. There used to be a bug that the cleared register was r0, not r1 as
    it should have been.
 2. This was fixed in https://reviews.llvm.org/D99467, but left the code
    to clear r0.

This patch completes D99467 by removing the `clr r0` instruction.

Differential Revision: https://reviews.llvm.org/D116756
llvm/lib/Target/AVR/AVRFrameLowering.cpp
llvm/test/CodeGen/AVR/interrupts.ll