[all-commits] [llvm/llvm-project] 1466d6: [SPARC] Don't do leaf optimization on procedures w...

Koakuma via All-commits all-commits at lists.llvm.org
Mon Jun 27 09:36:02 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1466d65d9bbf7117ade258a80ef3bdfaff41ffde
      https://github.com/llvm/llvm-project/commit/1466d65d9bbf7117ade258a80ef3bdfaff41ffde
  Author: Koakuma <koachan at protonmail.com>
  Date:   2022-06-27 (Mon, 27 Jun 2022)

  Changed paths:
    M llvm/lib/Target/Sparc/SparcFrameLowering.cpp
    M llvm/test/CodeGen/SPARC/LeonSMACUMACInstructionUT.ll
    M llvm/test/CodeGen/SPARC/inlineasm-v9.ll
    M llvm/test/CodeGen/SPARC/inlineasm.ll
    M llvm/test/CodeGen/SPARC/leafproc.ll

  Log Message:
  -----------
  [SPARC] Don't do leaf optimization on procedures with inline assembly

On SPARC, leaf function optimization omits the register window sliding (and the associated register name changes). This might result in miscompilation of procedures containing inline assembly, as some of the register constraints used may interfere with the register usage of optimized functions, so we disable leaf procedure optimization on those procedures to prevent it from happening.

This is a continuation of patch D102342 by @LemonBoy, the original comment is reproduced below:

> Leaf functions allow the compiler to omit the setup and teardown of a frame pointer, therefore avoiding the exchange of the in/out register. According to the SPARC architecture manual every reference to %i0-%i5 should be replaced with %o0-o5, if the target register is already in use a further remapping step to %g1-%g7 is required to free the output register.
>
> Add a simple check to make sure not to stomp on any output register that's already in use.

Reviewed By: dcederman

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




More information about the All-commits mailing list