SuccessChanges

Summary

  1. clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM This patch contains the basic functionality for reporting potentially incorrect usage of __builtin_expect() by comparing the developer's annotation against a collected PGO profile. A more detailed proposal and discussion appears on the CFE-dev mailing list (http://lists.llvm.org/pipermail/cfe-dev/2019-July/062971.html) and a prototype of the initial frontend changes appear here in D65300 We revised the work in D65300 by moving the misexpect check into the LLVM backend, and adding support for IR and sampling based profiles, in addition to frontend instrumentation. We add new misexpect metadata tags to those instructions directly influenced by the llvm.expect intrinsic (branch, switch, and select) when lowering the intrinsics. The misexpect metadata contains information about the expected target of the intrinsic so that we can check against the correct PGO counter when emitting diagnostics, and the compiler's values for the LikelyBranchWeight and UnlikelyBranchWeight. We use these branch weight values to determine when to emit the diagnostic to the user. A future patch should address the comment at the top of LowerExpectIntrisic.cpp to hoist the LikelyBranchWeight and UnlikelyBranchWeight values into a shared space that can be accessed outside of the LowerExpectIntrinsic pass. Once that is done, the misexpect metadata can be updated to be smaller. In the long term, it is possible to reconstruct portions of the misexpect metadata from the existing profile data. However, we have avoided this to keep the code simple, and because some kind of metadata tag will be required to identify which branch/switch/select instructions are influenced by the use of llvm.expect Patch By: paulkirth Differential Revision: https://reviews.llvm.org/D66324
  2. Emit -Wmicrosoft-enum-value warning instead of error in MS ABI Summary: The first NFC change is to replace a getCXXABI().isMicrosoft() check with getTriple().isWindowsMSVCEnvironment(). This code takes effect in non-C++ compilations, so it doesn't make sense to check the C++ ABI. In the MS ABI, enums are always considered to be "complete" because the underlying type of an unfixed enum will always be 'int'. This behavior was moved from -fms-compatibility to MS ABI back in r249656. The second change is functional, and it downgrades an error to a warning when the MS ABI is used rather than only under -fms-compatibility. The reasoning is that it's unreasonable for the following code to reject the following code for all MS ABI targets with -fno-ms-compatibility: enum Foo { Foo_Val = 0xDEADBEEF }; This is valid code for any other target, but in the MS ABI, Foo_Val just happens to be negative. With this change, clang emits a -Wmicrosoft-enum-value warning on this code, but compiles it without error. Fixes PR38478 Reviewers: hans, rsmith, STL_MSFT Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67304
  3. Revert "llvm-reduce: Add pass to reduce parameters" Looks to be failing on asan buildbots This reverts commit r371567.
  4. Revert "Adding support for overriding LLVM_ENABLE_RUNTIMES for runtimes builds." This reverts commit r371566: this doesn't correctly handle the case where LLVM_ENABLE_RUNTIMES contains a list of values.
  5. [clang-scan-deps][NFC] Fix tests - prevent FileCheck matching test dir path Differential Revision: https://reviews.llvm.org/D67379
  6. [Object][TextAPI] NFC, fix tapi lit tests FileCheck command had wrong casing, which works fine on macOS, repairs the linux build bots
Revision 371584 by phosek:
clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM

This patch contains the basic functionality for reporting potentially
incorrect usage of __builtin_expect() by comparing the developer's
annotation against a collected PGO profile. A more detailed proposal and
discussion appears on the CFE-dev mailing list
(http://lists.llvm.org/pipermail/cfe-dev/2019-July/062971.html) and a
prototype of the initial frontend changes appear here in D65300

We revised the work in D65300 by moving the misexpect check into the
LLVM backend, and adding support for IR and sampling based profiles, in
addition to frontend instrumentation.

We add new misexpect metadata tags to those instructions directly
influenced by the llvm.expect intrinsic (branch, switch, and select)
when lowering the intrinsics. The misexpect metadata contains
information about the expected target of the intrinsic so that we can
check against the correct PGO counter when emitting diagnostics, and the
compiler's values for the LikelyBranchWeight and UnlikelyBranchWeight.
We use these branch weight values to determine when to emit the
diagnostic to the user.

A future patch should address the comment at the top of
LowerExpectIntrisic.cpp to hoist the LikelyBranchWeight and
UnlikelyBranchWeight values into a shared space that can be accessed
outside of the LowerExpectIntrinsic pass. Once that is done, the
misexpect metadata can be updated to be smaller.

In the long term, it is possible to reconstruct portions of the
misexpect metadata from the existing profile data. However, we have
avoided this to keep the code simple, and because some kind of metadata
tag will be required to identify which branch/switch/select instructions
are influenced by the use of llvm.expect

Patch By: paulkirth
Differential Revision: https://reviews.llvm.org/D66324
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (diff)clang.src/include/clang/Basic/DiagnosticFrontendKinds.td
The file was modified/cfe/trunk/include/clang/Basic/DiagnosticGroups.td (diff)clang.src/include/clang/Basic/DiagnosticGroups.td
The file was modified/cfe/trunk/lib/CodeGen/CodeGenAction.cpp (diff)clang.src/lib/CodeGen/CodeGenAction.cpp
The file was modified/cfe/trunk/lib/Frontend/CompilerInvocation.cpp (diff)clang.src/lib/Frontend/CompilerInvocation.cpp
The file was added/cfe/trunk/test/Profile/Inputs/misexpect-branch-nonconst-expect-arg.proftextclang.src/test/Profile/Inputs/misexpect-branch-nonconst-expect-arg.proftext
The file was added/cfe/trunk/test/Profile/Inputs/misexpect-branch.proftextclang.src/test/Profile/Inputs/misexpect-branch.proftext
The file was added/cfe/trunk/test/Profile/Inputs/misexpect-switch-default-only.proftextclang.src/test/Profile/Inputs/misexpect-switch-default-only.proftext
The file was added/cfe/trunk/test/Profile/Inputs/misexpect-switch-default.proftextclang.src/test/Profile/Inputs/misexpect-switch-default.proftext
The file was added/cfe/trunk/test/Profile/Inputs/misexpect-switch-nonconst.proftextclang.src/test/Profile/Inputs/misexpect-switch-nonconst.proftext
The file was added/cfe/trunk/test/Profile/Inputs/misexpect-switch.proftextclang.src/test/Profile/Inputs/misexpect-switch.proftext
The file was added/cfe/trunk/test/Profile/misexpect-branch-cold.cclang.src/test/Profile/misexpect-branch-cold.c
The file was added/cfe/trunk/test/Profile/misexpect-branch-nonconst-expected-val.cclang.src/test/Profile/misexpect-branch-nonconst-expected-val.c
The file was added/cfe/trunk/test/Profile/misexpect-branch-unpredictable.cclang.src/test/Profile/misexpect-branch-unpredictable.c
The file was added/cfe/trunk/test/Profile/misexpect-branch.cclang.src/test/Profile/misexpect-branch.c
The file was added/cfe/trunk/test/Profile/misexpect-switch-default.cclang.src/test/Profile/misexpect-switch-default.c
The file was added/cfe/trunk/test/Profile/misexpect-switch-nonconst.cclang.src/test/Profile/misexpect-switch-nonconst.c
The file was added/cfe/trunk/test/Profile/misexpect-switch-only-default-case.cclang.src/test/Profile/misexpect-switch-only-default-case.c
The file was added/cfe/trunk/test/Profile/misexpect-switch.cclang.src/test/Profile/misexpect-switch.c
The file was added/compiler-rt/trunk/lib/profile/xxhash.ccompiler-rt.src/lib/profile/xxhash.c
The file was added/compiler-rt/trunk/lib/profile/xxhash.hcompiler-rt.src/lib/profile/xxhash.h
The file was modified/llvm/trunk/include/llvm/IR/DiagnosticInfo.h (diff)llvm.src/include/llvm/IR/DiagnosticInfo.h
The file was modified/llvm/trunk/include/llvm/IR/FixedMetadataKinds.def (diff)llvm.src/include/llvm/IR/FixedMetadataKinds.def
The file was modified/llvm/trunk/include/llvm/IR/MDBuilder.h (diff)llvm.src/include/llvm/IR/MDBuilder.h
The file was added/llvm/trunk/include/llvm/Transforms/Utils/MisExpect.hllvm.src/include/llvm/Transforms/Utils/MisExpect.h
The file was modified/llvm/trunk/lib/IR/DiagnosticInfo.cpp (diff)llvm.src/lib/IR/DiagnosticInfo.cpp
The file was modified/llvm/trunk/lib/IR/MDBuilder.cpp (diff)llvm.src/lib/IR/MDBuilder.cpp
The file was modified/llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp (diff)llvm.src/lib/Transforms/IPO/SampleProfile.cpp
The file was modified/llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (diff)llvm.src/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
The file was modified/llvm/trunk/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp (diff)llvm.src/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
The file was modified/llvm/trunk/lib/Transforms/Utils/CMakeLists.txt (diff)llvm.src/lib/Transforms/Utils/CMakeLists.txt
The file was added/llvm/trunk/lib/Transforms/Utils/MisExpect.cppllvm.src/lib/Transforms/Utils/MisExpect.cpp
The file was modified/llvm/trunk/test/ThinLTO/X86/lazyload_metadata.ll (diff)llvm.src/test/ThinLTO/X86/lazyload_metadata.ll
The file was modified/llvm/trunk/test/Transforms/LowerExpectIntrinsic/basic.ll (diff)llvm.src/test/Transforms/LowerExpectIntrinsic/basic.ll
The file was added/llvm/trunk/test/Transforms/PGOProfile/Inputs/misexpect-branch-correct.proftextllvm.src/test/Transforms/PGOProfile/Inputs/misexpect-branch-correct.proftext
The file was added/llvm/trunk/test/Transforms/PGOProfile/Inputs/misexpect-branch.proftextllvm.src/test/Transforms/PGOProfile/Inputs/misexpect-branch.proftext
The file was added/llvm/trunk/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct.proftextllvm.src/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct.proftext
The file was added/llvm/trunk/test/Transforms/PGOProfile/Inputs/misexpect-switch.proftextllvm.src/test/Transforms/PGOProfile/Inputs/misexpect-switch.proftext
The file was added/llvm/trunk/test/Transforms/PGOProfile/misexpect-branch-correct.llllvm.src/test/Transforms/PGOProfile/misexpect-branch-correct.ll
The file was added/llvm/trunk/test/Transforms/PGOProfile/misexpect-branch-stripped.llllvm.src/test/Transforms/PGOProfile/misexpect-branch-stripped.ll
The file was added/llvm/trunk/test/Transforms/PGOProfile/misexpect-branch-unpredictable.llllvm.src/test/Transforms/PGOProfile/misexpect-branch-unpredictable.ll
The file was added/llvm/trunk/test/Transforms/PGOProfile/misexpect-branch.llllvm.src/test/Transforms/PGOProfile/misexpect-branch.ll
The file was added/llvm/trunk/test/Transforms/PGOProfile/misexpect-switch-default.llllvm.src/test/Transforms/PGOProfile/misexpect-switch-default.ll
The file was added/llvm/trunk/test/Transforms/PGOProfile/misexpect-switch.llllvm.src/test/Transforms/PGOProfile/misexpect-switch.ll
Revision 371581 by rnk:
Emit -Wmicrosoft-enum-value warning instead of error in MS ABI

Summary:
The first NFC change is to replace a getCXXABI().isMicrosoft() check
with getTriple().isWindowsMSVCEnvironment(). This code takes effect in
non-C++ compilations, so it doesn't make sense to check the C++ ABI. In
the MS ABI, enums are always considered to be "complete" because the
underlying type of an unfixed enum will always be 'int'. This behavior
was moved from -fms-compatibility to MS ABI back in r249656.

The second change is functional, and it downgrades an error to a warning
when the MS ABI is used rather than only under -fms-compatibility. The
reasoning is that it's unreasonable for the following code to reject the
following code for all MS ABI targets with -fno-ms-compatibility:
  enum Foo { Foo_Val = 0xDEADBEEF };
This is valid code for any other target, but in the MS ABI, Foo_Val just
happens to be negative. With this change, clang emits a
-Wmicrosoft-enum-value warning on this code, but compiles it without
error.

Fixes PR38478

Reviewers: hans, rsmith, STL_MSFT

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67304
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/lib/Sema/SemaDecl.cpp (diff)clang.src/lib/Sema/SemaDecl.cpp
The file was modified/cfe/trunk/test/Sema/MicrosoftCompatibility.c (diff)clang.src/test/Sema/MicrosoftCompatibility.c
Revision 371580 by dblaikie:
Revert "llvm-reduce: Add pass to reduce parameters"

Looks to be failing on asan buildbots

This reverts commit r371567.
Change TypePath in RepositoryPath in Workspace
The file was removed/llvm/trunk/test/Reduce/Inputs/remove-args.pyllvm.src/test/Reduce/Inputs/remove-args.py
The file was removed/llvm/trunk/test/Reduce/remove-args.llllvm.src/test/Reduce/remove-args.ll
The file was modified/llvm/trunk/tools/llvm-reduce/CMakeLists.txt (diff)llvm.src/tools/llvm-reduce/CMakeLists.txt
The file was modified/llvm/trunk/tools/llvm-reduce/DeltaManager.h (diff)llvm.src/tools/llvm-reduce/DeltaManager.h
The file was removed/llvm/trunk/tools/llvm-reduce/deltas/ReduceArguments.cppllvm.src/tools/llvm-reduce/deltas/ReduceArguments.cpp
The file was removed/llvm/trunk/tools/llvm-reduce/deltas/ReduceArguments.hllvm.src/tools/llvm-reduce/deltas/ReduceArguments.h
Revision 371579 by phosek:
Revert "Adding support for overriding LLVM_ENABLE_RUNTIMES for runtimes builds."

This reverts commit r371566: this doesn't correctly handle the case
where LLVM_ENABLE_RUNTIMES contains a list of values.
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/runtimes/CMakeLists.txt (diff)llvm.src/runtimes/CMakeLists.txt
Revision 371578 by Jan Korous:
[clang-scan-deps][NFC] Fix tests - prevent FileCheck matching test dir path

Differential Revision: https://reviews.llvm.org/D67379
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/test/ClangScanDeps/Inputs/header_stat_before_open_cdb.json (diff)clang.src/test/ClangScanDeps/Inputs/header_stat_before_open_cdb.json
The file was modified/cfe/trunk/test/ClangScanDeps/Inputs/no-werror.json (diff)clang.src/test/ClangScanDeps/Inputs/no-werror.json
The file was modified/cfe/trunk/test/ClangScanDeps/Inputs/regular_cdb.json (diff)clang.src/test/ClangScanDeps/Inputs/regular_cdb.json
The file was modified/cfe/trunk/test/ClangScanDeps/Inputs/subframework_header_dir_symlink_cdb.json (diff)clang.src/test/ClangScanDeps/Inputs/subframework_header_dir_symlink_cdb.json
The file was modified/cfe/trunk/test/ClangScanDeps/Inputs/symlink_cdb.json (diff)clang.src/test/ClangScanDeps/Inputs/symlink_cdb.json
The file was modified/cfe/trunk/test/ClangScanDeps/Inputs/vfsoverlay_cdb.json (diff)clang.src/test/ClangScanDeps/Inputs/vfsoverlay_cdb.json
The file was modified/cfe/trunk/test/ClangScanDeps/error.cpp (diff)clang.src/test/ClangScanDeps/error.cpp
The file was modified/cfe/trunk/test/ClangScanDeps/header_stat_before_open.m (diff)clang.src/test/ClangScanDeps/header_stat_before_open.m
The file was modified/cfe/trunk/test/ClangScanDeps/no-werror.cpp (diff)clang.src/test/ClangScanDeps/no-werror.cpp
The file was modified/cfe/trunk/test/ClangScanDeps/regular_cdb.cpp (diff)clang.src/test/ClangScanDeps/regular_cdb.cpp
The file was modified/cfe/trunk/test/ClangScanDeps/subframework_header_dir_symlink.m (diff)clang.src/test/ClangScanDeps/subframework_header_dir_symlink.m
The file was modified/cfe/trunk/test/ClangScanDeps/symlink.cpp (diff)clang.src/test/ClangScanDeps/symlink.cpp
The file was modified/cfe/trunk/test/ClangScanDeps/vfsoverlay.cpp (diff)clang.src/test/ClangScanDeps/vfsoverlay.cpp
Revision 371577 by cishida:
[Object][TextAPI] NFC, fix tapi lit tests

FileCheck command had wrong casing, which works fine on macOS, repairs the linux build bots
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/test/Object/nm-tapi-invalids.test (diff)llvm.src/test/Object/nm-tapi-invalids.test
The file was modified/llvm/trunk/test/Object/nm-tapi.test (diff)llvm.src/test/Object/nm-tapi.test