platform/upstream/llvm.git
7 years ago[MetaRenamer] Don't rename library functions.
Bryant Wong [Thu, 23 Mar 2017 23:21:07 +0000 (23:21 +0000)]
[MetaRenamer] Don't rename library functions.

Library functions can have specific semantics that affect the behavior of
certain passes. DSE, for instance, gives special treatment to malloc-ed pointers
but not to pointers returned from an equivalently typed (but differently named)
function.

MetaRenamer ought not to alter program semantics, so library functions must
remain untouched.

Reviewers: mehdi_amini, majnemer, chandlerc, davide

Reviewed By: davide

Subscribers: davide, llvm-commits

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

llvm-svn: 298659

7 years agoAdd strtok interceptor for ASAN for Windows.
Alex Shlyapnikov [Thu, 23 Mar 2017 23:20:47 +0000 (23:20 +0000)]
Add strtok interceptor for ASAN for Windows.

Summary: Fixes test broken by D30384

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 298658

7 years agoRemove all uses of std::mem_fun and std::bind1st removed in C++17.
Richard Smith [Thu, 23 Mar 2017 23:17:58 +0000 (23:17 +0000)]
Remove all uses of std::mem_fun and std::bind1st removed in C++17.

llvm-svn: 298657

7 years agoUse isFunctionHotInCallGraph to set the function section prefix.
Dehao Chen [Thu, 23 Mar 2017 23:14:11 +0000 (23:14 +0000)]
Use isFunctionHotInCallGraph to set the function section prefix.

Summary: The current prefix based function layout algorithm only looks at function's entry count, which is not sufficient. A function should be grouped together if its entry count or any call edge count is hot.

Reviewers: davidxl, eraman

Reviewed By: eraman

Subscribers: llvm-commits

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

llvm-svn: 298656

7 years ago[Hexagon] Avoid infinite loops in HexagonLoopIdiomRecognition
Krzysztof Parzyszek [Thu, 23 Mar 2017 23:01:22 +0000 (23:01 +0000)]
[Hexagon] Avoid infinite loops in HexagonLoopIdiomRecognition

- Avoid explosive growth of the simplification queue by not queuing
  expressions that are alredy in it.
- Add an iteration counter and abort after a sufficiently large number
  of iterations (assuming that it's a symptom of an infinite loop).

llvm-svn: 298655

7 years ago[libFuzzer] create experimental support for user-provided coverage signal
Kostya Serebryany [Thu, 23 Mar 2017 22:43:12 +0000 (22:43 +0000)]
[libFuzzer] create experimental support for user-provided coverage signal

llvm-svn: 298654

7 years ago[CMake] Provide an option to disable runtimes build
Petr Hosek [Thu, 23 Mar 2017 22:40:10 +0000 (22:40 +0000)]
[CMake] Provide an option to disable runtimes build

This could be used to either disable the runtimes build altogether
or avoid building them but still generate the build targets.

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

llvm-svn: 298653

7 years agoMove spill size and alignment info from MC to TargetRegisterInfo
Krzysztof Parzyszek [Thu, 23 Mar 2017 22:32:22 +0000 (22:32 +0000)]
Move spill size and alignment info from MC to TargetRegisterInfo

This is another step towards implementing register classes with
parametrized register/spill sizes.

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

llvm-svn: 298652

7 years ago[Outliner] Remove unused lambda capture.
Jessica Paquette [Thu, 23 Mar 2017 22:17:20 +0000 (22:17 +0000)]
[Outliner] Remove unused lambda capture.

Remove an unused lambda capture that made some bots unhappy.

llvm-svn: 298651

7 years ago[asan] Add an interceptor for strtok
Alex Shlyapnikov [Thu, 23 Mar 2017 21:39:52 +0000 (21:39 +0000)]
[asan] Add an interceptor for strtok

Summary:
This change addresses https://github.com/google/sanitizers/issues/766. I
tested the change with make check-asan and the newly added test case.

Reviewers: ygribov, kcc, alekseyshl

Subscribers: kubamracek, llvm-commits

Patch by mrigger

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

llvm-svn: 298650

7 years ago[PDB] Use two DBs when dumping the IPI stream
Reid Kleckner [Thu, 23 Mar 2017 21:36:25 +0000 (21:36 +0000)]
[PDB] Use two DBs when dumping the IPI stream

Summary:
When dumping these records from an object file section, we should use
only one type database. However, when dumping from a PDB, we should use
two: one for the type stream and one for the IPI stream.

Certain type records that normally live in the .debug$T object file
section get moved over to the IPI stream of the PDB file and they get
new indices.

So far, I've noticed that the MSVC linker always moves these records
into IPI:
- LF_FUNC_ID
- LF_MFUNC_ID
- LF_STRING_ID
- LF_SUBSTR_LIST
- LF_BUILDINFO
- LF_UDT_MOD_SRC_LINE

These records have index fields that can point into TPI or IPI. In
particular, LF_SUBSTR_LIST and LF_BUILDINFO point to LF_STRING_ID
records to describe compilation command lines.

I've modified the dumper to have an optional pointer to the item DB, and
to do type name lookup of these fields in that DB. See printItemIndex.
The result is that our pdbdump-headers.test is more faithful to the PDB
contents and the output is less confusing.

Reviewers: ruiu

Subscribers: amccarth, zturner, llvm-commits

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

llvm-svn: 298649

7 years ago[Outliner] Fix compile-time overhead for candidate choice
Jessica Paquette [Thu, 23 Mar 2017 21:27:38 +0000 (21:27 +0000)]
[Outliner] Fix compile-time overhead for candidate choice

The old candidate collection method in the outliner caused some very large
regressions in compile time on large tests. For MultiSource/Benchmarks/7zip it
caused a 284.07 s or 1156% increase in compile time. On average, using the
SingleSource/MultiSource tests, it caused an average increase of 8 seconds in
compile time (something like 1000%).

This commit replaces that candidate collection method with a new one which
only visits each node in the tree once. This reduces the worst compile time
increase (still 7zip) to a 0.542 s overhead (22%) and the average compile time
increase on SingleSource and MultiSource to 0.018 s (4%).

llvm-svn: 298648

7 years agoUpdate the SamplePGO test to verify that unroll/icp is not invoked in thinlto compile...
Dehao Chen [Thu, 23 Mar 2017 21:20:17 +0000 (21:20 +0000)]
Update the SamplePGO test to verify that unroll/icp is not invoked in thinlto compile phase.

Summary: This is the test added for https://reviews.llvm.org/D31217

Reviewers: tejohnson, mehdi_amini

Reviewed By: tejohnson

Subscribers: cfe-commits, Prazek

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

llvm-svn: 298647

7 years agoDisable loop unrolling and icp in SamplePGO ThinLTO compile phase
Dehao Chen [Thu, 23 Mar 2017 21:20:05 +0000 (21:20 +0000)]
Disable loop unrolling and icp in SamplePGO ThinLTO compile phase

Summary:
loop unrolling and icp will make the sample profile annotation much harder in the backend. So disable these 2 optimization in the ThinLTO compile phase.
Will add a test in cfe in a separate patch.

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: mehdi_amini, llvm-commits, Prazek

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

llvm-svn: 298646

7 years agoRemove unnecessary use of std::result_of, which is deprecated in C++17.
Richard Smith [Thu, 23 Mar 2017 21:02:31 +0000 (21:02 +0000)]
Remove unnecessary use of std::result_of, which is deprecated in C++17.

llvm-svn: 298645

7 years ago[InstCombine] Remove some code from visitAnd that dealt with trying to reduce the...
Craig Topper [Thu, 23 Mar 2017 21:00:13 +0000 (21:00 +0000)]
[InstCombine] Remove some code from visitAnd that dealt with trying to reduce the LHS of a sub to 0. This should now be fully handled by SimplifyDemandedInstructionBits now.

Now that we call ShrinkDemandedConstant on the RHS of sub this should be taken care of. This code doesn't trigger on any in tree regressions, but did before ShrinkDemandedConstant was added to the RHS.

llvm-svn: 298644

7 years agoLLVM Changes for alloc_align
Erich Keane [Thu, 23 Mar 2017 20:38:34 +0000 (20:38 +0000)]
LLVM Changes for alloc_align

GCC has the alloc_align attribute, which is similar to assume_aligned, except the attribute's parameter is the index of the integer parameter that needs aligning to.

This is the required LLVM changes to make this happen.

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

llvm-svn: 298643

7 years agoZero-Initialize PrevInstBB when entering a new MachineFunction.
Adrian Prantl [Thu, 23 Mar 2017 20:23:42 +0000 (20:23 +0000)]
Zero-Initialize PrevInstBB when entering a new MachineFunction.

It is not guaranteed that the memory used for MachineBasicBlocks in
the previous MachineFunction hasn't been freed, so holding on to a
pointer to the last function's isn't correct. Particularly I have
observed the sret.ll testcase failing because the first BasicBlock in
the new function happened to be allocated to the exact same memory as
the previously saved and (deleted) PrevInstBB.

llvm-svn: 298642

7 years ago[LV] Add regression test for r297610
Gil Rapaport [Thu, 23 Mar 2017 20:02:23 +0000 (20:02 +0000)]
[LV] Add regression test for r297610

The new test asserts that scalarized memory operations get memcheck metadata
added even if the loop is only unrolled.

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

llvm-svn: 298641

7 years ago[LVIPrinterPass] Print LVI info for function arguments
Anna Thomas [Thu, 23 Mar 2017 20:00:54 +0000 (20:00 +0000)]
[LVIPrinterPass] Print LVI info for function arguments

Using AssemblyAnnotationWriter for LVI printer prints
for instructions and basic blocks.
So, we explicitly need to print LVI info for the arguments of the function (these
are values and not instructions).

llvm-svn: 298640

7 years ago[ThinLTO] Clang support for emitting minimized bitcode for thin link
Teresa Johnson [Thu, 23 Mar 2017 19:47:49 +0000 (19:47 +0000)]
[ThinLTO] Clang support for emitting minimized bitcode for thin link

Summary:
Clang companion patch to LLVM patch D31027, which adds support
for emitting minimized bitcode file for use in the thin link step.
Add a cc1 option -fthin-link-bitcode=<file> to trigger this behavior.

Depends on D31027.

Reviewers: mehdi_amini, pcc

Subscribers: cfe-commits, Prazek

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

llvm-svn: 298639

7 years ago[ThinLTO] Add support for emitting minimized bitcode for thin link
Teresa Johnson [Thu, 23 Mar 2017 19:47:39 +0000 (19:47 +0000)]
[ThinLTO] Add support for emitting minimized bitcode for thin link

Summary:
The cumulative size of the bitcode files for a very large application
can be huge, particularly with -g. In a distributed build environment,
all of these files must be sent to the remote build node that performs
the thin link step, and this can exceed size limits.

The thin link actually only needs the summary along with a bitcode
symbol table. Until we have a proper bitcode symbol table, simply
stripping the debug metadata results in significant size reduction.

Add support for an option to additionally emit minimized bitcode
modules, just for use in the thin link step, which for now just strips
all debug metadata. I plan to add a cc1 option so this can be invoked
easily during the compile step.

However, care must be taken to ensure that these minimized thin link
bitcode files produce the same index as with the original bitcode files,
as these original bitcode files will be used in the backends.

Specifically:
1) The module hash used for caching is typically produced by hashing the
written bitcode, and we want to include the hash that would correspond
to the original bitcode file. This is because we want to ensure that
changes in the stripped portions affect caching. Added plumbing to emit
the same module hash in the minimized thin link bitcode file.
2) The module paths in the index are constructed from the module ID of
each thin linked bitcode, and typically is automatically generated from
the input file path. This is the path used for finding the modules to
import from, and obviously we need this to point to the original bitcode
files. Added gold-plugin support to take a suffix replacement during the
thin link that is used to override the identifier on the MemoryBufferRef
constructed from the loaded thin link bitcode file. The assumption is
that the build system can specify that the minimized bitcode file has a
name that is similar but uses a different suffix (e.g. out.thinlink.bc
instead of out.o).

Added various tests to ensure that we get identical index files out of
the thin link step.

Reviewers: mehdi_amini, pcc

Subscribers: Prazek, llvm-commits

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

llvm-svn: 298638

7 years agoKill some trailing whitespace to make some new changes a bit easier.
Eric Christopher [Thu, 23 Mar 2017 19:41:10 +0000 (19:41 +0000)]
Kill some trailing whitespace to make some new changes a bit easier.

llvm-svn: 298637

7 years ago[scudo] Add test exercising pthreads
Kostya Kortchinsky [Thu, 23 Mar 2017 19:21:10 +0000 (19:21 +0000)]
[scudo] Add test exercising pthreads

Summary: Scudo didn't have any test using multiple threads. Add one, borrowed from lsan.

Reviewers: kcc, alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 298636

7 years agoCorrect class-template deprecation behavior-REDUX
Erich Keane [Thu, 23 Mar 2017 18:51:54 +0000 (18:51 +0000)]
Correct class-template deprecation behavior-REDUX

Correct class-template deprecation behavior

Based on the comment in the test, and my reading of the standard, a deprecated warning should be issued in the following case:
template<typename T> [[deprecated]] class Foo{}; Foo<int> f;

This was not the case, because the ClassTemplateSpecializationDecl creation did not also copy the deprecated attribute.

Note: I did NOT audit the complete set of attributes to see WHICH ones should be copied, so instead I simply copy ONLY the deprecated attribute.

Previous DiffRev: https://reviews.llvm.org/D27486, was reverted.
This patch fixes the issues brought up here by the reverter: https://reviews.llvm.org/rL298410

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

llvm-svn: 298634

7 years ago[X86] Fix Stale SDNode use in X86ISelDAGtoDAG
Nirav Dave [Thu, 23 Mar 2017 18:25:17 +0000 (18:25 +0000)]
[X86] Fix Stale SDNode use in X86ISelDAGtoDAG

Summary: Fixes pr32329.

Reviewers: spatel, craig.topper

Subscribers: llvm-commits

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

llvm-svn: 298633

7 years agoFix varaible names that correspond to command line options.
Rui Ueyama [Thu, 23 Mar 2017 18:16:42 +0000 (18:16 +0000)]
Fix varaible names that correspond to command line options.

llvm-svn: 298632

7 years agoModel ashr(shl(x, n), m) as mul(x, 2^(n-m)) when n > m
Zhaoshi Zheng [Thu, 23 Mar 2017 18:06:09 +0000 (18:06 +0000)]
Model ashr(shl(x, n), m) as mul(x, 2^(n-m)) when n > m

Given below case:

  %y = shl %x, n
  %z = ashr %y, m

when n = m, SCEV models it as sext(trunc(x)). This patch tries to handle
the case where n > m by using sext(mul(trunc(x), 2^(n-m)))) as the SCEV
expression.

llvm-svn: 298631

7 years agorevert test commit r298629
Zhaoshi Zheng [Thu, 23 Mar 2017 17:52:20 +0000 (17:52 +0000)]
revert test commit r298629

llvm-svn: 298630

7 years agotest commit
Zhaoshi Zheng [Thu, 23 Mar 2017 17:38:47 +0000 (17:38 +0000)]
test commit

llvm-svn: 298629

7 years agoRemove the subtarget argument from LowerFP_TO_INT since there's one
Eric Christopher [Thu, 23 Mar 2017 17:35:08 +0000 (17:35 +0000)]
Remove the subtarget argument from LowerFP_TO_INT since there's one
stored on X86TargetLowering.

llvm-svn: 298628

7 years agoRemove unused X86Subtarget argument from getOnesVector.
Eric Christopher [Thu, 23 Mar 2017 17:35:06 +0000 (17:35 +0000)]
Remove unused X86Subtarget argument from getOnesVector.

llvm-svn: 298627

7 years agoSomehow this still breaks because of ANSI color codes in test output on Linux.
Adrian McCarthy [Thu, 23 Mar 2017 17:18:50 +0000 (17:18 +0000)]
Somehow this still breaks because of ANSI color codes in test output on Linux.
Reverting until I can figure out the root cause.

Revert "Re-land:  Make NativeExeSymbol a concrete subclass of NativeRawSymbol [PDB]"

This reverts commit f461a70cc376f0f91c8b4917be79479cc86330a5.

llvm-svn: 298626

7 years agoFix build break after r298623
Adrian McCarthy [Thu, 23 Mar 2017 16:57:53 +0000 (16:57 +0000)]
Fix build break after r298623

Use the -color-output option explicitly to eliminate the ANSI color codes in
pdb-native-summary.test.  (The default should have done this.)

llvm-svn: 298625

7 years ago[ARM] Fix computeKnownBits for ARMISD::CMOV
Pirama Arumuga Nainar [Thu, 23 Mar 2017 16:47:47 +0000 (16:47 +0000)]
[ARM] Fix computeKnownBits for ARMISD::CMOV

Summary:
The true and false operands for the CMOV are operands 0 and 1.
ARMISelLowering.cpp::computeKnownBits was looking at operands 1 and 2
instead.  This can cause CMOV instructions to be incorrectly folded into
BFI if value set by the CMOV is another CMOV, whose known bits are
computed incorrectly.

This patch fixes the issue and adds a test case.

Reviewers: kristof.beyls, jmolloy

Subscribers: llvm-commits, aemerson, srhines, rengolin

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

llvm-svn: 298624

7 years agoRe-land: Make NativeExeSymbol a concrete subclass of NativeRawSymbol [PDB]
Adrian McCarthy [Thu, 23 Mar 2017 16:45:20 +0000 (16:45 +0000)]
Re-land:  Make NativeExeSymbol a concrete subclass of NativeRawSymbol [PDB]

The new test should pass on all platforms now that llvm-pdbdump has the
`-color-output` option.

This moves exe symbol-specific method implementations out of NativeRawSymbol
into a concrete subclass. Also adds implementations for hasCTypes and
hasPrivateSymbols and a simple test to ensure the native reader can access
the summary information for the executable from the PDB.

Original Differential Revision: https://reviews.llvm.org/D31059

llvm-svn: 298623

7 years ago[index] When indexing system headers make sure to report important reference relations
Argyrios Kyrtzidis [Thu, 23 Mar 2017 16:34:47 +0000 (16:34 +0000)]
[index] When indexing system headers make sure to report important reference relations

Even if we exclude plain reference occurrences, we should include relation-based references, like the 'base' one.

rdar://31010737

llvm-svn: 298622

7 years ago[clang-tidy] Fix treating non-space whitespaces in checks list.
Marek Kurdej [Thu, 23 Mar 2017 16:32:06 +0000 (16:32 +0000)]
[clang-tidy] Fix treating non-space whitespaces in checks list.

Summary:
This furtherly improves r295303: [clang-tidy] Ignore spaces between globs in the Checks option.
Trims all whitespaces and not only spaces and correctly computes the offset of the checks list (taking the size before trimming).

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits, JDevlieghere

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

llvm-svn: 298621

7 years ago[LV] Vectorize GEPs
Matthew Simpson [Thu, 23 Mar 2017 16:29:58 +0000 (16:29 +0000)]
[LV] Vectorize GEPs

This patch adds support for vectorizing GEPs. Previously, we only generated
vector GEPs on-demand when creating gather or scatter operations. All GEPs from
the original loop were scalarized by default, and if a pointer was to be stored
to memory, we would have to build up the pointer vector with insertelement
instructions.

With this patch, we will vectorize all GEPs that haven't already been marked
for scalarization.

The patch refines collectLoopScalars to more exactly identify the scalar GEPs.
The function now more closely resembles collectLoopUniforms. And the patch
moves vector GEP creation out of vectorizeMemoryInstruction and into the main
vectorization loop. The vector GEPs needed for gather and scatter operations
will have already been generated before vectoring the memory accesses.

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

llvm-svn: 298620

7 years ago[clang-tidy] Don't use groups in the big regexy filter
Alexander Kornienko [Thu, 23 Mar 2017 16:29:39 +0000 (16:29 +0000)]
[clang-tidy] Don't use groups in the big regexy filter

Fixes https://bugs.llvm.org/show_bug.cgi?id=27641.

llvm-svn: 298619

7 years agoUpdate the algorithm tests to not use the (deprecated) function binders. No functiona...
Marshall Clow [Thu, 23 Mar 2017 16:13:50 +0000 (16:13 +0000)]
Update the algorithm tests to not use the (deprecated) function binders. No functional change.

llvm-svn: 298618

7 years ago[ScopInfo] Introduce ScopStmt::contains(BB*). NFC.
Michael Kruse [Thu, 23 Mar 2017 16:12:21 +0000 (16:12 +0000)]
[ScopInfo] Introduce ScopStmt::contains(BB*). NFC.

Provide an common way for testing if a statement contains something
for region and block statements. First user is
RegionGenerator::addOperandToPHI.

Suggested-by: Tobias Grosser <tobias@grosser.es>
llvm-svn: 298617

7 years ago[X86][SSE] Extract elements from narrower shuffle masks.
Simon Pilgrim [Thu, 23 Mar 2017 16:09:34 +0000 (16:09 +0000)]
[X86][SSE] Extract elements from narrower shuffle masks.

Add support for widening narrow shuffle masks so we can directly extract from the relevant input vector of the shuffle.

llvm-svn: 298616

7 years ago[LV] Delete unneeded scalar GEP creation code
Matthew Simpson [Thu, 23 Mar 2017 16:07:21 +0000 (16:07 +0000)]
[LV] Delete unneeded scalar GEP creation code

The code for generating scalar base pointers in vectorizeMemoryInstruction is
not needed. We currently scalarize all GEPs and maintain the scalarized values
in VectorLoopValueMap. The GEP cloning in this unneeded code is the same as
that in scalarizeInstruction. The test cases that changed as a result of this
patch changed because we were able to reuse the scalarized GEP that we
previously generated instead of cloning a new one.

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

llvm-svn: 298615

7 years ago[PPC] Add generated tests for all atomic operations
Tim Shen [Thu, 23 Mar 2017 16:02:47 +0000 (16:02 +0000)]
[PPC] Add generated tests for all atomic operations

Summary: Add tests for all atomic operations for powerpc64le, so that all changes can be easily examined.

Reviewers: kbarton, hfinkel, echristo

Subscribers: mehdi_amini, nemanjai, llvm-commits

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

llvm-svn: 298614

7 years agoBypass potential libc's sysconf interceptors
Alex Shlyapnikov [Thu, 23 Mar 2017 15:57:58 +0000 (15:57 +0000)]
Bypass potential libc's sysconf interceptors

Summary:
sysconf(_SC_PAGESIZE) is called very early during sanitizer init and
any instrumented code (sysconf() wrapper/interceptor will likely be
instrumented) calling back to sanitizer before init is done will
most surely crash.

2nd attempt, now with glibc version checks (D31092 was reverted).

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 298613

7 years ago[WebAssembly] Fix import type to be signed LEBs
Derek Schuff [Thu, 23 Mar 2017 15:46:47 +0000 (15:46 +0000)]
[WebAssembly] Fix import type to be signed LEBs

This fix is a follow up a previous change with stored
value types as signed integers in memory.

In future, once the yaml<->wasm binary patche lands we
can add test coverage for this kind of thing.

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

Patch by Sam Clegg

llvm-svn: 298612

7 years ago[x86] add memcmp tests, remove run
Sanjay Patel [Thu, 23 Mar 2017 15:38:22 +0000 (15:38 +0000)]
[x86] add memcmp tests, remove run

Add tests for vector lengths that could be handled without a libcall.

There's an explicit test for 'nobuiltin', so there's not much value
in a separate run that checks that same behavior over and over again.

llvm-svn: 298611

7 years agoAdd option to control whether llvm-pdbdump outputs in color
Adrian McCarthy [Thu, 23 Mar 2017 15:28:15 +0000 (15:28 +0000)]
Add option to control whether llvm-pdbdump outputs in color

Adds -color-output option to llvm-pdbdump pretty commands that lets the user
specify whether the output should have color. The default depends on whether
the output is going to a TTY (per prior discussion in
https://reviews.llvm.org/D31246).

This will enable tests that pipe llvm-pdbdump output to FileCheck to work
across platforms without regard to the differences in ANSI codes.

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

llvm-svn: 298610

7 years ago[GlobalISel][X86] Support G_STORE/G_LOAD operation
Igor Breger [Thu, 23 Mar 2017 15:25:57 +0000 (15:25 +0000)]
[GlobalISel][X86] Support G_STORE/G_LOAD operation

Summary:
1. Support pointer type as function argumnet and return value
2. G_STORE/G_LOAD - set legal action for i8/i16/i32/i64/f32/f64/vec128
3. RegisterBank - support typeless operations like G_STORE/G_LOAD, for scalar use GPR bank.
4. Support instruction selection for G_LOAD/G_STORE

Reviewers: zvi, rovka, ab, qcolombet

Reviewed By: rovka

Subscribers: llvm-commits, dberris, kristof.beyls, eladcohen, guyblank

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

llvm-svn: 298609

7 years ago[clang-tidy] Fix diag message for catch-by-value
Alexander Kornienko [Thu, 23 Mar 2017 15:17:44 +0000 (15:17 +0000)]
[clang-tidy] Fix diag message for catch-by-value

Summary:
```
catch (std::exception ex)
{
}
```

Was flagged with "catch handler catches a pointer value".

Reviewers: alexfh, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits, JDevlieghere

Patch by Florian Gross!

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

llvm-svn: 298608

7 years ago[clang-tidy] Catch trivially true statements like a != 1 || a != 3
Alexander Kornienko [Thu, 23 Mar 2017 15:13:54 +0000 (15:13 +0000)]
[clang-tidy] Catch trivially true statements like a != 1 || a != 3

Catch trivially true statements of the form a != 1 || a != 3. Statements like
these are likely errors. They are particularly easy to miss when handling enums:

enum State {
RUNNING,
STOPPED,
STARTING,
ENDING
}

...
if (state != RUNNING || state != STARTING)
...

Patch by Blaise Watson!

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

llvm-svn: 298607

7 years agoPublish RAIIObjectsForParser.h for external usage.
Vassil Vassilev [Thu, 23 Mar 2017 15:11:07 +0000 (15:11 +0000)]
Publish RAIIObjectsForParser.h for external usage.

Some clients (eg the cling interpreter) need to recover their parser from
errors.

Patch by Axel Naumann (D31190)!

llvm-svn: 298606

7 years agoGOMP compatibility: add missing OpenMP4.0 task deps handling code
Paul Osmialowski [Thu, 23 Mar 2017 15:03:17 +0000 (15:03 +0000)]
GOMP compatibility: add missing OpenMP4.0 task deps handling code

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

llvm-svn: 298605

7 years ago[SDAG] Fix zeroExtend assertion error
Nirav Dave [Thu, 23 Mar 2017 15:01:50 +0000 (15:01 +0000)]
[SDAG] Fix zeroExtend assertion error

Move CombineTo preventing deleted node from being returned in
visitZERO_EXTEND.

Fixes PR32284.

Reviewers: RKSimon, bogner

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 298604

7 years agoDo not polute the source directory.
Vassil Vassilev [Thu, 23 Mar 2017 14:54:34 +0000 (14:54 +0000)]
Do not polute the source directory.

When a python script is run, by default it creates the bytecode file if the directory is writable, and this â€˜pollutes’ source folders.

From python's help:
-B Don’t write .py[co] files on import. See also PYTHONDONTWRITEBYTECODE.

Patch by Pere Mato (D30604)!

llvm-svn: 298603

7 years agoDo not set branch weight if the branch weight annotation is present.
Dehao Chen [Thu, 23 Mar 2017 14:43:10 +0000 (14:43 +0000)]
Do not set branch weight if the branch weight annotation is present.

Summary: ThinLTO will annotate the CFG twice. If the branch weight is set by the first annotation, we should not set the branch weight again in the second annotation because the first annotation is more accurate as there is less optimization that could affect debug info accuracy.

Reviewers: tejohnson, davidxl

Reviewed By: tejohnson

Subscribers: mehdi_amini, aprantl, llvm-commits

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

llvm-svn: 298602

7 years ago[libcxx] Improve code generation for vector::clear().
Bruce Mitchener [Thu, 23 Mar 2017 14:39:23 +0000 (14:39 +0000)]
[libcxx] Improve code generation for vector::clear().

Summary:
By manipulating a local variable in the loop, when the loop can
be optimized away (due to no non-trivial destructors), this lets
it be fully optimized away and we modify the __end_ separately.

This results in a substantial improvement in the generated code.

Prior to this change, this would be generated (on x86_64):

    movq    (%rdi), %rdx
    movq    8(%rdi), %rcx
    cmpq    %rdx, %rcx
    je    LBB2_2
    leaq    -12(%rcx), %rax
    subq    %rdx, %rax
    movabsq    $-6148914691236517205, %rdx ## imm = 0xAAAAAAAAAAAAAAAB
    mulq    %rdx
    shrq    $3, %rdx
    notq    %rdx
    leaq    (%rdx,%rdx,2), %rax
    leaq    (%rcx,%rax,4), %rax
    movq    %rax, 8(%rdi)

And after:

    movq    (%rdi), %rax
    movq    %rax, 8(%rdi)

This brings this in line with what other implementations do.

Subscribers: cfe-commits

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

llvm-svn: 298601

7 years agoUse 'REQUIRES: c++98 || c++03 || c++11 || c++14' instead of the deprecated 'REQUIRES...
Marshall Clow [Thu, 23 Mar 2017 14:20:43 +0000 (14:20 +0000)]
Use 'REQUIRES: c++98 || c++03 || c++11 || c++14' instead of the deprecated 'REQUIRES-ANY: c++98, c++03, c++11, c++14'

llvm-svn: 298600

7 years agoX86FixupBWInsts: Minor cleanup. NFC
Zvi Rackover [Thu, 23 Mar 2017 14:08:26 +0000 (14:08 +0000)]
X86FixupBWInsts: Minor cleanup. NFC

Summary: Cleanup some remnants of code from when the X86FixupBWInsts pass did both forward liveness analysis and backward liveness analysis.

Reviewers: MatzeB, myatsina, DavidKreitzer

Reviewed By: MatzeB

Subscribers: llvm-commits

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

llvm-svn: 298599

7 years agoOne more file for the random_shuffle removal
Marshall Clow [Thu, 23 Mar 2017 13:44:06 +0000 (13:44 +0000)]
One more file for the random_shuffle removal

llvm-svn: 298598

7 years agoRemove random_shuffle in C++17. Please use shuffle instead. If you have to, you...
Marshall Clow [Thu, 23 Mar 2017 13:43:37 +0000 (13:43 +0000)]
Remove random_shuffle in C++17.  Please use shuffle instead. If you have to, you cant get it back by defining _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE before including any libc++ headers.

llvm-svn: 298597

7 years ago[Mips] Emit the correct DINS variant
Strahinja Petrovic [Thu, 23 Mar 2017 13:40:07 +0000 (13:40 +0000)]
[Mips] Emit the correct DINS variant

This patch fixes emitting of correct variant of DINS instruction.

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

llvm-svn: 298596

7 years agoUpdate to isl-0.18-402-ga30c537
Tobias Grosser [Thu, 23 Mar 2017 13:38:24 +0000 (13:38 +0000)]
Update to isl-0.18-402-ga30c537

This is a regular maintenance update.

llvm-svn: 298595

7 years ago[X86][SSE] Tidyup canWidenShuffleElements. NFCI.
Simon Pilgrim [Thu, 23 Mar 2017 13:33:03 +0000 (13:33 +0000)]
[X86][SSE] Tidyup canWidenShuffleElements. NFCI.

Pull out mask elements at the start, allowing us to make the widening pattern matching more readable.

llvm-svn: 298594

7 years ago[Mips] Fix for decoding DINS instruction - disassembler
Strahinja Petrovic [Thu, 23 Mar 2017 13:19:04 +0000 (13:19 +0000)]
[Mips] Fix for decoding DINS instruction - disassembler

This patch fixes decoding of size and position for DINSM
and DINSU instructions.

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

llvm-svn: 298593

7 years ago[X86][SSE] Add computeNumSignBits test for sitofp of (extended) i64 extracted element
Simon Pilgrim [Thu, 23 Mar 2017 13:18:09 +0000 (13:18 +0000)]
[X86][SSE] Add computeNumSignBits test for sitofp of (extended) i64 extracted element

llvm-svn: 298592

7 years ago[ELF] Print two more MIPS targets "supported" by LLD
Simon Atanasyan [Thu, 23 Mar 2017 12:17:32 +0000 (12:17 +0000)]
[ELF] Print two more MIPS targets "supported" by LLD

These targets are related to MIPS N32 ABI.

llvm-svn: 298591

7 years ago[GlobalISel][X86] clang-format. NFC
Igor Breger [Thu, 23 Mar 2017 12:13:29 +0000 (12:13 +0000)]
[GlobalISel][X86] clang-format. NFC

llvm-svn: 298590

7 years agoSupport attributes for Objective-C categories
Alex Lorenz [Thu, 23 Mar 2017 11:44:25 +0000 (11:44 +0000)]
Support attributes for Objective-C categories

rdar://31095315

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

llvm-svn: 298589

7 years ago[CodeGen] Emit a CoreFoundation link guard when @available is used
Alex Lorenz [Thu, 23 Mar 2017 11:14:27 +0000 (11:14 +0000)]
[CodeGen] Emit a CoreFoundation link guard when @available is used

After r297760, __isOSVersionAtLeast in compiler-rt loads the CoreFoundation
symbols at runtime. This means that `@available` will always fail when used in a
binary without a linked CoreFoundation.

This commit forces Clang to emit a reference to a CoreFoundation symbol when
`@available` is used to ensure that linking will fail when CoreFoundation isn't
linked with the build product.

rdar://31039592

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

llvm-svn: 298588

7 years ago[ObjC][ARC] Avoid -Warc-performSelector-leaks for performSelector variations
Alex Lorenz [Thu, 23 Mar 2017 10:46:05 +0000 (10:46 +0000)]
[ObjC][ARC] Avoid -Warc-performSelector-leaks for performSelector variations
that became supported after r297019

The commit r297019 expanded the performSelector ObjC method family heuristic
to ensure that -Wobjc-unsafe-perform-selector covers all performSelector
variations. However, this made the -Warc-performSelector-leaks too noisy, as
that warning produces mostly false positives since the selector is unknown.
This commit reverts the ObjC method family heuristics introduced in r297019.
This ensures that -Warc-performSelector-leaks isn't too noisy. The commit still
preserves the coverage of -Wobjc-unsafe-perform-selector.

rdar://31124629

llvm-svn: 298587

7 years ago[X86][TD][vpmovm2 ] New TD pattern for the vpmovm2 instruction
Michael Zuckerman [Thu, 23 Mar 2017 09:57:01 +0000 (09:57 +0000)]
[X86][TD][vpmovm2 ] New TD pattern for the vpmovm2 instruction

Up until now, vpmovm2 instruction described its destination operand size
by the source operand size. This patch adds new pattern for the vpmovm2
instruction. The node describes new expansion of the destination (from
{128|256} to 512).

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

llvm-svn: 298586

7 years agoFix warnings from clang build on macOS.
Bruce Mitchener [Thu, 23 Mar 2017 09:52:26 +0000 (09:52 +0000)]
Fix warnings from clang build on macOS.

Reviewers: lldb-commits

Subscribers: lldb-commits

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

llvm-svn: 298585

7 years ago[ValueTracking] Use APInt::isNegative instead of using operator[BitWidth-1]. NFCI
Craig Topper [Thu, 23 Mar 2017 07:06:42 +0000 (07:06 +0000)]
[ValueTracking] Use APInt::isNegative instead of using operator[BitWidth-1]. NFCI

llvm-svn: 298584

7 years ago[ValueTracking] Use setAllBits/setSignBit/setLowBits/setHighBits. NFCI
Craig Topper [Thu, 23 Mar 2017 07:06:39 +0000 (07:06 +0000)]
[ValueTracking] Use setAllBits/setSignBit/setLowBits/setHighBits. NFCI

llvm-svn: 298583

7 years agoSilence a couple of 'unused variable' warnings in c++03 tests. No functional change
Marshall Clow [Thu, 23 Mar 2017 06:25:26 +0000 (06:25 +0000)]
Silence a couple of 'unused variable' warnings in c++03 tests. No functional change

llvm-svn: 298582

7 years agoWorked around GCC bug 56480. Explicit specialization in a different namespace.
Michael Park [Thu, 23 Mar 2017 06:21:24 +0000 (06:21 +0000)]
Worked around GCC bug 56480. Explicit specialization in a different namespace.

Summary: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480

Reviewers: EricWF

Reviewed By: EricWF

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

llvm-svn: 298581

7 years agoCan't test for noexcept on C++03; std::hash<nullptr_t> isn't available until C++17
Marshall Clow [Thu, 23 Mar 2017 06:20:18 +0000 (06:20 +0000)]
Can't test for noexcept on C++03; std::hash<nullptr_t> isn't available until C++17

llvm-svn: 298580

7 years ago[IR] Use a binary search in DataLayout::getAlignmentInfo
Craig Topper [Thu, 23 Mar 2017 06:15:56 +0000 (06:15 +0000)]
[IR] Use a binary search in DataLayout::getAlignmentInfo

Summary:
We currently do a linear scan through all of the Alignments array entries anytime getAlignmentInfo is called. I noticed while profiling compile time on a -O2 opt run that this function can be called quite frequently and was showing about as about 1% of the time in callgrind.

This patch puts the Alignments array into a sorted order by type and then by bitwidth. We can then do a binary search. And use the sorted nature to handle the special cases for INTEGER_ALIGN. Some of this is modeled after the sorting/searching we do for pointers already.

This reduced the time spent in this routine by about 2/3 in the one compilation I was looking at.

We could maybe improve this more by using a DenseMap to cache the results, but just sorting was easy and didn't require extra data structure. And I think it made the integer handling simpler.

Reviewers: sanjoy, davide, majnemer, resistor, arsenm, mehdi_amini

Reviewed By: arsenm

Subscribers: arsenm, llvm-commits

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

llvm-svn: 298579

7 years ago[IR] Mark Use::getUser and Use::getImpliedUse as LLVM_READONLY.
Craig Topper [Thu, 23 Mar 2017 05:25:25 +0000 (05:25 +0000)]
[IR] Mark Use::getUser and Use::getImpliedUse as LLVM_READONLY.

llvm-svn: 298578

7 years ago[ELF] Allow references to reserved symbols in linker scripts
Petr Hosek [Thu, 23 Mar 2017 03:52:34 +0000 (03:52 +0000)]
[ELF] Allow references to reserved symbols in linker scripts

This requires collectign all symbols referenced in the linker script
and adding them to symbol table as undefined symbol.

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

llvm-svn: 298577

7 years agoSimplify. No functionality change intended.
Rui Ueyama [Thu, 23 Mar 2017 03:44:08 +0000 (03:44 +0000)]
Simplify. No functionality change intended.

I honestly do not understand this part of code as it is too tangled.
What I'm trying now is to carefully disentangle it by transforming
code without changing meaining to see if I can improve overall
readability.

llvm-svn: 298576

7 years agoRemove unnecessary local variable.
Rui Ueyama [Thu, 23 Mar 2017 03:11:03 +0000 (03:11 +0000)]
Remove unnecessary local variable.

llvm-svn: 298575

7 years agoFix issues in clang-format's AlignConsecutive modes.
Nikola Smiljanic [Thu, 23 Mar 2017 02:51:25 +0000 (02:51 +0000)]
Fix issues in clang-format's AlignConsecutive modes.

Patch by Ben Harper.

llvm-svn: 298574

7 years agoImplement P0599: 'noexcept for hash functions'. Fix a couple of hash functions (optio...
Marshall Clow [Thu, 23 Mar 2017 02:40:28 +0000 (02:40 +0000)]
Implement P0599: 'noexcept for hash functions'. Fix a couple of hash functions (optional<T> and unique_ptr<T>) which were mistakenly marked as 'noexcept'. Reviewed as https://reviews.llvm.org/D31234

llvm-svn: 298573

7 years ago[ARM] Reduce code duplication by factoring out in a lambda. NFCI.
Davide Italiano [Thu, 23 Mar 2017 01:34:45 +0000 (01:34 +0000)]
[ARM] Reduce code duplication by factoring out in a lambda. NFCI.

llvm-svn: 298572

7 years agoRefine comment.
Rui Ueyama [Thu, 23 Mar 2017 01:19:10 +0000 (01:19 +0000)]
Refine comment.

llvm-svn: 298571

7 years agoFix Windows buildbots.
Rui Ueyama [Thu, 23 Mar 2017 01:16:57 +0000 (01:16 +0000)]
Fix Windows buildbots.

llvm-svn: 298570

7 years agoForce @{init,fini}_array if section name starts with ".{init,fini}_array.".
Rui Ueyama [Thu, 23 Mar 2017 01:00:41 +0000 (01:00 +0000)]
Force @{init,fini}_array if section name starts with ".{init,fini}_array.".

Fixes https://bugs.llvm.org/show_bug.cgi?id=32307.

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

llvm-svn: 298569

7 years agoPrint out "suppoted targets".
Rui Ueyama [Thu, 23 Mar 2017 01:00:22 +0000 (01:00 +0000)]
Print out "suppoted targets".

This is to improve compatibility with GNU Libtool that expect
/supported targets:.* elf/ in a message for the -help option.

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

llvm-svn: 298568

7 years ago[ELF] Add -z nodlopen option.
Davide Italiano [Thu, 23 Mar 2017 00:54:16 +0000 (00:54 +0000)]
[ELF] Add -z nodlopen option.

Patch by Mark Kettenis.

llvm-svn: 298567

7 years agoAddress post-commit review comments regarding test_workarounds.h
Eric Fiselier [Thu, 23 Mar 2017 00:48:59 +0000 (00:48 +0000)]
Address post-commit review comments regarding test_workarounds.h

llvm-svn: 298566

7 years ago[coroutines] Implement unhandled_exception changes.
Eric Fiselier [Thu, 23 Mar 2017 00:33:33 +0000 (00:33 +0000)]
[coroutines] Implement unhandled_exception changes.

Summary:
This patch adopts the recent changes that renamed `set_exception(exception_pointer)` to `unhandled_exception()`.

Additionally `unhandled_exception()` is now required, and so an error is emitted when exceptions are enabled but the promise type does not provide the member.
When exceptions are disabled a warning is emitted instead of an error, The warning notes that the `unhandled_exception()` function is required when exceptions are enabled.

Reviewers: rsmith, GorNishanov, aaron.ballman, majnemer

Reviewed By: GorNishanov

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 298565

7 years ago[codeview] Move type index remapping logic to type merger
Reid Kleckner [Thu, 23 Mar 2017 00:14:23 +0000 (00:14 +0000)]
[codeview] Move type index remapping logic to type merger

Summary:
This removes the 'remapTypeIndices' method on every TypeRecord class. My
original idea was that this would be the beginning of some kind of
generic entry point that would enumerate all of the TypeIndices inside
of a TypeRecord, so that we could write generic graph algorithms for
them without duplicating the knowledge of which fields are type index
fields everywhere. This never happened, and nothing else uses this
method. I need to change the API to deal with merging into IPI streams,
so let's move it into the file that uses it first.

Reviewers: zturner, ruiu

Reviewed By: zturner, ruiu

Subscribers: mgorny, llvm-commits

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

llvm-svn: 298564

7 years ago[AArch64] Drive-by cleanup, make this code shorter. NFCI.
Davide Italiano [Wed, 22 Mar 2017 23:37:58 +0000 (23:37 +0000)]
[AArch64] Drive-by cleanup, make this code shorter. NFCI.

llvm-svn: 298563

7 years agoReapply r298417 "[ARM] Recommit the glueless lowering of addc/adde in Thumb1"
Artyom Skrobov [Wed, 22 Mar 2017 23:35:51 +0000 (23:35 +0000)]
Reapply r298417 "[ARM] Recommit the glueless lowering of addc/adde in Thumb1"

The UB in t2_so_imm_neg conversion has been addressed under D31242 / r298512

This reverts commit r298482.

llvm-svn: 298562

7 years agoDelete some more dead includes.
Zachary Turner [Wed, 22 Mar 2017 23:33:16 +0000 (23:33 +0000)]
Delete some more dead includes.

This breaks the cycle between Target and PluginLanguageC++, reducing
the overall cycle count from 43 to 42.

llvm-svn: 298561

7 years ago[AMDGPU] Do not emit isa info as code object metadata
Konstantin Zhuravlyov [Wed, 22 Mar 2017 23:27:09 +0000 (23:27 +0000)]
[AMDGPU] Do not emit isa info as code object metadata
  - It was decided to expose this information through other means (rocr)

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

llvm-svn: 298560

7 years ago[ARM] simplifying t2_so_imm_neg as suggested by Eli Friedman in D31242 (NFC)
Artyom Skrobov [Wed, 22 Mar 2017 23:12:59 +0000 (23:12 +0000)]
[ARM] simplifying t2_so_imm_neg as suggested by Eli Friedman in D31242 (NFC)

llvm-svn: 298559