[all-commits] [llvm/llvm-project] 9514c0: Use optimal layout and preserve alloca alignment i...

John McCall via All-commits all-commits at lists.llvm.org
Wed Mar 25 21:51:15 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9514c048d89e6aef82d86c3478223fcb28230a4f
      https://github.com/llvm/llvm-project/commit/9514c048d89e6aef82d86c3478223fcb28230a4f
  Author: John McCall <rjmccall at apple.com>
  Date:   2020-03-26 (Thu, 26 Mar 2020)

  Changed paths:
    M llvm/lib/IR/Verifier.cpp
    M llvm/lib/Transforms/Coroutines/CoroEarly.cpp
    M llvm/lib/Transforms/Coroutines/CoroElide.cpp
    M llvm/lib/Transforms/Coroutines/CoroFrame.cpp
    M llvm/lib/Transforms/Coroutines/CoroInstr.h
    M llvm/lib/Transforms/Coroutines/CoroInternal.h
    M llvm/lib/Transforms/Coroutines/CoroSplit.cpp
    M llvm/test/Transforms/Coroutines/ArgAddr.ll
    M llvm/test/Transforms/Coroutines/coro-alloc-with-param-O0.ll
    M llvm/test/Transforms/Coroutines/coro-alloc-with-param-O2.ll
    M llvm/test/Transforms/Coroutines/coro-catchswitch.ll
    M llvm/test/Transforms/Coroutines/coro-debug.ll
    M llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-01.ll
    M llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-02.ll
    M llvm/test/Transforms/Coroutines/coro-frame-arrayalloca.ll
    M llvm/test/Transforms/Coroutines/coro-frame.ll
    M llvm/test/Transforms/Coroutines/coro-heap-elide.ll
    M llvm/test/Transforms/Coroutines/coro-materialize.ll
    M llvm/test/Transforms/Coroutines/coro-padding.ll
    M llvm/test/Transforms/Coroutines/coro-param-copy.ll
    M llvm/test/Transforms/Coroutines/coro-retcon-alloca.ll
    M llvm/test/Transforms/Coroutines/coro-retcon-once-value.ll
    M llvm/test/Transforms/Coroutines/coro-retcon-once-value2.ll
    M llvm/test/Transforms/Coroutines/coro-retcon-resume-values.ll
    M llvm/test/Transforms/Coroutines/coro-retcon-resume-values2.ll
    M llvm/test/Transforms/Coroutines/coro-retcon-value.ll
    M llvm/test/Transforms/Coroutines/coro-retcon.ll
    M llvm/test/Transforms/Coroutines/coro-spill-after-phi.ll
    M llvm/test/Transforms/Coroutines/coro-spill-corobegin.ll
    M llvm/test/Transforms/Coroutines/coro-swifterror.ll
    M llvm/test/Transforms/Coroutines/ex0.ll
    M llvm/test/Transforms/Coroutines/ex1.ll
    M llvm/test/Transforms/Coroutines/ex5.ll

  Log Message:
  -----------
  Use optimal layout and preserve alloca alignment in coroutine frames.

Previously, we would ignore alloca alignment when building the frame
and just use the natural alignment of the allocated type.  If an alloca
is over-aligned for its IR type, this could lead to a frame entry with
inadequate alignment for the downstream uses of the alloca.

Since highly-aligned fields also tend to produce poor layouts under a
naive layout algorithm, I've also switched coroutine frames to use the
new optimal struct layout algorithm.

In order to communicate the frame size and alignment to later passes,
I needed to set align+dereferenceable attributes on the frame-pointer
parameter of the resume function.  This is clearly the right thing to
do, but the align attribute currently seems to result in assumptions
being added during inlining that the optimizer cannot easily remove.




More information about the All-commits mailing list