platform/upstream/llvm.git
7 years agoPacify -Wreorder.
Benjamin Kramer [Fri, 20 Jan 2017 10:37:53 +0000 (10:37 +0000)]
Pacify -Wreorder.

llvm-svn: 292599

7 years agoFix more unused variable warnings when asserts are disabled.
Hafiz Abid Qadeer [Fri, 20 Jan 2017 10:24:03 +0000 (10:24 +0000)]
Fix more unused variable warnings when asserts are disabled.

llvm-svn: 292598

7 years agoAdd an assertion to PlaceholderQueue destructor, ensuring it has been flushed
Mehdi Amini [Fri, 20 Jan 2017 10:18:32 +0000 (10:18 +0000)]
Add an assertion to PlaceholderQueue destructor, ensuring it has been flushed

llvm-svn: 292597

7 years ago[AMDGPU] Add subtarget features for SDWA/DPP
Sam Kolton [Fri, 20 Jan 2017 10:01:25 +0000 (10:01 +0000)]
[AMDGPU] Add subtarget features for SDWA/DPP

Reviewers: vpykhtin, artem.tamazov, tstellarAMD

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye

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

llvm-svn: 292596

7 years agoFix documentation typo.
Malcolm Parsons [Fri, 20 Jan 2017 09:54:26 +0000 (09:54 +0000)]
Fix documentation typo.

llvm-svn: 292595

7 years ago[ELF] - Do not crash when assign common symbol's values in script
George Rimar [Fri, 20 Jan 2017 09:45:36 +0000 (09:45 +0000)]
[ELF] - Do not crash when assign common symbol's values in script

Found that during attempts of linking linux kernel,
previously we partially duplicated code from getOutputSection(),
and it missed commons symbol case.

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

llvm-svn: 292594

7 years agoUse UTF-8 for all communication with clang-format
Philipp Stephani [Fri, 20 Jan 2017 09:37:50 +0000 (09:37 +0000)]
Use UTF-8 for all communication with clang-format

Summary: Instead of picking the buffer file coding system, always use utf-8-unix for communicating with clang-format.  This is fine because clang-format never actually reads the file to be formatted, only standard input.  This is a bit simpler (process coding system is now a constant) and potentially faster, as utf-8-unix is Emacs's internal coding system.  Also add an end-to-end test that actually invokes clang-format.

Reviewers: klimek

Reviewed By: klimek

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

llvm-svn: 292593

7 years ago[PM] Tidy up the spacing of this new, much nicer test file.
Chandler Carruth [Fri, 20 Jan 2017 09:30:03 +0000 (09:30 +0000)]
[PM] Tidy up the spacing of this new, much nicer test file.

llvm-svn: 292592

7 years ago[InstCombine][SSE] Add DemandedElts support for PACKSS/PACKUS instructions
Simon Pilgrim [Fri, 20 Jan 2017 09:28:21 +0000 (09:28 +0000)]
[InstCombine][SSE] Add DemandedElts support for PACKSS/PACKUS instructions

Simplify a packss/packus truncation based on the elements of the mask that are actually demanded.

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

llvm-svn: 292591

7 years ago[OPENMP] Fix for PR31643: Clang crashes when compiling code on Windows
Alexey Bataev [Fri, 20 Jan 2017 08:57:28 +0000 (08:57 +0000)]
[OPENMP] Fix for PR31643: Clang crashes when compiling code on Windows
with SEH and openmp

In some cituations (during codegen for Windows SEH constructs)
CodeGenFunction instance may have CurFn equal to nullptr. OpenMP related
code does not expect such situation during cleanup.

llvm-svn: 292590

7 years ago[PM] Port LoopSink to the new pass manager.
Chandler Carruth [Fri, 20 Jan 2017 08:42:19 +0000 (08:42 +0000)]
[PM] Port LoopSink to the new pass manager.

Like several other loop passes (the vectorizer, etc) this pass doesn't
really fit the model of a loop pass. The critical distinction is that it
isn't intended to be pipelined together with other loop passes. I plan
to add some documentation to the loop pass manager to make this more
clear on that side.

LoopSink is also different because it doesn't really need a lot of the
infrastructure of our loop passes. For example, if there aren't loop
invariant instructions causing a preheader to exist, there is no need to
form a preheader. It also doesn't need LCSSA because this pass is
only involved in sinking invariant instructions from a preheader into
the loop, not reasoning about live-outs.

This allows some nice simplifications to the pass in the new PM where we
can directly walk the loops once without restructuring them.

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

llvm-svn: 292589

7 years ago[LoopSink] Trivial comment cleanup.
Chandler Carruth [Fri, 20 Jan 2017 08:42:14 +0000 (08:42 +0000)]
[LoopSink] Trivial comment cleanup.

llvm-svn: 292588

7 years ago[ARM] Use helpers for adding pred / CC operands. NFC
Diana Picus [Fri, 20 Jan 2017 08:15:24 +0000 (08:15 +0000)]
[ARM] Use helpers for adding pred / CC operands. NFC

Hunt down some of the places where we use bare addReg(0) or addImm(AL).addReg(0)
and replace with add(condCodeOp()) and add(predOps()). This should make it
easier to understand what those operands represent (without having to look at
the definition of the instruction that we're adding to).

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

llvm-svn: 292587

7 years ago[AVX-512] Fix a couple test cases to not pass an undef mask to gather intrinsic....
Craig Topper [Fri, 20 Jan 2017 07:12:30 +0000 (07:12 +0000)]
[AVX-512] Fix a couple test cases to not pass an undef mask to gather intrinsic. This could break if any future optimizations taken advantage of the undef.

llvm-svn: 292585

7 years ago[TargetLowering] Improve comment for setOperationAction().
Jonas Paulsson [Fri, 20 Jan 2017 06:48:47 +0000 (06:48 +0000)]
[TargetLowering] Improve comment for setOperationAction().

Add a sentence that says that the type argument can refer to
either the type of a result, or that of an operand.

Review: Eli Friedman.
llvm-svn: 292584

7 years agoNewGVN: Fix PR 31682, an overactive assert.
Daniel Berlin [Fri, 20 Jan 2017 06:38:41 +0000 (06:38 +0000)]
NewGVN: Fix PR 31682, an overactive assert.
Part of the assert has been left active for further debugging.
The other part has been turned into a stat for tracking for the
moment.

llvm-svn: 292583

7 years agoStill expose std::align_val_t in C++17 even if we don't have aligned new/delete.
Eric Fiselier [Fri, 20 Jan 2017 06:27:34 +0000 (06:27 +0000)]
Still expose std::align_val_t in C++17 even if we don't have aligned new/delete.

r292564 disabled the aligned new/delete overloads on platforms without
posix_memalign. Unfortunately that patch also disabled the  align_val_t
definition in C++17 as well.

This patch causes align_val_t to be exposed in C++17 regardless
of if we have the new/delete overloads.

llvm-svn: 292582

7 years ago[SLP] Add a base test for jumbled store
Mohammad Shahid [Fri, 20 Jan 2017 06:05:33 +0000 (06:05 +0000)]
[SLP] Add a base test for jumbled store

Change-Id: I905ce08a02c76a6896dcfd9629547417c99adc4a
llvm-svn: 292581

7 years agollvm-cxxfilt: add missing includes from previous change
Saleem Abdulrasool [Fri, 20 Jan 2017 05:33:22 +0000 (05:33 +0000)]
llvm-cxxfilt: add missing includes from previous change

llvm-svn: 292580

7 years agollvm-cxxfilt: fix program description
Saleem Abdulrasool [Fri, 20 Jan 2017 05:27:09 +0000 (05:27 +0000)]
llvm-cxxfilt: fix program description

Fix a silly copy-paste error in the tool description.  Take the
opportunity to add crash stack printing which will hopefully never be
needed.

llvm-svn: 292579

7 years agoELF: Fix ICF crash on absolute symbol relocations.
Peter Collingbourne [Fri, 20 Jan 2017 04:58:12 +0000 (04:58 +0000)]
ELF: Fix ICF crash on absolute symbol relocations.

If two sections contained relocations to absolute symbols with the same
value we would crash when trying to access their sections. Add a check that
both symbols point to sections before accessing their sections, and treat
absolute symbols as equal if their values are equal.

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

llvm-svn: 292578

7 years agoRefactor unique_ptr/shared_ptr deleter test types into single header.
Eric Fiselier [Fri, 20 Jan 2017 04:39:17 +0000 (04:39 +0000)]
Refactor unique_ptr/shared_ptr deleter test types into single header.

llvm-svn: 292577

7 years agollvm-cxxfilt: support `-t` to demangle types
Saleem Abdulrasool [Fri, 20 Jan 2017 04:25:26 +0000 (04:25 +0000)]
llvm-cxxfilt: support `-t` to demangle types

By default c++filt demangles functions, though you can optionally pass
`-t` to have it decode types as well, behaving nearly identical to
`__cxa_demangle`.  Add support for this mode.

llvm-svn: 292576

7 years agoBitVector: Fix undefined behaviour
Matthias Braun [Fri, 20 Jan 2017 04:23:08 +0000 (04:23 +0000)]
BitVector: Fix undefined behaviour

Calling reset() on an empty BitVector would call memset with a nullptr
argument which is undefined behaviour.

This should fix the sanitizer bot.

llvm-svn: 292575

7 years agoRevert "LiveRegUnits: Add accumulateBackward() function"
Matthias Braun [Fri, 20 Jan 2017 03:58:42 +0000 (03:58 +0000)]
Revert "LiveRegUnits: Add accumulateBackward() function"

This seems to be breaking some bots.

This reverts commit r292543.

llvm-svn: 292574

7 years agoRevert "Demangle: only demangle mangled symbols"
Saleem Abdulrasool [Fri, 20 Jan 2017 03:54:04 +0000 (03:54 +0000)]
Revert "Demangle: only demangle mangled symbols"

This reverts SVN r286795.  This was incorrect the demangler is expected
to be able to demangle types as well as functions.  This makes the
behaviour of itaniumDemangle similar to __cxa_demangle once more.

llvm-svn: 292573

7 years agoRevert "Recommit "[InlineCost] Use TTI to check if GEP is free.""
Haicheng Wu [Fri, 20 Jan 2017 03:40:41 +0000 (03:40 +0000)]
Revert "Recommit "[InlineCost] Use TTI to check if GEP is free.""

This reverts commit r292570.  The test still has problem.

llvm-svn: 292572

7 years ago[AST Printer] Print attributes on enum constants
Jordan Rose [Fri, 20 Jan 2017 03:33:42 +0000 (03:33 +0000)]
[AST Printer] Print attributes on enum constants

The AST printer was dropping attributes on enumerators (enum
constants). Now it's not.

llvm-svn: 292571

7 years agoRecommit "[InlineCost] Use TTI to check if GEP is free."
Haicheng Wu [Fri, 20 Jan 2017 03:09:11 +0000 (03:09 +0000)]
Recommit "[InlineCost] Use TTI to check if GEP is free."

This recommits r292526 which is reverted in r292529 after fixing the test case.

The original summary:

Currently, a GEP is considered free only if its indices are all constant.
TTI::getGEPCost() can give target-specific more accurate analysis. TTI is
already used for the cost of many other instructions.

llvm-svn: 292570

7 years ago[LoopInfo] Add helper methods to compute two useful orderings of the
Chandler Carruth [Fri, 20 Jan 2017 02:41:20 +0000 (02:41 +0000)]
[LoopInfo] Add helper methods to compute two useful orderings of the
loops in a function.

These are relatively confusing to talk about and compute correctly so it
seems really good to write down their implementation in one place. I've
replaced one place we needed this in the loop PM infrastructure and
I have another place in a pending patch that wants it.

We can't quite use this for the core loop PM walk because there we're
sometimes working on a sub-forest.

I'll add the expected unittests before committing this but wanted to
make sure folks were happy with these names / comments.

Credit goes to Richard Smith for the idea for naming the order where siblings
are in reverse program order but the tree traversal remains preorder.

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

llvm-svn: 292569

7 years ago[test] Remove an unwanted match for `UNSUPPORTED:`.
Greg Parker [Fri, 20 Jan 2017 02:12:22 +0000 (02:12 +0000)]
[test] Remove an unwanted match for `UNSUPPORTED:`.

llvm-svn: 292568

7 years ago[test] Remove a unwanted match for `XFAIL:`.
Greg Parker [Fri, 20 Jan 2017 02:01:04 +0000 (02:01 +0000)]
[test] Remove a unwanted match for `XFAIL:`.

llvm-svn: 292567

7 years agoDisable aligned new/delete on Apple platforms without posix_memalign
Eric Fiselier [Fri, 20 Jan 2017 01:47:26 +0000 (01:47 +0000)]
Disable aligned new/delete on Apple platforms without posix_memalign

Summary:
This patch disables the aligned new/delet overloads on Apple platforms without `posix_memalign`. This fixes libc++.dylib build regressions on such platforms.
This fixes http://llvm.org/PR31448.

This patch should also be merged into the 4.0 release branch

Reviewers: mclow.lists, rsmith, dexonsmith, jeremyhu

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 292564

7 years ago[AArch64][GlobalISel] Widen scalar int->fp conversions.
Ahmed Bougacha [Fri, 20 Jan 2017 01:37:24 +0000 (01:37 +0000)]
[AArch64][GlobalISel] Widen scalar int->fp conversions.

It's incorrect to ignore the higher bits of the integer source.
Teach the legalizer how to widen it.

llvm-svn: 292563

7 years agoclang-format: fix fallback style set to "none" not always formatting
Antonio Maiorano [Fri, 20 Jan 2017 01:22:42 +0000 (01:22 +0000)]
clang-format: fix fallback style set to "none" not always formatting

This fixes clang-format not formatting if fallback-style is explicitly set to
"none", and either a config file is found or YAML is passed in without a
"BasedOnStyle". With this change, passing "none" in these cases will have no
affect, and LLVM style will be used as the base style.

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

llvm-svn: 292562

7 years agoPR31701: Fix crash on invalid caused by parsing a dependent initializer when we
Richard Smith [Fri, 20 Jan 2017 01:19:46 +0000 (01:19 +0000)]
PR31701: Fix crash on invalid caused by parsing a dependent initializer when we
don't know we're in a dependent context.

llvm-svn: 292561

7 years ago[NFC] Group aligned new/delete definitions together in new.cpp
Eric Fiselier [Fri, 20 Jan 2017 01:13:49 +0000 (01:13 +0000)]
[NFC] Group aligned new/delete definitions together in new.cpp

This patch is cleanup to prepare for future changes

llvm-svn: 292560

7 years agoFix documentation typo.
Richard Smith [Fri, 20 Jan 2017 01:08:15 +0000 (01:08 +0000)]
Fix documentation typo.

llvm-svn: 292559

7 years agoAdd documentation for constexpr string builtin support.
Richard Smith [Fri, 20 Jan 2017 00:57:59 +0000 (00:57 +0000)]
Add documentation for constexpr string builtin support.

llvm-svn: 292558

7 years agoFix handling of Apple target triple when checking the ABI lists.
Eric Fiselier [Fri, 20 Jan 2017 00:57:08 +0000 (00:57 +0000)]
Fix handling of Apple target triple when checking the ABI lists.

The check-cxx-abilist rule uses TARGET_TRIPLE to determine which
ABI list to check. However the triple on Apple contains the darwin
version which changes frequently, but libc++ doesn't need
different ABI lists for each darwin version.

This patch strips the minor version and patchlevel from TARGET_TRIPLE
before using it to determine the ABI list.

llvm-svn: 292557

7 years ago[PM] Attempt to pacify windows bots.
Michael Kuperstein [Fri, 20 Jan 2017 00:47:32 +0000 (00:47 +0000)]
[PM] Attempt to pacify windows bots.

Another difference in type pretty-printing, this one windows-specific.

llvm-svn: 292556

7 years agoP0426: Make the library implementation of constexpr char_traits a little easier
Richard Smith [Fri, 20 Jan 2017 00:45:35 +0000 (00:45 +0000)]
P0426: Make the library implementation of constexpr char_traits a little easier
by providing a memchr builtin that returns char* instead of void*.

Also add a __has_feature flag to indicate the presence of constexpr forms of
the relevant <string> functions.

llvm-svn: 292555

7 years ago[AMDGPU] Prevent spills before exec mask is restored
Stanislav Mekhanoshin [Fri, 20 Jan 2017 00:44:31 +0000 (00:44 +0000)]
[AMDGPU] Prevent spills before exec mask is restored

Inline spiller can decide to move a spill as early as possible in the basic block.
It will skip phis and label, but we also need to make sure it skips instructions
in the basic block prologue which restore exec mask.

Added isPositionLike callback in TargetInstrInfo to detect instructions which
shall be skipped in addition to common phis, labels etc.

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

llvm-svn: 292554

7 years agoGlobalISel: Add a note about how we're being a bit loose with memory operands
Justin Bogner [Fri, 20 Jan 2017 00:30:17 +0000 (00:30 +0000)]
GlobalISel: Add a note about how we're being a bit loose with memory operands

The logic in r292461 is conservatively correct, but we should revisit
this later. Add a TODO so we don't forget.

llvm-svn: 292553

7 years ago[AArch64][GlobalISel] Split FP conversion legalizer tests. NFC.
Ahmed Bougacha [Fri, 20 Jan 2017 00:30:09 +0000 (00:30 +0000)]
[AArch64][GlobalISel] Split FP conversion legalizer tests. NFC.

Big functions with large vreg # are quite unwieldy to update.

Change it to have one function per test (it does increase boilerplate,
but makes the core hopefully more readable and maintanable).

llvm-svn: 292552

7 years ago[AArch64][GlobalISel] Split legalizer combine tests. NFC.
Ahmed Bougacha [Fri, 20 Jan 2017 00:30:06 +0000 (00:30 +0000)]
[AArch64][GlobalISel] Split legalizer combine tests. NFC.

Big functions with large vreg # are quite unwieldy to update.  This test
also relied on legal s8 operations which we're considering removing.

Change it to have one function per test (it does increase boilerplate,
but makes the core hopefully more readable and maintanable), and use
100% legal operations throughout.

llvm-svn: 292551

7 years ago[MIRParser] Allow generic register specification on operand.
Ahmed Bougacha [Fri, 20 Jan 2017 00:29:59 +0000 (00:29 +0000)]
[MIRParser] Allow generic register specification on operand.

This completes r292321 by adding support for generic registers, e.g.:

  %2:_(s32) = G_ADD %0, %1

llvm-svn: 292550

7 years ago[lit] Limit parallelism of sanitizer tests on Darwin [compiler-rt part, take 2]
Kuba Mracek [Fri, 20 Jan 2017 00:25:01 +0000 (00:25 +0000)]
[lit] Limit parallelism of sanitizer tests on Darwin [compiler-rt part, take 2]

Running lit tests and unit tests of ASan and TSan on macOS has very bad performance when running with a high number of threads. This is caused by xnu (the macOS kernel), which currently doesn't handle mapping and unmapping of sanitizer shadow regions (reserved VM which are several terabytes large) very well. The situation is so bad that increasing the number of threads actually makes the total testing time larger. The macOS buildbots are affected by this. Note that we can't easily limit the number of sanitizer testing threads without affecting the rest of the tests.

This patch adds a special "group" into lit, and limits the number of concurrently running tests in this group. This helps solve the contention problem, while still allowing other tests to run in full, that means running lit with -j8 will still with 8 threads, and parallelism is only limited in sanitizer tests.

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

llvm-svn: 292549

7 years ago[lit] Limit parallelism of sanitizer tests on Darwin [llvm part, take 2]
Kuba Mracek [Fri, 20 Jan 2017 00:24:32 +0000 (00:24 +0000)]
[lit] Limit parallelism of sanitizer tests on Darwin [llvm part, take 2]

Running lit tests and unit tests of ASan and TSan on macOS has very bad performance when running with a high number of threads. This is caused by xnu (the macOS kernel), which currently doesn't handle mapping and unmapping of sanitizer shadow regions (reserved VM which are several terabytes large) very well. The situation is so bad that increasing the number of threads actually makes the total testing time larger. The macOS buildbots are affected by this. Note that we can't easily limit the number of sanitizer testing threads without affecting the rest of the tests.

This patch adds a special "group" into lit, and limits the number of concurrently running tests in this group. This helps solve the contention problem, while still allowing other tests to run in full, that means running lit with -j8 will still with 8 threads, and parallelism is only limited in sanitizer tests.

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

llvm-svn: 292548

7 years agoGlobalISel: Only set FailedISel on dropped dbg intrinsics when using fallback
Justin Bogner [Fri, 20 Jan 2017 00:24:30 +0000 (00:24 +0000)]
GlobalISel: Only set FailedISel on dropped dbg intrinsics when using fallback

It's easier to test the non-fallback path if we just drop these
intrinsics for now, like we did before we added the fallback path.
We'll obviously need to fix this properly, but the fixme for that is
already here.

llvm-svn: 292547

7 years ago[AliasAnalysis] Fences do not modify constant memory location
Anna Thomas [Fri, 20 Jan 2017 00:21:33 +0000 (00:21 +0000)]
[AliasAnalysis] Fences do not modify constant memory location

Summary:
Fence instructions are currently marked as `ModRef` for all memory locations.

We can improve this for constant memory locations (such as constant globals),
since fence instructions cannot modify these locations.

This helps us to forward constant loads across fences (added test case in GVN).
There were no changes in behaviour for similar test cases in early-cse and licm.

Reviewers: dberlin, sanjoy, reames

Subscribers: llvm-commits

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

llvm-svn: 292546

7 years agoFinish implementation of C++ DR1310 (http://wg21.link/cwg1310).
Richard Smith [Fri, 20 Jan 2017 00:20:39 +0000 (00:20 +0000)]
Finish implementation of C++ DR1310 (wg21.link/cwg1310).

Diagnose the case when a dependent template name instantiates to an
injected-class-name outside a nested-name-specifier.

llvm-svn: 292545

7 years agoGlobalISel: Pass the MachineFunction in to reportSelectionError directly
Justin Bogner [Fri, 20 Jan 2017 00:16:19 +0000 (00:16 +0000)]
GlobalISel: Pass the MachineFunction in to reportSelectionError directly

Rather than trying to find MF based on the possibly-null MI we've
passed in here, just pass it in directly. It's already available at
all callers anyway.

llvm-svn: 292544

7 years agoLiveRegUnits: Add accumulateBackward() function
Matthias Braun [Fri, 20 Jan 2017 00:16:17 +0000 (00:16 +0000)]
LiveRegUnits: Add accumulateBackward() function

This function can be used to accumulate the set of all read and modified
register in a sequence of instructions.

Use this code in AArch64A57FPLoadBalancing::scavengeRegister() to prove
the concept.

- The AArch64A57LoadBalancing code is using a backwards analysis now
  which is irrespective of kill flags. This is the main motivation for
  this change.

Differential Revision: http://reviews.llvm.org/D22082

llvm-svn: 292543

7 years agoCodeGen: Add/Factor out LiveRegUnits class; NFCI
Matthias Braun [Fri, 20 Jan 2017 00:16:14 +0000 (00:16 +0000)]
CodeGen: Add/Factor out LiveRegUnits class; NFCI

This is a set of register units intended to track register liveness, it
is similar in spirit to LivePhysRegs.
You can also think of this as the liveness tracking parts of the
RegisterScavenger factored out into an own class.

This was proposed in http://llvm.org/PR27609

Differential Revision: http://reviews.llvm.org/D21916

llvm-svn: 292542

7 years agoFix demangle helper after r286788
Eric Fiselier [Fri, 20 Jan 2017 00:00:31 +0000 (00:00 +0000)]
Fix demangle helper after r286788

llvm-svn: 292541

7 years agoAArch64: fall back to DAG ISel for inline assembly.
Tim Northover [Thu, 19 Jan 2017 23:59:35 +0000 (23:59 +0000)]
AArch64: fall back to DAG ISel for inline assembly.

We can't currently handle "calls" to inlineasm strings so it's better to let
the DAG handle it than generate rubbish.

llvm-svn: 292540

7 years agoAdjust msvc_stdlib_force_include.hpp to handle clang++
Eric Fiselier [Thu, 19 Jan 2017 23:48:05 +0000 (23:48 +0000)]
Adjust msvc_stdlib_force_include.hpp to handle clang++

Summary: This patch adjusts the newly added `msvc_stdlib_force_include.hpp` so that it also works when used with `clang++`.

Reviewers: STL_MSFT

Reviewed By: STL_MSFT

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

llvm-svn: 292539

7 years agoFix a few more build errors.
Zachary Turner [Thu, 19 Jan 2017 23:44:14 +0000 (23:44 +0000)]
Fix a few more build errors.

llvm-svn: 292538

7 years agoFix incorrectly formed assert statement.
Zachary Turner [Thu, 19 Jan 2017 23:41:11 +0000 (23:41 +0000)]
Fix incorrectly formed assert statement.

llvm-svn: 292537

7 years ago[PM] Make default pipeline test for the new PM strict
Michael Kuperstein [Thu, 19 Jan 2017 23:39:28 +0000 (23:39 +0000)]
[PM] Make default pipeline test for the new PM strict

Use CHECK-NEXT to verify that a test breaks whenever unexpected passes,
analyses, or invalidations show up in default pipelines. The test case
is constructed so that we don't expect to invalidate anything, and needs
to be kept that way.

The test is slightly less strict than we'd like because of differences
in type pretty-printing.

(Right now it does show some invalidations - all of those are intentional
and temporary.)

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

llvm-svn: 292536

7 years ago[pdb] Add HashTable data structure.
Zachary Turner [Thu, 19 Jan 2017 23:31:24 +0000 (23:31 +0000)]
[pdb] Add HashTable data structure.

This was being parsed / serialized ad-hoc inside the code
for a specific PDB stream.  But this data structure is used
in multiple ways / places within the PDB format.  To be able
to re-use it we need to raise this code out and make it more
generic.  In doing so, a number of bugs are fixed in the
original implementation, and support is added for growing
the hash table and deleting items from the hash table,
which had either been omitted or incorrect implemented in
the initial version.

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

llvm-svn: 292535

7 years agoRevert r292530 since it breaks buildbots.
Michael Kuperstein [Thu, 19 Jan 2017 23:22:55 +0000 (23:22 +0000)]
Revert r292530 since it breaks buildbots.

llvm-svn: 292534

7 years agoclang-format SampleProfile.cpp (NFC)
Dehao Chen [Thu, 19 Jan 2017 23:20:31 +0000 (23:20 +0000)]
clang-format SampleProfile.cpp (NFC)

llvm-svn: 292533

7 years agoLTO: Flush the resolution file after writing to it.
Peter Collingbourne [Thu, 19 Jan 2017 23:10:14 +0000 (23:10 +0000)]
LTO: Flush the resolution file after writing to it.

Without this the file could be truncated if the linker crashes.

llvm-svn: 292532

7 years ago[SCCP] Teach the pass how to handle `div` with overdefined operands.
Davide Italiano [Thu, 19 Jan 2017 23:07:51 +0000 (23:07 +0000)]
[SCCP] Teach the pass how to handle `div` with overdefined operands.

This can prove that:

extern int f;
int g() {
    int x = 0;
    for (int i = 0; i < 365; ++i) {
        x /= f;
    }
    return x;
}

always returns zero. Thanks to Sanjoy for confirming this
transformation actually made sense (bugs are mine).

llvm-svn: 292531

7 years ago[PM] Make default pipeline test for the new PM strict
Michael Kuperstein [Thu, 19 Jan 2017 22:55:46 +0000 (22:55 +0000)]
[PM] Make default pipeline test for the new PM strict

Use CHECK-NEXT to verify that a test breaks whenever unexpected passes,
analyses, or invalidations show up in default pipelines. The test case
is constructed so that we don't expect to invalidate anything, and needs
to be kept that way.

(Right now it does show some invalidations - all of those are intentional
and temporary.)

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

llvm-svn: 292530

7 years agoRevert "[InlineCost] Use TTI to check if GEP is free."
Haicheng Wu [Thu, 19 Jan 2017 22:51:03 +0000 (22:51 +0000)]
Revert "[InlineCost] Use TTI to check if GEP is free."

This reverts commit r292526.  The test case has problem.

llvm-svn: 292529

7 years ago[SelectionDAG] Improve knownbits handling of UMIN/UMAX (PR31293)
Simon Pilgrim [Thu, 19 Jan 2017 22:41:22 +0000 (22:41 +0000)]
[SelectionDAG] Improve knownbits handling of UMIN/UMAX (PR31293)

This patch improves the knownbits logic for unsigned integer min/max opcodes.

For UMIN we know that the result will have the maximum of the inputs' known leading zero bits in the result, similarly for UMAX the maximum of the inputs' leading one bits.

This is particularly useful for simplifying clamping patterns,. e.g. as SSE doesn't have a uitofp instruction we want to use sitofp instead where possible and for that we need to confirm that the top bit is not set.

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

llvm-svn: 292528

7 years ago[InlineCost] Use TTI to check if GEP is free.
Haicheng Wu [Thu, 19 Jan 2017 22:28:34 +0000 (22:28 +0000)]
[InlineCost] Use TTI to check if GEP is free.

Currently, a GEP is considered free only if its indices are all constant.
TTI::getGEPCost() can give target-specific more accurate analysis. TTI is
already used for the cost of many other instructions.

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

llvm-svn: 292526

7 years agoWhenever reasonable, merge ASAN quarantine batches to save memory.
Alex Shlyapnikov [Thu, 19 Jan 2017 22:15:54 +0000 (22:15 +0000)]
Whenever reasonable, merge ASAN quarantine batches to save memory.

Summary:
There are cases when thread local quarantine drains almost empty
quarantine batches into the global quarantine. The current approach leaves
them almost empty, which might create a huge memory overhead (each batch
is 4K/8K, depends on bitness).

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 292525

7 years agoDon't inline dllimport functions referencing non-imported methods
Hans Wennborg [Thu, 19 Jan 2017 21:33:13 +0000 (21:33 +0000)]
Don't inline dllimport functions referencing non-imported methods

This is another follow-up to r246338. I had assumed methods were already
handled by the AST visitor, but turns out they weren't.

llvm-svn: 292522

7 years ago[AMDGPU] Add exec copy to LiveIntervals in SILowerControlFlow::emitElse
Stanislav Mekhanoshin [Thu, 19 Jan 2017 21:26:22 +0000 (21:26 +0000)]
[AMDGPU] Add exec copy to LiveIntervals in SILowerControlFlow::emitElse

This instruction is missing from LiveIntervals.
I'm not aware of any problems because of this though.

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

llvm-svn: 292521

7 years ago[libFuzzer] ensure that entries in PersistentAutoDictionary are not empty
Kostya Serebryany [Thu, 19 Jan 2017 21:14:47 +0000 (21:14 +0000)]
[libFuzzer] ensure that entries in PersistentAutoDictionary are not empty

llvm-svn: 292520

7 years ago[SCCP] Update comment in visitBinaryOp() after recent changes.
Davide Italiano [Thu, 19 Jan 2017 21:07:42 +0000 (21:07 +0000)]
[SCCP] Update comment in visitBinaryOp() after recent changes.

llvm-svn: 292519

7 years agoPR13403 (+duplicates): implement C++ DR1310 (http://wg21.link/cwg1310).
Richard Smith [Thu, 19 Jan 2017 21:00:13 +0000 (21:00 +0000)]
PR13403 (+duplicates): implement C++ DR1310 (wg21.link/cwg1310).

Under this defect resolution, the injected-class-name of a class or class
template cannot be used except in very limited circumstances (when declaring a
constructor, in a nested-name-specifier, in a base-specifier, or in an
elaborated-type-specifier). This is apparently done to make parsing easier, but
it's a pain for us since we don't know whether a template-id using the
injected-class-name is valid at the point when we annotate it (we don't yet
know whether the template-id will become part of an elaborated-type-specifier).

As a tentative resolution to a perceived language defect, mem-initializer-ids
are added to the list of exceptions here (they generally follow the same rules
as base-specifiers).

When the reference to the injected-class-name uses the 'typename' or 'template'
keywords, we permit it to be used to name a type or template as an extension;
other compilers also accept some cases in this area. There are also a couple of
corner cases with dependent template names that we do not yet diagnose, but
which will also get this treatment.

llvm-svn: 292518

7 years ago[XRay][Arm] Enable back XRay testing on Arm32 and fix the failing tests
Serge Rogatch [Thu, 19 Jan 2017 20:27:11 +0000 (20:27 +0000)]
[XRay][Arm] Enable back XRay testing on Arm32 and fix the failing tests

Summary:
Testing of XRay was occasionally disabled on 32-bit Arm targets (someone assumed that XRay was supported on 64-bit targets only). This patch should fix that problem. Also here the instruction&data cache incoherency problem is fixed, because it may be causing a test to fail.
This patch is one of a series: see also
- https://reviews.llvm.org/D28624

Reviewers: dberris, rengolin

Reviewed By: rengolin

Subscribers: llvm-commits, aemerson, rengolin, dberris, iid_iunknown

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

llvm-svn: 292517

7 years ago[XRay][Arm] Repair XRay table emission on Arm32 and add tests to identify such proble...
Serge Rogatch [Thu, 19 Jan 2017 20:24:23 +0000 (20:24 +0000)]
[XRay][Arm] Repair XRay table emission on Arm32 and add tests to identify such problem earlier

Summary:
Emission of XRay table was occasionally disabled for Arm32, but this bug was not then detected because earlier (also by mistake) testing of XRay was occasionally disabled on 32-bit Arm targets. This patch should fix that problem and detect such problems in the future.
This patch is one of a series, see also
- https://reviews.llvm.org/D28623

Reviewers: rengolin, dberris

Reviewed By: dberris

Subscribers: llvm-commits, aemerson, rengolin, dberris, iid_iunknown

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

llvm-svn: 292516

7 years ago[Assembler] Improve error when unable to evaluate expression.
Chad Rosier [Thu, 19 Jan 2017 20:06:32 +0000 (20:06 +0000)]
[Assembler] Improve error when unable to evaluate expression.

Add a SMLoc to MCExpr. Most code does not generate or consume the SMLoc (yet).

Patch by Sanne Wouda <sanne.wouda@arm.com>!
Differential Revision: https://reviews.llvm.org/D28861

llvm-svn: 292515

7 years agoFix aliases to thumbfunc-based exprs to be thumbfunc.
Evgeniy Stepanov [Thu, 19 Jan 2017 20:04:11 +0000 (20:04 +0000)]
Fix aliases to thumbfunc-based exprs to be thumbfunc.

If F is a Thumb function symbol, and G = F + const, and G is a
function symbol, then G is Thumb. Because what else could it be?

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

llvm-svn: 292514

7 years agoAlso define 'end' if it is present in a .so.
Rafael Espindola [Thu, 19 Jan 2017 19:51:02 +0000 (19:51 +0000)]
Also define 'end' if it is present in a .so.

I don't know of anything using it, but we should handle it like _end.

llvm-svn: 292513

7 years agoCreate _end symbol even if a .so defines it.
Rafael Espindola [Thu, 19 Jan 2017 19:43:34 +0000 (19:43 +0000)]
Create _end symbol even if a .so defines it.

The freebsd sbrk implementation uses _end to find the initial value of
brk, so it has to be defined in the main binary.

This should fix the emacs build.

llvm-svn: 292512

7 years ago[libFuzzer] improve -minimize_crash: honor -artifact_prefix= and don't special case...
Kostya Serebryany [Thu, 19 Jan 2017 19:38:12 +0000 (19:38 +0000)]
[libFuzzer] improve -minimize_crash: honor -artifact_prefix= and don't special case 2-byte inputs

llvm-svn: 292511

7 years agoImprove what can be promoted in LICM.
Xin Tong [Thu, 19 Jan 2017 19:31:40 +0000 (19:31 +0000)]
Improve what can be promoted in LICM.

Summary:
In case of non-alloca pointers, we check for whether it is a pointer
from malloc-like calls and it is not captured. In such case, we can
promote the pointer, as the caller will have no way to access this pointer
even if there is unwinding in middle of the loop.

Reviewers: hfinkel, sanjoy, reames, eli.friedman

Subscribers: llvm-commits

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

llvm-svn: 292510

7 years ago[libFuzzer] add two tests for experimenting with equivalence fuzzing
Kostya Serebryany [Thu, 19 Jan 2017 19:07:26 +0000 (19:07 +0000)]
[libFuzzer] add two tests for experimenting with equivalence fuzzing

llvm-svn: 292509

7 years agoModule: Improve diagnostic message when cxx modules are disabled and @import is used...
Manman Ren [Thu, 19 Jan 2017 19:05:55 +0000 (19:05 +0000)]
Module: Improve diagnostic message when cxx modules are disabled and @import is used in Objective CXX.

rdar://problem/19399671

llvm-svn: 292508

7 years agoAdd an interface to scale the frequencies of a set of blocks.
Easwaran Raman [Thu, 19 Jan 2017 18:53:16 +0000 (18:53 +0000)]
Add an interface to scale the frequencies of a set of blocks.

The scaling is done with reference to the the new frequency of a reference block.

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

llvm-svn: 292507

7 years ago[InstCombine] Simplify gep (gep p, a), (b-a)
Davide Italiano [Thu, 19 Jan 2017 18:51:56 +0000 (18:51 +0000)]
[InstCombine] Simplify gep (gep p, a), (b-a)

Patch by Andrea Canciani.

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

llvm-svn: 292506

7 years ago[Builtin] [ARM] Update CMake to support the build of armv6m
Weiming Zhao [Thu, 19 Jan 2017 18:46:11 +0000 (18:46 +0000)]
[Builtin] [ARM] Update CMake to support the build of armv6m

Summary:
Setting -DCOMPILER_RT_TEST_TARGET_TRIPLE=armv6m-none-eabi  will enable the build of builtin functions ARMv6m.
Currently, only those asms that support armv6m are added.

TODO:All asm sin ARM_EABI_Sources are ported for thumb1 so Thumb1_EABI_Sources will be deprecated.

Reviewers: rengolin, compnerd

Reviewed By: compnerd

Subscribers: aemerson, mgorny, llvm-commits

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

llvm-svn: 292504

7 years ago[X86][SSE] Improve comments describing combineTruncatedArithmetic. NFCI.
Simon Pilgrim [Thu, 19 Jan 2017 18:18:32 +0000 (18:18 +0000)]
[X86][SSE] Improve comments describing combineTruncatedArithmetic. NFCI.

llvm-svn: 292502

7 years agoRemove this test from the r292500 commit till Chris and I figure out
Kevin Enderby [Thu, 19 Jan 2017 18:07:22 +0000 (18:07 +0000)]
Remove this test from the r292500 commit till Chris and I figure out
why it is failing on a couple of build bots.

llvm-svn: 292501

7 years agoAdd support for the new LC_NOTE load command.
Kevin Enderby [Thu, 19 Jan 2017 17:36:31 +0000 (17:36 +0000)]
Add support for the new LC_NOTE load command.

It describes a region of arbitrary data included in a Mach-O file.
Its initial use is to record extra data in MH_CORE files.

rdar://30001545
rdar://30001731

llvm-svn: 292500

7 years agoProvide a substitute to load command of gdb.
Hafiz Abid Qadeer [Thu, 19 Jan 2017 17:32:50 +0000 (17:32 +0000)]
Provide a substitute to load command of gdb.

For bare-metal targets, lldb was missing a command like 'load' in gdb
which can be used to create executable image on the target. This was
discussed in
http://lists.llvm.org/pipermail/lldb-dev/2016-December/011752.html

This commits adds an option to "target module load" command to provide
that functionality. It does not set the PC to entry address which will
be done separately.

Reviewed in https://reviews.llvm.org/D28804

llvm-svn: 292499

7 years ago[Sema] Reword unused lambda capture warning
Malcolm Parsons [Thu, 19 Jan 2017 17:19:22 +0000 (17:19 +0000)]
[Sema] Reword unused lambda capture warning

Summary:
The warning doesn't know why the variable was looked up but not
odr-used, so reword it to not claim that it was used in an unevaluated
context.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 292498

7 years ago[Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode
Alex Lorenz [Thu, 19 Jan 2017 17:17:57 +0000 (17:17 +0000)]
[Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode

rdar://28532840

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

llvm-svn: 292497

7 years ago[Hexagon] Linux linker does not support .gnu-hash
Sumanth Gundapaneni [Thu, 19 Jan 2017 16:54:04 +0000 (16:54 +0000)]
[Hexagon] Linux linker does not support .gnu-hash

Hexagon Linux dynamic loader does not use (in fact does not support)
.gnu-hash

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

llvm-svn: 292496

7 years ago[X86][SSE] Attempt to pre-truncate arithmetic operations that have already been extended
Simon Pilgrim [Thu, 19 Jan 2017 16:25:02 +0000 (16:25 +0000)]
[X86][SSE] Attempt to pre-truncate arithmetic operations that have already been extended

As discussed on D28219 - it is profitable to combine trunc(binop (s/zext(x), s/zext(y)) to binop(trunc(s/zext(x)), trunc(s/zext(y))) assuming the trunc(ext()) will simplify further

llvm-svn: 292493

7 years ago[InstCombine] icmp Pred (shl nsw X, C1), C0 --> icmp Pred X, C0 >> C1
Sanjay Patel [Thu, 19 Jan 2017 16:12:10 +0000 (16:12 +0000)]
[InstCombine] icmp Pred (shl nsw X, C1), C0 --> icmp Pred X, C0 >> C1

Try harder to fold icmp with shl nsw as discussed here:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/108749.html

This is similar to the 'shl nuw' transforms that were added with D25913.

This may eventually help solve:
https://llvm.org/bugs/show_bug.cgi?id=30773

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

llvm-svn: 292492

7 years ago[clang-tidy] Do not trigger move fix for non-copy assignment operators in performance...
Felix Berger [Thu, 19 Jan 2017 15:51:10 +0000 (15:51 +0000)]
[clang-tidy] Do not trigger move fix for non-copy assignment operators in performance-unnecessary-value-param check

Reviewers: alexfh, sbenza, malcolm.parsons

Subscribers: JDevlieghere, cfe-commits

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

llvm-svn: 292491

7 years agoMark two of the TS implementations as 'in progress'
Marshall Clow [Thu, 19 Jan 2017 15:30:36 +0000 (15:30 +0000)]
Mark two of the TS implementations as 'in progress'

llvm-svn: 292490