[Clang] support for outputs along indirect edges of asm goto
authorNick Desaulniers <ndesaulniers@google.com>
Fri, 17 Feb 2023 01:49:39 +0000 (17:49 -0800)
committerNick Desaulniers <ndesaulniers@google.com>
Fri, 17 Feb 2023 01:58:34 +0000 (17:58 -0800)
commit329ef60f3e21fd6845e8e8b0da405cae7eb27267
tree4fe47511290dc904b2741f274ed9a9484244cea1
parentb1bc723dfe9734a8b3157dbf50328b5d62436bd6
[Clang] support for outputs along indirect edges of asm goto

Initial support for asm goto w/ outputs (D69876) only supported outputs
along the "default" (aka "fallthrough") edge.

We can support outputs along all edges by repeating the same pattern of
stores along the indirect edges that we allready do for the default
edge.  One complication is that these indirect edges may be critical
edges which would need to be split. Another issue is that mid-codgen of
LLVM IR, the control flow graph might not reflect the control flow of
the final function.

To avoid this "chicken and the egg" problem assume that any given
indirect edge may become a critical edge, and pro-actively split it.
This is unnecessary if the edge does not become critical, but LLVM will
optimize such cases via tail duplication.

Fixes: https://github.com/llvm/llvm-project/issues/53562

Reviewed By: void

Differential Revision: https://reviews.llvm.org/D136497
clang/docs/LanguageExtensions.rst
clang/docs/ReleaseNotes.rst
clang/lib/CodeGen/CGStmt.cpp
clang/test/CodeGen/asm-goto.c
clang/test/CodeGen/asm-goto2.c [new file with mode: 0644]
clang/test/Modules/asm-goto.c