[PATCH] D85091: [Sema, CodeGen] Implement [[likely]] and [[unlikely]] in IfStmt

Mark de Wever via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 29 09:06:02 PDT 2020


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

Reworked the patch to match the behaviour as discussed in D86559 <https://reviews.llvm.org/D86559>.

- The likelihood attributes only have an effect when used directly on the ThenStmt and ElseStmt.
- Conflicting attributes on the ThenStmt and ElseStmt generate a diagnostic.
- Moved the likelihood determination from the CodeGen to the Sema. This requires the state to be stored in the AST.
- Updated the AST functions for the new likelihood bits.
- Updated the documentation.

Note currently there's no diagnostic for ignored attributes, this will be added in a future patch.


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

https://reviews.llvm.org/D85091

Files:
  clang/include/clang/AST/Stmt.h
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/Stmt.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaStmtAttr.cpp
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  clang/test/AST/ast-dump-if-json.cpp
  clang/test/AST/ast-dump-stmt.cpp
  clang/test/CodeGenCXX/attr-likelihood-if-branch-weights.cpp
  clang/test/Preprocessor/has_attribute.cpp
  clang/test/Sema/attr-likelihood.c
  clang/test/SemaCXX/attr-likelihood.cpp
  clang/www/cxx_status.html
  llvm/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h
  llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85091.288781.patch
Type: text/x-patch
Size: 57152 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200829/078e0066/attachment-0001.bin>


More information about the llvm-commits mailing list