[PATCH] D136497: [Clang] support for outputs along indirect edges of asm goto
Bill Wendling via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 18 16:04:56 PST 2023
void added inline comments.
================
Comment at: clang/docs/ReleaseNotes.rst:199
+ guaranteed (and necessary to support outputs along indirect edges, which is
+ now supported as of this release).
+
----------------
Is it worth it to mention that this change makes Clang's behavior with regards to your example here consistent with GCC's behavior?
================
Comment at: clang/lib/CodeGen/CGStmt.cpp:2814
+ // A 2D vector, indexed by indirect destination, then ResultReg.
+ std::vector<std::vector<llvm::Value *>> CBRRegResults;
if (IsGCCAsmGoto) {
----------------
It seems as if you really want a map indexed by the `BasicBlock*`. So something like this:
```
DenseMap<BasicBlock *, SmallVector<Value *, 4>> // 4 should be enough for anyone.
```
That way you can iterate over `CBR->getIndirectDests()` instead of having to use an iterator.
================
Comment at: clang/lib/CodeGen/CGStmt.cpp:2868
+ // CBRRegResults rather than RegResults.
+ if (IsGCCAsmGoto && CBRRegResults.size()) {
+ for (unsigned i = 0, e = CBR->getNumIndirectDests(); i != e; ++i) {
----------------
Could probably use `!CBRRegResults.empty()` instead of `.size()`. The first should be `O(1)` (granted `.size()` probably should be too, but `.empty()` is more explicit anyway).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136497/new/
https://reviews.llvm.org/D136497
More information about the cfe-commits
mailing list