[PATCH] D89210: [Sema, CodeGen] Implement [[likely]] and [[unlikely]] in SwitchStmt

Mark de Wever via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 11 11:12:58 PDT 2020


Mordante created this revision.
Mordante added reviewers: aaron.ballman, rjmccall, rsmith.
Mordante added a project: clang.
Mordante requested review of this revision.

This implements the likelihood attribute for the switch statement. Based on the discussion in D85091 <https://reviews.llvm.org/D85091> and D86559 <https://reviews.llvm.org/D86559> it only handles the attribute when placed on the case labels or the default labels.

It also marks the likelihood attribute as feature complete. There are be more QoI patches in the pipeline.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89210

Files:
  clang/include/clang/AST/Stmt.h
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.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-switch-branch-weights.cpp
  clang/test/Preprocessor/has_attribute.cpp
  clang/www/cxx_status.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89210.297478.patch
Type: text/x-patch
Size: 23890 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201011/9763334d/attachment-0001.bin>


More information about the cfe-commits mailing list