LLVM/llvm 323320llvm/trunk/lib/Target/X86 X86ISelLowering.cpp

[X86][SSE] Avoid calls to combineX86ShufflesRecursively that can't combine to target 
shuffles (PR32037)

Don't bother making recursive calls to combineX86ShufflesRecursively if we have more 
shuffle source operands than will be combined together with the remaining recursive depth.

See https://bugs.llvm.org/show_bug.cgi?id=32037#c26 and 
https://bugs.llvm.org/show_bug.cgi?id=32037#c27 for the reduction in compile times from 
this patch.

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

LLVM/llvm 323319cfe/trunk/lib/Format Format.cpp

[clang-format] Disable string literal breaking for text protos

Summary:
Commonly string literals in protos are already multiline, so breaking them
further is undesirable.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

LLVM/llvm 323318llvm/trunk/include/llvm/DebugInfo/DWARF DWARFVerifier.h, llvm/trunk/include/llvm/MC MCCodePadder.h

Fix typos of occurred and occurrence

LLVM/llvm 323317llvm/trunk/docs LangRef.rst

Fixes Sphinx issue ('undefined label') introduced in r323313.
(and also slightly reformatted the related lines to look better in
the rendered HTML)

LLVM/llvm 323316cfe/trunk/docs ClangFormatStyleOptions.rst, cfe/trunk/include/clang/Analysis CloneDetection.h

Fix typos of occurred and occurrence

LLVM/llvm 323315compiler-rt/trunk/lib/builtins clear_cache.c

[builtins] Align addresses to cache lines in __clear_cache for aarch64

This makes sure that the last cache line gets invalidated properly.

This matches the example code at
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0024a/BABJDBHI.html,
and also matches what libgcc does.

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

LLVM/llvm 323314llvm/trunk/lib/FuzzMutate FuzzerCLI.cpp

[llvm-opt-fuzzer] Add couple of popular passes

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

LLVM/llvm 323313llvm/trunk/include/llvm/IR DebugInfoMetadata.h, llvm/trunk/lib/AsmParser LLParser.cpp

[Metadata] Extend 'count' field of DISubrange to take a metadata node

Summary:
This patch extends the DISubrange 'count' field to take either a
(signed) constant integer value or a reference to a DILocalVariable
or DIGlobalVariable.

This is patch [1/3] in a series to extend LLVM's DISubrange Metadata
node to support debugging of C99 variable length arrays and vectors with
runtime length like the Scalable Vector Extension for AArch64. It is
also a first step towards representing more complex cases like arrays
in Fortran.

Reviewers: echristo, pcc, aprantl, dexonsmith, clayborg, kristof.beyls, dblaikie

Reviewed By: aprantl

Subscribers: rnk, probinson, fhahn, aemerson, rengolin, JDevlieghere, llvm-commits

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

LLVM/llvm 323312llvm/trunk/lib/CodeGen/SelectionDAG DAGCombiner.cpp, llvm/trunk/test/CodeGen/AMDGPU concat_vectors.ll

[DAGCombiner] Bail out if vector size is not a multiple

For the included test case, the DAG transformation
  concat_vectors(scalar, undef) -> scalar_to_vector(sclr)
would attempt to create a v2i32 vector for a v9i8
concat_vector.  Bail out to avoid creating a bitcast with
mismatching sizes later on.

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

LLVM/llvm 323311llvm/trunk/docs ExceptionHandling.rst

[Doc] Guideline on adding exception handling support for a target

Summary:
This is the first attempt to write down a guideline on adding exception handling support 
for a target. The content basically bases on the discussion on [1]. If you guys know who 
is exception handling expert, please add him as the reviewer. Thanks.

[1] http://lists.llvm.org/pipermail/llvm-dev/2018-January/120405.html

Reviewers: t.p.northover, theraven, nemanjai

Reviewed By: theraven

Subscribers: sdardis, llvm-commits

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

LLVM/llvm 323310cfe/trunk/unittests/AST PostOrderASTVisitor.cpp CMakeLists.txt, cfe/trunk/unittests/Tooling RecursiveASTVisitorTestPostOrderVisitor.cpp CMakeLists.txt

Refactor RecursiveASTVisitor test for post-order traversal

Summary:
The new test is now in the right directory with the other ASTVisitor tests and uses
now the provided TestVisitor framework.

Subscribers: hintonda, v.g.vassilev, klimek, cfe-commits, mgorny

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

LLVM/llvm 323309llvm/trunk/lib/Transforms/Scalar InductiveRangeCheckElimination.cpp, llvm/trunk/test/Transforms/IRCE optimistic_scev.ll

[NFC] Remove overconfident assert from IRCE

This patch removes assert that SCEV is able to prove that a value is
non-negative. In fact, SCEV can sometimes be unable to do this because
its cache does not update properly. This assert will be returned once this
problem is resolved.

LLVM/llvm 323308llvm/trunk/lib/Target/ARM ARMISelLowering.cpp, llvm/trunk/test/CodeGen/ARM/Windows vla.ll alloca.ll

[ARM] Call __chkstk for dynamic stack allocation in all windows environments

This matches what MSVC does for alloca() function calls on ARM.
Even if MSVC doesn't support VLAs at the language level, it does
support the alloca function.

On the clang level, both the _alloca() (when emulating MSVC, which is
what the alloca() function expands to) and __builtin_alloca() builtin
functions, and VLAs, map to the same LLVM IR "alloca" function - so
within LLVM they're not distinguishable from each other.

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

LLVM/llvm 323307llvm/trunk/lib/CodeGen GlobalMerge.cpp, llvm/trunk/test/CodeGen/ARM global-merge-dllexport.ll global-merge-external.ll

[GlobalMerge] Don't merge dllexport globals

Merging such globals loses the dllexport attribute. Add a test
to check that normal globals still are merged.

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

LLVM/llvm 323306libcxx/trunk/test/std/utilities/meta/meta.type.synop endian.pass.cpp

include <cstdint> to get uint32_t

LLVM/llvm 323305llvm/trunk/lib/Target/X86 X86ScheduleZnver1.td

[X86] Move 'Y' to correct place in FMA4 regular expression in Znver1 scheduler model.

I think these instructions used to be named differently and the regular expression 
reflected that. I guess we must have correct itinerary information that made this not 
matter for the scheduler test?

LLVM/llvm 323304llvm/trunk/lib/Target/X86 X86InstrInfo.cpp X86InstrXOP.td

[X86] Rename 256-bit VFRCZ instructions to have the Y before the rr/rm to match other 
instructions. NFC

LLVM/llvm 323303llvm/trunk/lib/Target/X86 X86ScheduleZnver1.td

[X86] Remove redundant regular expression from the Znver1 scheduler model. NFC

LLVM/llvm 323302llvm/trunk/test/CodeGen/AArch64 arm64-stp-aa.ll, llvm/trunk/test/CodeGen/AMDGPU sgpr-copy.ll

[NFC] fix trivial typos in comments

"the the" -> "the"

LLVM/llvm 323301llvm/trunk/lib/Target/X86 X86ISelLowering.cpp X86InstrAVX512.td

[X86] Use ISD::SIGN_EXTEND instead of X86ISD::VSEXT for mask to xmm/ymm/zmm conversion

There are a couple tricky things with this patch.

I had to add an override of isVectorLoadExtDesirable to stop DAG combine from combining 
sign_extend with loads after legalization since we legalize sextload using a 
load+sign_extend. Overriding this hook actually prevents a lot sextloads from being 
created in the first place.

I also had to add isel patterns because DAG combine blindly combines sign_extend+truncate 
to a smaller sign_extend which defeats what legalization was trying to do.

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

LLVM/llvm 323300libcxx/trunk/include __config

libcxx: Allow auto-linking to be disabled with a macro.

Some users may have a custom build system which gives a different
name to the libc++ archive (or does not create an archive at all,
instead passing the object files directly to the linker). Give those
users a way to disable auto-linking.

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

LLVM/llvm 323299lld/trunk/test/wasm invalid-stack-size.ll archive.ll

[WebAssembly] Use inline target tripple in test cases

This is somewhat preferable since (in many cases) it allows llc
to be run directly on the .ll files without having to pass the
`-mtriple` argument.

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

LLVM/llvm 323298llvm/trunk/include/llvm/IR Dominators.h, llvm/trunk/include/llvm/Support GenericDomTreeConstruction.h GenericDomTree.h

[Dominators] Introduce DomTree verification levels

Summary:
Currently, there are 2 ways to verify a DomTree:
* `DT.verify()` -- runs full tree verification and checks all the properties and gives a 
reason why the tree is incorrect. This is run by when EXPENSIVE_CHECKS are enabled or when 
`-verify-dom-info` flag is set.
* `DT.verifyDominatorTree()` -- constructs a fresh tree and compares it against the old 
one. This does not check any other tree properties (DFS number, levels), nor ensures that 
the construction algorithm is correct. Used by some passes inside assertions.

This patch introduces DomTree verification levels, that try to close the gape between the 
two ways of checking trees by introducing 3 verification levels:
- Full -- checks all properties, but can be slow (O(N^3)). Used when manually requested 
(e.g. `assert(DT.verify())`) or when  `-verify-dom-info` is set.
- Basic -- checks all properties except the sibling property, and compares the current 
tree with a freshly constructed one instead. This should catch almost all errors, but does 
not guarantee that the construction algorithm is correct. Used when EXPENSIVE checks are 
enabled.
- Fast -- checks only basic properties (reachablility, dfs numbers, levels, roots), and 
compares with a fresh tree. This is meant to replace the legacy `DT.verifyDominatorTree()` 
and in my tests doesn't cause any noticeable performance impact even in the most 
pessimistic examples.

When used to verify dom tree wrapper pass analysis on sqlite3, the 3 new levels make `opt 

    [17 lines not shown]

LLVM/llvm 323297llvm/trunk/lib/Target TargetMachine.cpp, llvm/trunk/test/CodeGen/X86 finite-libcalls.ll negative-sin.ll

Don't assume a null GV is local for ELF and MachO.

This is already a simplification, and should help with avoiding a plt
reference when calling an intrinsic with -fno-plt.

With this change we return false for null GVs, so the caller only
needs to check the new metadata to decide if it should use foo at plt or
*foo at got.

LLVM/llvm 323296libcxx/trunk/include type_traits, libcxx/trunk/test/std/utilities/meta/meta.type.synop endian.pass.cpp

Implement P0463R1: 'Endian just Endian'. Reviewed as https://reviews.llvm.org/D35472

LLVM/llvm 323295llvm/trunk/lib/Target/Hexagon HexagonISelLoweringHVX.cpp

Remove set but unused variable IsUndef.

LLVM/llvm 323294cfe/trunk/lib/Format UnwrappedLineParser.cpp

Attempt to fix implicit-fallthrough warning after r323218.

LLVM/llvm 323293cfe/trunk/lib/Format TokenAnnotator.cpp

Fix typo in comment.

LLVM/llvm 323292llvm/trunk/lib/Target/X86 X86ISelLowering.cpp, llvm/trunk/test/Transforms/CodeGenPrepare/X86 x86-shuffle-sink.ll

X86: Update isVectorShiftByScalarCheap with cases covered by AVX512BW

Summary:
AVX512BW adds support for variable shift amount for 16-bit element
vectors.

Reviewers: craig.topper, RKSimon, spatel

Reviewed By: RKSimon

Subscribers: rengolin, tschuett, llvm-commits

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

LLVM/llvm 323291llvm/trunk/lib/CodeGen/GlobalISel InstructionSelect.cpp, llvm/trunk/test/CodeGen/AArch64/GlobalISel select-int-ext.mir select-bitcast.mir

[GISel]: Remove redundant copies at the end of ISel

https://reviews.llvm.org/D42402

A lot of these copies are useless (copies b/w VRegs having the same
regclass) and should be cleaned up.

LLVM/llvm 323290llvm/trunk/include/llvm/Object Wasm.h, llvm/trunk/lib/Object WasmObjectFile.cpp

[WebAssembly] Add minor helper functions to WasmObjectFile

Also, fix crash when exporting an imported function.

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

LLVM/llvm 323289llvm/trunk/lib/Target/AArch64 AArch64.td, llvm/trunk/test/CodeGen/AArch64 merge-store.ll arm64-stp.ll

AArch64: Cyclone: Remove SlowMisaligned128Store tuning flag

Remove FeatureSlowMisaligned128Store from cyclone flags.
This flag causes splitting of 16 byte wide stores into 2 stored of 8
bytes. This was useful on older apple CPUs which were slow for 16byte
stores that were not aligned on 16byte. As the compiler often cannot
predict the actual alignment, the splitting was choosen.

This has been a topic for a lot of debate as the splitting also
decreases performance for some benchmarks. Measuring the effects on
newer apple chips (rdar://35525421) shows that it harms more cases than
it helps. So it is time to retire this workaround.

LLVM/llvm 323288lld/trunk/ELF/Arch X86.cpp, lld/trunk/test/ELF i386-retpoline-nopic.s

Fix retpoline PLT header size for i386.

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

LLVM/llvm 323287lld/trunk/test/wasm many-functions.ll locals-duplicate.test

Remove trailing whitespace.

LLVM/llvm 323286lld/trunk/wasm Writer.cpp

[WebAssembly] Remove excess debugging. NFC.

LLVM/llvm 323285cfe/trunk/test/Driver solaris-ld.c

Fix test Driver/solaris-ld.c for Windows.

- Test needs to be able to handle "clang.exe" on Windows
- Test needs to be able to handle either '/' or '\\' used as the path separator

Reviewed by Paul Robinson

LLVM/llvm 323284polly/trunk/include/polly ScopInfo.h, polly/trunk/lib/Analysis ScopBuilder.cpp ScopInfo.cpp

[ScopBuilder] Prefer PHI Write accesses in the statement the incoming value is defined.

Theoretically, a PHI write can be added to any statement that represents
the incoming basic block. We previously always chose the last because
the incoming value's definition is guaranteed to be defined.

With this patch the PHI write is added to the statement that defines the
incoming value. It avoids the requirement for a scalar dependency between
the defining statement and the statement containing the write. As such the
logic for -polly-stmt-granularity=scalar-indep that ensures that there is
such scalar dependencies can be removed.

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

LLVM/llvm 323283polly/trunk/include/polly/Support VirtualInstruction.h, polly/trunk/lib/Support VirtualInstruction.cpp

[VirtualInst] Derive correct use kind of PHI operands. NFC.

VirtualUse::create is only called for MemoryKind::Value, but its
consistency nonetheless checked in verifyUses(). PHI uses are always
inter-stmt dependencies, which was not considered by the constructor
method. The virtual and non-virtual execution paths were the same, such
that verifyUses did not encounter any inconsistencies.

LLVM/llvm 323282lld/trunk/test/wasm weak-alias.ll

[WebAssembly] Add --relocatable test to test/wasm/weak-alias.ll. NFC.

There seems to be an bug related to table relocations not being
written correctly in this case.  This change is intended simply
to increase the coverage, not fix the issue.

LLVM/llvm 323281cfe/trunk/lib/Basic/Targets X86.h, cfe/trunk/test/CodeGenCXX atomic-inline.cpp

Adjust MaxAtomicInlineWidth for i386/i486 targets.

This is to fix the bug reported in https://bugs.llvm.org/show_bug.cgi?id=34347#c6.
Currently, all  MaxAtomicInlineWidth of x86-32 targets are set to 64. However,
i386 doesn't support any cmpxchg related instructions. i486 only supports cmpxchg.
So in this patch MaxAtomicInlineWidth is reset as follows:
For i386, the MaxAtomicInlineWidth should be 0 because no cmpxchg is supported.
For i486, the MaxAtomicInlineWidth should be 32 because it supports cmpxchg.
For others 32 bits x86 cpu, the MaxAtomicInlineWidth should be 64 because of cmpxchg8b.

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

LLVM/llvm 323280llvm/trunk/tools/llvm-readobj COFFDumper.cpp

[llvm-readobj] Fix double 0x prefix in RVA table printing after r321527

LLVM/llvm 323279compiler-rt/trunk/lib/sanitizer_common sanitizer_common_interceptors.inc

Break a line into <= 80 characters

LLVM/llvm 323278compiler-rt/trunk/lib/scudo scudo_allocator.cpp scudo_platform.h

[scudo] Allow for weak hooks, gated by a define

Summary:
Hooks in the allocation & deallocation paths can be a security risk (see for an
example 
https://scarybeastsecurity.blogspot.com/2016/11/0day-exploit-advancing-exploitation.html
which used the glibc's __free_hook to complete exploitation).

But some users have expressed a need for them, even if only for tests and
memory benchmarks. So allow for `__sanitizer_malloc_hook` &
`__sanitizer_free_hook` to be called if defined, and gate them behind a global
define `SCUDO_CAN_USE_HOOKS` defaulting to 0.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: #sanitizers, llvm-commits

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

LLVM/llvm 323277llvm/trunk/utils/TableGen CodeGenSchedule.cpp

[TableGen] Optimize the regex search.

llvm::Regex is still the slowest regex engine on earth, running it over
all instructions on X86 takes a while. Extract a prefix and use a binary
search to reduce the search space before we resort to regex matching.

There are a couple of caveats here:
- The generic opcodes are outside of the sorted enum. They're handled in an extra loop.
- If there's a top-level bar we can't use the prefix trick.
- We bail on top-level ?. This could be handled, but it's rare.

This brings the time to generate X86GenInstrInfo.inc from 21s to 4.7s on
my machine.

LLVM/llvm 323276llvm/trunk/include/llvm/TableGen Record.h, llvm/trunk/lib/TableGen Record.cpp

[TblGen] Inline an (almost) trivial accessor. No functionality change.

LLVM/llvm 323275llvm/trunk/test/MC/WebAssembly external-func-address.ll external-data.ll

[WebAssembly] MC: Use inline triple in test bitcode files

This matches the CodeGen tests and makes it a little easy
to run these from the command line manually.

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

LLVM/llvm 323274llvm/trunk/include/llvm/Transforms IPO.h

Add missing include to fix the failure caused by r323266

LLVM/llvm 323273compiler-rt/trunk/lib/sanitizer_common sanitizer_common_interceptors.inc sanitizer_platform_interceptors.h, compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD paccept.cc

Add a new interceptor: paccept(2)

Summary:
paccept(2) is a NetBSD-specific variation of accept(2).

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, eugenis

Reviewed By: vitalybuka

Subscribers: llvm-commits, kubamracek, #sanitizers

Tags: #sanitizers

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

LLVM/llvm 323272llvm/trunk/test/MC/WebAssembly weak-alias.ll

[WebAssembly] Add to test expectations for test/MC/WebAssembly/weak-alias.ll. NFC.

Split out from D42095

LLVM/llvm 323271llvm/trunk/lib/Transforms/IPO BlockExtractor.cpp

BlockExtractor: Remove unused variable. NFC.