[PATCH] D89899: [CodeGen] Implement [[likely]] and [[unlikely]] for the iteration statements

Mark de Wever via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 28 10:52:41 PDT 2020


Mordante updated this revision to Diff 301332.
Mordante marked an inline comment as done.
Mordante added a comment.

Addressed the review comments:

- The likelhood attribute no longer affects the `do` statement.
- Added a diagnotic when a likelihood attribute is used on an infinite while loop. Note the diagnostic uses a select since I already use this diagnostic for a WIP patch. That patch issues a diagnostic when the likelihood attribute annotates an `if constexpr`. Since the attribute has no effect on the `do` statement there's no warning for `do [[likely]] { ... }  while(0);`. The warning would imply the attribute has an effect on a normal `do` statement.
- Various minor fixes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89899/new/

https://reviews.llvm.org/D89899

Files:
  clang/include/clang/AST/Stmt.h
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/AST/Stmt.cpp
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGenCXX/attr-likelihood-if-branch-weights.cpp
  clang/test/CodeGenCXX/attr-likelihood-iteration-stmt.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89899.301332.patch
Type: text/x-patch
Size: 10233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201028/c250dedf/attachment-0001.bin>


More information about the cfe-commits mailing list