LLVM/llvm 337219llvm/trunk/docs/CommandGuide llvm-mca.rst

[llvm-mca][docs] Initial description of mca internals. NFC

This patch introduces a brief description of the components of MCA.  The main
focus is on Views.   This is a work in progress, and more descriptions will be
introduced later.  I want to flesh-out the Views section more and provide a
detailed description of eventing in MCA.  Eventually a brief code example of a
View should accompany the description.

Also, we should consider moving the MCA internals guide elsewhere at some point.

LLVM/llvm 337218llvm/trunk/lib/Demangle Utility.h

Add missing includes.

LLVM/llvm 337217llvm/trunk/lib/Demangle ItaniumDemangle.cpp Utility.h

[LLVMDemangle] Move some utility classes to header files.

In a followup I'm looking to add a Microsoft demangler.  Doing
so needs a lot of the same utility classes and feature test
macros which are already implemented in ItaniumDemangle.cpp.
So move all of these things into header files so that they
can be re-used by a new demangler.

Differential Revision: https://reviews.llvm.org/D49399

LLVM/llvm 337216test-suite/trunk/ABI-Testsuite/test/mangling c++11s.xpp

Fixed test to conform to FileCceck change in r336830.

LLVM/llvm 337215cfe/trunk/include/clang/StaticAnalyzer/Core CheckerManager.h, cfe/trunk/lib/StaticAnalyzer/Checkers MisusedMovedObjectChecker.cpp RetainCountChecker.cpp

[analyzer] Make checkEndFunction() give access to the return statement.

Differential Revision: https://reviews.llvm.org/D49387

LLVM/llvm 337214cfe/trunk/unittests/ASTMatchers ASTMatchersTraversalTest.cpp

[ASTMatchers] Quickfix for tests.

LLVM/llvm 337213cfe/trunk/lib/StaticAnalyzer/Core BugReporterVisitors.cpp, cfe/trunk/test/Analysis/diagnostics macro-null-return-suppression.cpp

[analyzer] Bugfix for an overly eager suppression for null pointer return from macros.

Only suppress those cases where the null which came from the macro is
relevant to the bug, and was not overwritten in between.


Differential Revision: https://reviews.llvm.org/D48856

LLVM/llvm 337212cfe/trunk/lib/StaticAnalyzer/Checkers GCDAntipatternChecker.cpp, cfe/trunk/test/Analysis gcdantipatternchecker_test.m

[analyzer] Fix GCDAntipatternChecker to only fire when the semaphore is initialized to 

Initializing a semaphore with a different constant most likely signals a different intent


Differential Revision: https://reviews.llvm.org/D48911

LLVM/llvm 337211cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter PathDiagnostic.h

[analyzer] Provide a symmetric method for generating a PathDiagnosticLocation from Decl

Differential Revision: https://reviews.llvm.org/D49166

LLVM/llvm 337210lld/trunk/test/ELF/lto thinlto-debug-fission.ll

remove temporal  file directory before testing in thinlto-debug-fission.ll

This removes the %T/dwo directory before calling ld.lld in 
ELF/lto/thinlto-debug-fission.ll so that
files aren't left over from previous runs.

Reviewers: espindola, pcc

Reviewed By: pcc

Subscribers: inglorion, emaste, arichardson, eraman, steven_wu, dexonsmith, llvm-commits

Differential Revision: https://reviews.llvm.org/D49390

LLVM/llvm 337209cfe/trunk/docs LibASTMatchersReference.html, cfe/trunk/include/clang/ASTMatchers ASTMatchers.h

[ASTMatchers] Introduce Objective-C matchers `hasReceiver` and `isInstanceMessage` for 

Differential Revision: https://reviews.llvm.org/D49333

LLVM/llvm 337208llvm/trunk/test/Transforms/InstCombine canonicalize-signed-truncation-check.ll canonicalize-lack-of-signed-truncation-check.ll

[NFC][InstCombine] Fine-tune 'check for [no] signed truncation' tests

We are using i8 for these tests, and shifting by 4,
which is exactly the half of i8.

But as it is seen from the proofs https://rise4fun.com/Alive/mgu
KeptBits = bitwidth(%x) - MaskedBits,
so with using shifts by 4, we are not really testing that
we actually properly handle the other cases with shifts not by half...

LLVM/llvm 337207cfe/trunk/lib/CodeGen CGOpenMPRuntime.cpp CGOpenMPRuntime.h, cfe/trunk/test/OpenMP declare_target_link_codegen.cpp

[OPENMP] Fix checks for declare target link entries.

If the declare target link entries are created but not used, the
compiler will produce an error message. Patch improves handling of such
situations + improves checks for possibly lost declare target variables.

LLVM/llvm 337206compiler-rt/trunk/lib/fuzzer FuzzerMutate.cpp FuzzerMutate.h, compiler-rt/trunk/test/fuzzer fuzzer-mutationstats.test

Revert r337194 (https://reviews.llvm.org/D48891) due to compilation errors.

LLVM/llvm 337205libcxx/trunk/src/experimental memory_resource.cpp

Fix PR38160 - init_priority attribute not supported by GCC on Apple.

This patch guards the use of __attribute__((init_priority(101)))
within memory_resource.cpp when building with compilers that don't
support it. Specifically GCC on Apple platforms, and MSVC.

LLVM/llvm 337204llvm/trunk/test/tools/llvm-objcopy many-sections.test strict-no-add.test, llvm/trunk/test/tools/llvm-objcopy/Inputs ungzip.py

[llvm-objcopy] Add support for large indexes

This patch is an update of an older patch that never landed
(see here: https://reviews.llvm.org/D42516)

Recently various users have run into this issue and it just 100%
has to be solved at this point. The main difference in this patch
is that I use gunzip instead of unzip which should hopefully allow
tests to pass. Please review this as if it is a new patch however.
I found some issues along the way and made some minor modifications.

The binary used in this patch for testing (a zip file to make it small)
can be found here:

Differential Revision: https://reviews.llvm.org/D49206

LLVM/llvm 337203compiler-rt/trunk/test/fuzzer CMakeLists.txt

[cmake][libFuzzer] fixup r337193 to ensure msan/dfsan are not added
to test deps for libfuzzer when they're not supported by the platform

LLVM/llvm 337202lldb/trunk/cmake/modules AddLLDB.cmake

[CMake] Give lldb tools functional install targets when building LLDB.framework

This change makes the install targets for lldb tools functional when
building for the framework.

I am currently working on the install rules for lldb-framework and this will
let me make `install-lldb-framework` rely on `install-lldb-argdumper` for
instance. This is especially important for `install-lldb-framework-stripped`. It
is much better for `install-lldb-framework-stripped` to rely on
`install-lldb-argdumper-stripped` than to copy and strip lldb-argdumper

Differential Revision: https://reviews.llvm.org/D49038

LLVM/llvm 337201polly/trunk/lib/Analysis ScopInfo.cpp

[ScopInfo] Replace isl foreach calls with for loops

After Philip added support for range-based for loops to our C++
bindings, we now convert another bunch of foreach calls to range-for loops.
This improves general readability of the code.

LLVM/llvm 337200llvm/trunk/include/llvm/CodeGen SelectionDAG.h FastISel.h, llvm/trunk/lib/CodeGen CodeGenPrepare.cpp

[CodeGen] Fix inconsistent declaration parameter name

LLVM/llvm 337199compiler-rt/trunk/lib/fuzzer CMakeLists.txt, compiler-rt/trunk/lib/xray CMakeLists.txt

[CMake] Use cxx-headers as a depedency for C++ headers

We no longer pass CLANG_DEFAULT_CXX_STDLIB to the runtimes build
as it was causing issues so we can no longer use this variable. We
instead use cxx-headers as a dependency whenever this is available
since both XRay and libFuzzer are built as static libraries so this
is sufficient.

Differential Revision: https://reviews.llvm.org/D49346

LLVM/llvm 337198llvm/trunk/lib/Target/AMDGPU SIISelLowering.cpp AMDGPUInstrInfo.td, llvm/trunk/test/CodeGen/AMDGPU fdot2.ll

[AMDGPU] [AMDGPU] Support a fdot2 pattern.

Summary: Optimize fma((float)S0.x, (float)S1.x fma((float)S0.y, (float)S1.y, z))
                   -> fdot2((v2f16)S0, (v2f16)S1, (float)z)

Author: FarhanaAleen

Reviewed By: rampitec, b-sumner

Subscribers: AMDGPU

Differential Revision: https://reviews.llvm.org/D49146

LLVM/llvm 337197zorg/trunk/buildbot/osuosl/master/config builders.py

Moved builder llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast off-line temporally.

LLVM/llvm 337196cfe/trunk/lib/CodeGen CGOpenMPRuntime.cpp, cfe/trunk/test/OpenMP target_messages.cpp

[OPENMP] Fix syntactic errors in error messages.

Fixed spelling of the offloading error messages.

LLVM/llvm 337195lld/trunk/ELF Options.td LTO.cpp, lld/trunk/test/ELF/lto thinlto-debug-fission.ll

Support option -plugin-opt=dwo_dir=

This adds support to option -plugin-opt=dwo_dir=${DIR}. This option is used to specify the 
directory to store the .dwo files when LTO and debug fission is used
at the same time.

Reviewers: ruiu, espindola, pcc

Reviewed By: pcc

Subscribers: eraman, dexonsmith, mehdi_amini, emaste, arichardson, steven_wu, llvm-commits

Differential Revision: https://reviews.llvm.org/D47904

LLVM/llvm 337194compiler-rt/trunk/lib/fuzzer FuzzerMutate.cpp FuzzerMutate.h, compiler-rt/trunk/test/fuzzer fuzzer-mutationstats.test

[libFuzzer] Mutation tracking and logging implemented.

Code now exists to track number of mutations that are used in fuzzing in total
and ones that produce new coverage. The stats are currently being dumped to the
command line.

Patch by Kodé Williams (@kodewilliams).

Reviewers: metzman, Dor1s, morehouse, kcc

Reviewed By: Dor1s, morehouse, kcc

Subscribers: delcypher, kubamracek, kcc, morehouse, llvm-commits, #sanitizers, mgorny

Differential Revision: https://reviews.llvm.org/D48054

LLVM/llvm 337193compiler-rt/trunk/test/fuzzer CMakeLists.txt

[libFuzzer] Add msan and dfsan to test deps.

Required now that we have tests using MSan and DFSan.

LLVM/llvm 337192llvm/trunk/lib/CodeGen MIRCanonicalizerPass.cpp, llvm/trunk/lib/DebugInfo/PDB/Native GSIStreamBuilder.cpp

[llvm] Change 2 instances of std::sort to llvm::sort

LLVM/llvm 337191cfe/trunk/lib/CodeGen CGOpenMPRuntimeNVPTX.cpp, cfe/trunk/test/OpenMP nvptx_target_codegen.cpp

[OPENMP, NVPTX] Globalize only captured variables.

Sometimes we can try to globalize non-variable declarations, which may
lead to compiler crash.

LLVM/llvm 337190llvm/trunk/lib/Transforms/InstCombine InstCombineCompares.cpp, llvm/trunk/test/Transforms/InstCombine canonicalize-lack-of-signed-truncation-check.ll canonicalize-signed-truncation-check.ll

[InstCombine] Fold 'check for [no] signed truncation' pattern

[[ https://bugs.llvm.org/show_bug.cgi?id=38149 | PR38149 ]]

As discussed in https://reviews.llvm.org/D49179#1158957 and later,
the IR for 'check for [no] signed truncation' pattern can be improved:
^ that pattern will be produced by Implicit Integer Truncation sanitizer,
https://reviews.llvm.org/D48958 https://bugs.llvm.org/show_bug.cgi?id=21530
in signed case, therefore it is probably a good idea to improve it.

Proofs for this transform: https://rise4fun.com/Alive/mgu
This transform is surprisingly frustrating.
This does not deal with non-splat shift amounts, or with undef shift amounts.
I've outlined what i think the solution should be:
  // Potential handling of non-splats: for each element:
  //  * if both are undef, replace with constant 0.
  //    Because (1<<0) is OK and is 1, and ((1<<0)>>1) is also OK and is 0.
  //  * if both are not undef, and are different, bailout.
  //  * else, only one is undef, then pick the non-undef one.

The DAGCombine will reverse this transform, see

    [9 lines not shown]

LLVM/llvm 337189lldb/trunk/include/lldb/Utility AnsiTerminal.h, lldb/trunk/unittests/Utility AnsiTerminalTest.cpp CMakeLists.txt

Fix some crashes and deadlocks in FormatAnsiTerminalCodes

This patch fixes a few problems with the FormatAnsiTerminalCodes function:

* It does an infinite loop on an unknown color value.
* It crashes when the color value is at the end of the string.
* It deletes the first character behind the color token.

Also added a few tests that reproduce those problems (and test some other corner cases).

Reviewers: davide, labath

Reviewed By: labath

Subscribers: labath, lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D49307

LLVM/llvm 337188lldb/trunk/lit/SymbolFile/DWARF find-basic-function.cpp

Fix typo in find-basic-function test

Wrong FileCheck header meant that we were not matching what we should.

This allows us to get rid of the -allow-deprecated-dag-overlap flag in
the test.

LLVM/llvm 337187compiler-rt/trunk/lib/fuzzer FuzzerTracePC.cpp FuzzerLoop.cpp, compiler-rt/trunk/test/fuzzer PrintUnstableStatsTest.cpp print_unstable_stats.test

[libFuzzer] Implement stat::stability_rate based on the percentage of unstable edges.

Created a -print_unstable_stats flag.
When -print_unstable_stats=1, we run it 2 more times on interesting inputs poisoning 
unstable edges in an array.
On program termination, we run PrintUnstableStats() which will print a line with a 
stability percentage like AFL does.

Patch by Kyungtak Woo (@kevinwkt).

Reviewers: metzman, Dor1s, kcc, morehouse

Reviewed By: metzman, Dor1s, morehouse

Subscribers: delcypher, llvm-commits, #sanitizers, kcc, morehouse, Dor1s

Differential Revision: https://reviews.llvm.org/D49212

LLVM/llvm 337186llvm/trunk/lib/CodeGen RegAllocGreedy.cpp, llvm/trunk/test/CodeGen/X86 limit-split-cost.mir

[RegAlloc] Skip global splitting if the live range is huge and its spill is
trivially rematerializable.

We run into a case where machineLICM hoists a large number of live ranges
outside of a big loop because it thinks those live ranges are trivially
rematerializable. In regalloc, global splitting is tried out first for those
live ranges before they are spilled and rematerialized. Because the global
splitting algorithm is quadratic, increasing a lot of global splitting
candidates causes huge compile time increase (50s to 1400s on my local
machine when compiling a module).

However, we think for live ranges which are very large and are trivially
rematerialiable, it is better to just skip global splitting so as to save
compile time with little chance of sacrificing performance.  We uses the
segment size of live range to indirectly evaluate whether the global
splitting of the live range can introduce high cost, and use an option
as a knob to adjust the size limit threshold.

Differential Revision: https://reviews.llvm.org/D49353

LLVM/llvm 337185cfe/trunk/lib/CodeGen BackendUtil.cpp

Restore "[ThinLTO] Ensure we always select the same function copy to import"

This reverts commit r337082, restoring r337051, since the LLVM side
patch has been restored.

LLVM/llvm 337184llvm/trunk/include/llvm/Transforms/IPO FunctionImport.h, llvm/trunk/lib/Transforms/IPO FunctionImport.cpp

Restore "[ThinLTO] Ensure we always select the same function copy to import"

This reverts commit r337081, therefore restoring r337050 (and fix in
r337059), with test fix for bot failure described after the original
description below.

In order to always import the same copy of a linkonce function,
even when encountering it with different thresholds (a higher one then a
lower one), keep track of the summary we decided to import.
This ensures that the backend only gets a single definition to import
for each GUID, so that it doesn't need to choose one.

Move the largest threshold the GUID was considered for import into the
current module out of the ImportMap (which is part of a larger map
maintained across the whole index), and into a new map just maintained
for the current module we are computing imports for. This saves some
memory since we no longer have the thresholds maintained across the
whole index (and throughout the in-process backends when doing a normal
non-distributed ThinLTO build), at the cost of some additional
information being maintained for each invocation of ComputeImportForModule
(the selected summary pointer for each import).

There is an additional map lookup for each callee being considered for
importing, however, this was able to subsume a map lookup in the
Worklist iteration that invokes computeImportForFunction. We also are

    [29 lines not shown]

LLVM/llvm 337183lld/trunk/ELF InputFiles.cpp InputSection.cpp

[ELF] - Eliminate ObjFile<ELFT>::getLineInfo. NFC.

Flow is the same, but a bit shorter after this change.

LLVM/llvm 337182lld/trunk/test/ELF x86-64-reloc-range-debug-loc.s

[ELF] - Cover ObjFile<ELFT>::getLineInfo() with a test.

There was no test for the first `return`.

LLVM/llvm 337181llvm/trunk/docs CFIVerify.rst, llvm/trunk/test/tools/llvm-cfi-verify Unsupported

[cfi-verify] Abort on unsupported targets

As suggested in the review for r337007, this makes cfi-verify abort on unsupported targets 
instead of producing incorrect results.  It also updates the design document to reflect 

Differential Revision: https://reviews.llvm.org/D49304

LLVM/llvm 337180compiler-rt/trunk/lib/fuzzer FuzzerTracePC.h FuzzerTracePC.cpp, compiler-rt/trunk/test/fuzzer PrintUnstableStatsTest.cpp print_unstable_stats.test

Revert r337175 (https://reviews.llvm.org/D49212) due to unintentional format changes.

LLVM/llvm 337179llvm/trunk/test/Transforms/InstCombine sdiv.ll

[InstrSimplify] add testcases for fold sdiv if two operands are negatived and non-overflow

Differential Revision: https://reviews.llvm.org/D49365

LLVM/llvm 337178compiler-rt/trunk/lib/cfi cfi.cc

Fix warnings in a static assert added to CFI.

LLVM/llvm 337177llvm/trunk/lib/Target/X86 X86SpeculativeLoadHardening.cpp, llvm/trunk/test/CodeGen/X86 speculative-load-hardening.ll

[x86/SLH] Completely rework how we sink post-load hardening past data
invariant instructions to be both more correct and much more powerful.

While testing, I continued to find issues with sinking post-load
hardening. Unfortunately, it was amazingly hard to create any useful
tests of this because we were mostly sinking across copies and other
loading instructions. The fact that we couldn't sink past normal
arithmetic was really a big oversight.

So first, I've ported roughly the same set of instructions from the data
invariant loads to also have their non-loading varieties understood to
be data invariant. I've also added a few instructions that came up so
often it again made testing complicated: inc, dec, and lea.

With this, I was able to shake out a few nasty bugs in the validity
checking. We need to restrict to hardening single-def instructions with
defined registers that match a particular form: GPRs that don't have
a NOREX constraint directly attached to their register class.

The (tiny!) test case included catches all of the issues I was seeing
(once we can sink the hardening at all) except for the NOREX issue. The
only test I have there is horrible. It is large, inexplicable, and
doesn't even produce an error unless you try to emit encodings. I can
keep looking for a way to test it, but I'm out of ideas really.

    [5 lines not shown]

LLVM/llvm 337176compiler-rt/trunk/lib/xray xray_basic_logging.cc

Test commit

LLVM/llvm 337175compiler-rt/trunk/lib/fuzzer FuzzerTracePC.h FuzzerTracePC.cpp, compiler-rt/trunk/test/fuzzer PrintUnstableStatsTest.cpp print_unstable_stats.test

[libFuzzer] Implement stat::stability_rate based on the percentage of unstable edges.

Created a -print_unstable_stats flag.
When -print_unstable_stats=1, we run it 2 more times on interesting inputs poisoning 
unstable edges in an array.
On program termination, we run PrintUnstableStats() which will print a line with a 
stability percentage like AFL does.

Patch by Kyungtak Woo (@kevinwkt).

Reviewers: metzman, Dor1s, kcc, morehouse

Reviewed By: metzman, Dor1s, morehouse

Subscribers: delcypher, llvm-commits, #sanitizers, kcc, morehouse, Dor1s

Differential Revision: https://reviews.llvm.org/D49212

LLVM/llvm 337174compiler-rt/trunk/test/profile instrprof-gcov-exceptions.test, compiler-rt/trunk/test/profile/Inputs instrprof-gcov-exceptions.cpp.gcov instrprof-gcov-exceptions.cpp

[gcov] Add a test showing differences in line counts when building with or without 
exceptions enabled.

Test for https://bugs.llvm.org/show_bug.cgi?id=38066.

LLVM/llvm 337173lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered Makefile

Fix TestDataFormatterUnordered for older libc++ versions

clang recently started diagnosing "exception specification in
declaration does not match previous declaration" errors. Unfortunately
old libc++ versions had a bug, where they violated this rule, which
means that tests using this library version now fail due to build

Since it was easy to work around the bug by compiling this test with
-fno-exceptions, I do that here. If supporting old libc++ versions
becomes a burden, we'll have to revisit this.

LLVM/llvm 337172cfe/trunk/unittests/AST ASTImporterTest.cpp

[ASTImporter] Changed constant int to unsigned int in test code.

LLVM/llvm 337171llvm/trunk/lib/Target/Mips Mips64InstrInfo.td MipsInstrInfo.td

[mips] Eliminate the usage of hasStdEnc in MipsPat.

Instead, the pattern is tagged with the correct predicate when
it is declared. Some patterns have been duplicated as necessary.

Patch by Simon Dardis.

Differential revision: https://reviews.llvm.org/D48365

LLVM/llvm 337170compiler-rt/trunk/lib/cfi cfi.cc

[cfi] Don't pass a uint16_t to memset. Make sure the 16-bit constant is appropriate for 

Reviewers: eugenis, pcc, kcc

Subscribers: delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D49252