[PATCH] D65300: [clang] [CodeGen] clang-misexpect prototype for compiler warnings

Paul Kirth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 5 09:30:27 PDT 2019


paulkirth updated this revision to Diff 213379.
paulkirth edited the summary of this revision.
paulkirth added a comment.

Update threshold values to match those assigned when lowering __builtin_expect intrinsic.

I've modified the branch probability to match the probability assigned in LowerExpectIntrinsics.cpp

This is still debatable, but seems like a reasonable default. My next patch will make the probability threshold assignable through the command line, and extend the probability calculation into switch statements. This way users can determine how hot is hot enough, and otherwise get the same behavior that builtin expect will use anyway.

I also re applied a fix to a typo that I overwrote in an earlier patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65300

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CMakeLists.txt
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/CodeGen/MisExpect.cpp
  clang/lib/CodeGen/MisExpect.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Profile/Inputs/misexpect-branch-nonconst-expect-arg.proftext
  clang/test/Profile/Inputs/misexpect-branch.proftext
  clang/test/Profile/Inputs/misexpect-switch-default-only.proftext
  clang/test/Profile/Inputs/misexpect-switch.proftext
  clang/test/Profile/misexpect-branch-cold.c
  clang/test/Profile/misexpect-branch-nonconst-expected-val.c
  clang/test/Profile/misexpect-branch.c
  clang/test/Profile/misexpect-no-warning-without-flag.c
  clang/test/Profile/misexpect-switch-default.c
  clang/test/Profile/misexpect-switch-nonconst.c
  clang/test/Profile/misexpect-switch-only-default-case.c
  clang/test/Profile/misexpect-switch.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65300.213379.patch
Type: text/x-patch
Size: 32679 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190805/54e49106/attachment-0001.bin>


More information about the cfe-commits mailing list