[PATCH] D136497: [Clang] support for outputs along indirect edges of asm goto

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 21 14:08:37 PDT 2022


nickdesaulniers created this revision.
nickdesaulniers added reviewers: nikic, void, jyknight, efriedma, craig.topper.
Herald added a subscriber: StephenFan.
Herald added a project: All.
nickdesaulniers requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Initial support for asm goto w/ outputs (D69876 <https://reviews.llvm.org/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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136497

Files:
  clang/lib/CodeGen/CGStmt.cpp
  clang/test/CodeGen/asm-goto.c
  clang/test/CodeGen/asm-goto2.c
  clang/test/Modules/asm-goto.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136497.469759.patch
Type: text/x-patch
Size: 23169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221021/c52dcbb1/attachment-0001.bin>


More information about the cfe-commits mailing list