[all-commits] [llvm/llvm-project] d649fa: [LLD][COFF] Support GNU style == aliases

Ayke via All-commits all-commits at lists.llvm.org
Wed Jan 19 05:22:30 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d649faff9c0ca87fd5a00a7f1056071fd46432ea
      https://github.com/llvm/llvm-project/commit/d649faff9c0ca87fd5a00a7f1056071fd46432ea
  Author: Ayke van Laethem <aykevanlaethem at gmail.com>
  Date:   2022-01-19 (Wed, 19 Jan 2022)

  Changed paths:
    M lld/COFF/Config.h
    M lld/COFF/Driver.cpp
    M lld/test/COFF/Inputs/library.def
    M lld/test/COFF/lib.test

  Log Message:
  -----------
  [LLD][COFF] Support GNU style == aliases

D46245 added support for this in llvm-libtool, but while lld-link can
also create .lib files from .def files it didn't support aliases.

I compared the Inputs/library.def test against the output from
llvm-libtool and it matches, except for the fact that lld-link reorders
functions for some reason.

I have also verified that this fixes a bug I was running into while
trying to compile .def files to .lib files in MinGW-w64 (using lld-link
instead of llvm-libtool).

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


  Commit: f41d2d9469d66b92c033616c080e196bdb07363a
      https://github.com/llvm/llvm-project/commit/f41d2d9469d66b92c033616c080e196bdb07363a
  Author: Ayke van Laethem <aykevanlaethem at gmail.com>
  Date:   2022-01-19 (Wed, 19 Jan 2022)

  Changed paths:
    M llvm/lib/Target/AVR/AVR.h
    M llvm/lib/Target/AVR/AVRFrameLowering.cpp
    M llvm/lib/Target/AVR/AVRTargetMachine.cpp
    M llvm/test/CodeGen/AVR/dynalloca.ll

  Log Message:
  -----------
  [AVR] Remove redundant dynalloca SP save/restore pass

I think this pass was previously used under the assumption that most
functions would not need a frame pointer and it would be more efficient
to store the old stack pointer in a regular register pair.

Unfortunately, right now we're forced to always reserve the Y register
as a frame pointer: whether or not this is needed is only known after
regsiter allocation at which point it doesn't make sense anymore to mark
it as non-reserved. Therefore, it makes sense to use the Y register to
store the old stack pointer in functions with dynamic allocas (with a
variable size or not in the entry block). Knowing this can make the code
around dynamic allocas a lot simpler: simply save/restore the frame
pointer.

This is especially relevant in functions that have a frame pointer
anyway (for example, because they have stack spills). The stack restore
in the epilogue will implicitly restore the old stack pointer, so there
is no need to store the old stack pointer separately. It even reduces
register pressure as a side effect.

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


  Commit: 3d59d94a206a840d780c8f34610977734095149a
      https://github.com/llvm/llvm-project/commit/3d59d94a206a840d780c8f34610977734095149a
  Author: Ayke van Laethem <aykevanlaethem at gmail.com>
  Date:   2022-01-19 (Wed, 19 Jan 2022)

  Changed paths:
    M llvm/lib/Target/AVR/AVRCallingConv.td
    M llvm/lib/Target/AVR/AVRRegisterInfo.cpp
    M llvm/test/CodeGen/AVR/interrupts.ll

  Log Message:
  -----------
  [AVR] Mark call-clobbered registers as clobbered in interrupt handlers

I have matched the RISCV backend, which only uses the interrupt save
list in getCalleeSavedRegs, _not_ in getCallPreservedMask. I don't know
the details of these two methods, but with it, the correct amount of
registers is saved and restored.

Without this patch, practically all interrupt handlers that call a
function will miscompile.

I have added a test to verify this behavior. I've also added a very
simple test to verify that more normal interrupt operations (in this
case, incrementing a global value) behave as expected.

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


  Commit: ca27b026f990da2e67cbcc371480af9cad6a65d7
      https://github.com/llvm/llvm-project/commit/ca27b026f990da2e67cbcc371480af9cad6a65d7
  Author: Ayke van Laethem <aykevanlaethem at gmail.com>
  Date:   2022-01-19 (Wed, 19 Jan 2022)

  Changed paths:
    M llvm/lib/Target/AVR/AVRFrameLowering.cpp
    M llvm/test/CodeGen/AVR/interrupts.ll

  Log Message:
  -----------
  [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


Compare: https://github.com/llvm/llvm-project/compare/579c4921c010...ca27b026f990


More information about the All-commits mailing list