platform/upstream/llvm.git
8 years agoRemove an unnecessary include
Enrico Granata [Fri, 12 Feb 2016 23:12:27 +0000 (23:12 +0000)]
Remove an unnecessary include

llvm-svn: 260761

8 years ago[libclang] Separate the underlying indexing functionality of libclang and introduce...
Argyrios Kyrtzidis [Fri, 12 Feb 2016 23:10:59 +0000 (23:10 +0000)]
[libclang] Separate the underlying indexing functionality of libclang and introduce it into the clangIndex library.

It is a general goodness for libclang itself to mostly be a wrapper of functionality provided by the libraries.

llvm-svn: 260760

8 years ago[WebAssembly] Report more meaningful error messages for some unsupported
Derek Schuff [Fri, 12 Feb 2016 22:56:03 +0000 (22:56 +0000)]
[WebAssembly] Report more meaningful error messages for some unsupported
ops.

Computed gotos and RETURNADDR may never be supported; we can do
FRAMEADDR in the future.

llvm-svn: 260759

8 years ago[Hexagon] Optimize stack slot spills
Krzysztof Parzyszek [Fri, 12 Feb 2016 22:53:35 +0000 (22:53 +0000)]
[Hexagon] Optimize stack slot spills

Replace spills to memory with spills to registers, if possible. This
applies mostly to predicate registers (both scalar and vector), since
they are very limited in number. A spill of a predicate register may
happen even if there is a general-purpose register available. In cases
like this the stack spill/reload may be eliminated completely.

This optimization will consider all stack objects, regardless of where
they came from and try to match the live range of the stack slot with
a dead range of a register from an appropriate register class.

llvm-svn: 260758

8 years agoFix remaining Clang-tidy readability-redundant-control-flow warnings; other minor...
Eugene Zelenko [Fri, 12 Feb 2016 22:53:10 +0000 (22:53 +0000)]
Fix remaining Clang-tidy readability-redundant-control-flow warnings; other minor fixes.

Differential revision: http://reviews.llvm.org/D17218

llvm-svn: 260757

8 years agoDarwin: pass -stdlib=libc++ down to cc1 whenever we're targeting libc++
Tim Northover [Fri, 12 Feb 2016 22:30:42 +0000 (22:30 +0000)]
Darwin: pass -stdlib=libc++ down to cc1 whenever we're targeting libc++

Recent refactoring meant it only got passed down when explicitly specified,
which breaks header search on Darwin.

llvm-svn: 260755

8 years ago[llvm-pdbdump] Start to decode some streams
David Majnemer [Fri, 12 Feb 2016 22:27:44 +0000 (22:27 +0000)]
[llvm-pdbdump] Start to decode some streams

We can decode a little bit of the first stream now.

llvm-svn: 260754

8 years ago[Hexagon] Mark HVX registers as volatile
Krzysztof Parzyszek [Fri, 12 Feb 2016 22:26:44 +0000 (22:26 +0000)]
[Hexagon] Mark HVX registers as volatile

llvm-svn: 260753

8 years agoData formatter support for libc++ std::atomic<T>
Enrico Granata [Fri, 12 Feb 2016 22:18:24 +0000 (22:18 +0000)]
Data formatter support for libc++ std::atomic<T>

On libc++ std::atomic is a fairly simple data type (layout wise, at least), wrapping actual contents in a member variable named "__a_"

All the formatters are doing is "peel away" this intermediate layer and exposing user data as direct children or values of the std::atomic root variable

Fixes rdar://24329405

llvm-svn: 260752

8 years agofix test to use FileCheck
Sanjay Patel [Fri, 12 Feb 2016 22:07:54 +0000 (22:07 +0000)]
fix test to use FileCheck

llvm-svn: 260751

8 years ago[WebAssembly] Update test expectations after r260737
Derek Schuff [Fri, 12 Feb 2016 22:05:08 +0000 (22:05 +0000)]
[WebAssembly] Update test expectations after r260737

llvm-svn: 260750

8 years agoFix MemorySanitizer.ptrtoint test on big-endian targets.
Evgeniy Stepanov [Fri, 12 Feb 2016 22:00:22 +0000 (22:00 +0000)]
Fix MemorySanitizer.ptrtoint test on big-endian targets.

llvm-svn: 260749

8 years ago[Hexagon] Recognize more cases in copyPhysReg and stack slot load/store
Krzysztof Parzyszek [Fri, 12 Feb 2016 21:56:41 +0000 (21:56 +0000)]
[Hexagon] Recognize more cases in copyPhysReg and stack slot load/store

llvm-svn: 260748

8 years agoDisable recognition of "using" declarations at translation-unit level.
Sean Callanan [Fri, 12 Feb 2016 21:55:05 +0000 (21:55 +0000)]
Disable recognition of "using" declarations at translation-unit level.

Currently CountDeclLevels uses the ASTs which have no distinction between
separate translation units.  If one .o file has a "using" declaration at
translation unit level, that "using" declaration will be in the same translation
unit as functions from other .o files in the same module.  This leads to
erroneous name conflicts as the CountDeclLevels-based function filtering logic
accepts too many fucntions.

In the future we will identify the translation units for top-level Decls more
reliably and restore that functionality.  There's a TODO to that effect in the
code.

llvm-svn: 260747

8 years ago[codeview] Describe local variables in registers
Reid Kleckner [Fri, 12 Feb 2016 21:48:30 +0000 (21:48 +0000)]
[codeview] Describe local variables in registers

llvm-svn: 260746

8 years agoELF: Add wildcard pattern matching to SECTIONS linker script command.
Rui Ueyama [Fri, 12 Feb 2016 21:47:28 +0000 (21:47 +0000)]
ELF: Add wildcard pattern matching to SECTIONS linker script command.

Each rule in SECTIONS commands is something like ".foo *(.baz.*)",
which instructs the linker to collect all sections whose name matches
".baz.*" from all files and put them into .foo section.

Previously, we didn't recognize the wildcard character. This patch
adds that feature.

Performance impact is a bit concerning because a linker script can
contain hundreds of SECTIONS rules, and doing pattern matching against
each rule would be too expensive. We could merge all patterns into
single DFA so that it takes O(n) to the input size. However, it is
probably too much at this moment -- we don't know whether the
performance of pattern matching matters or not. So I chose to
implement the simplest algorithm in this patch. I hope this simple
pattern matcher is sufficient.

llvm-svn: 260745

8 years ago[CMake] Fixing bots I broke.
Chris Bieneman [Fri, 12 Feb 2016 21:46:25 +0000 (21:46 +0000)]
[CMake] Fixing bots I broke.

llvm-svn: 260744

8 years agoTrying to fix the MSVC build.
Rafael Espindola [Fri, 12 Feb 2016 21:36:59 +0000 (21:36 +0000)]
Trying to fix the MSVC build.

llvm-svn: 260743

8 years ago[CMake] Improve the clang order-file generation workflow
Chris Bieneman [Fri, 12 Feb 2016 21:36:55 +0000 (21:36 +0000)]
[CMake] Improve the clang order-file generation workflow

Summary:
This commit re-lands r259862. The underlying cause of the build breakage was an incorrectly written capabilities test. In tools/Driver/CMakeLists.txt I was attempting to check if a linker flag worked, the test was passing it to the compiler, not the linker. CMake doesn't have a linker test, so we have a hand-rolled one.

Original Patch Review: http://reviews.llvm.org/D16896

Original Summary:
With this change generating clang order files using dtrace uses the following workflow:

cmake <whatever options you want>

ninja generate-order-file

ninja clang

This patch works by setting a default path to the order file (which can be overridden by the user). If the order file doesn't exist during configuration CMake will create an empty one.

CMake then ties up the dependencies between the clang link job and the order file, and generate-order-file overwrites CLANG_ORDER_FILE with the new order file.

Reviewers: bogner

Subscribers: cfe-commits

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

llvm-svn: 260742

8 years ago[PGO] Add another interface for annotateValueSite
Rong Xu [Fri, 12 Feb 2016 21:36:17 +0000 (21:36 +0000)]
[PGO] Add another interface for annotateValueSite

Add another interface to function annotateValueSite() which directly uses the
VauleData array.

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

llvm-svn: 260741

8 years ago[WebAssembly] Fix byval for empty types.
Dan Gohman [Fri, 12 Feb 2016 21:30:18 +0000 (21:30 +0000)]
[WebAssembly] Fix byval for empty types.

llvm-svn: 260740

8 years ago[AArch64] Enable post-RA MI scheduler for Kryo.
Chad Rosier [Fri, 12 Feb 2016 21:27:33 +0000 (21:27 +0000)]
[AArch64] Enable post-RA MI scheduler for Kryo.

This should have landed in r260686.

llvm-svn: 260739

8 years ago[WebAssembly] Fix insertion of a BLOCK in a loop header that also ends a BLOCK.
Dan Gohman [Fri, 12 Feb 2016 21:19:25 +0000 (21:19 +0000)]
[WebAssembly] Fix insertion of a BLOCK in a loop header that also ends a BLOCK.

llvm-svn: 260737

8 years agoTry to fix the build in some bots.
Rafael Espindola [Fri, 12 Feb 2016 21:17:10 +0000 (21:17 +0000)]
Try to fix the build in some bots.

llvm-svn: 260736

8 years agoIRInterpreter now recognizes expressions with constants it doesn't handle.
Sean Callanan [Fri, 12 Feb 2016 21:16:58 +0000 (21:16 +0000)]
IRInterpreter now recognizes expressions with constants it doesn't handle.

If an instruction has a constant that IRInterpreter doesn't know how to deal
with (say, an array constant, because we can't materialize it to APInt) then we
used to ignore that and only fail during expression execution.  This is annoying
because if IRInterpreter had just returned false from CanInterpret(), the JIT
would have been used.

Now the IRInterpreter checks constants as part of CanInterpret(), so this should
hopefully no longer be an issue.

llvm-svn: 260735

8 years agoCentralized symbol lookup in IRExecutionUnit, and fixed the code model.
Sean Callanan [Fri, 12 Feb 2016 21:11:25 +0000 (21:11 +0000)]
Centralized symbol lookup in IRExecutionUnit, and fixed the code model.

I'm preparing to remove symbol lookup from IRForTarget, where it constitutes a
dreadful hack working around no-longer-existing JIT bugs.  Thanks to our
contributors, IRForTarget has a lot of smarts that IRExecutionUnit doesn't have,
so I've cleaned them up a bit and moved them over to IRExecutionUnit.

Also for historical reasons, IRExecutionUnit used the "Small" code model on non-
ELF platforms (namely, OS X).  That's no longer necessary, and we can use the
same code model as everyone else on OS X.  I've fixed that.

llvm-svn: 260734

8 years ago[WinEH] Prevent EH state numbering from skipping nested cleanup pads that never return
Andrew Kaylor [Fri, 12 Feb 2016 21:10:16 +0000 (21:10 +0000)]
[WinEH] Prevent EH state numbering from skipping nested cleanup pads that never return

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

llvm-svn: 260733

8 years ago[LIR] Allow merging of memsets in negatively strided loops.
Chad Rosier [Fri, 12 Feb 2016 21:03:23 +0000 (21:03 +0000)]
[LIR] Allow merging of memsets in negatively strided loops.

Last part of PR25166.

llvm-svn: 260732

8 years agoFix typo in comment.
Justin Lebar [Fri, 12 Feb 2016 21:01:37 +0000 (21:01 +0000)]
Fix typo in comment.

llvm-svn: 260731

8 years ago[SimplifyCFG] Don't fold conditional branches that contain calls to convergent functions.
Justin Lebar [Fri, 12 Feb 2016 21:01:36 +0000 (21:01 +0000)]
[SimplifyCFG] Don't fold conditional branches that contain calls to convergent functions.

Summary:
Performing this optimization duplicates the call to the convergent
function and adds new control-flow dependencies, which is a no-no.

Reviewers: jingyue

Subscribers: broune, hfinkel, tra, resistor, joker.eph, arsenm, llvm-commits, mzolotukhin

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

llvm-svn: 260730

8 years ago[LoopRotate] Don't perform loop rotation if the loop header calls a convergent function.
Justin Lebar [Fri, 12 Feb 2016 21:01:33 +0000 (21:01 +0000)]
[LoopRotate] Don't perform loop rotation if the loop header calls a convergent function.

Summary:
Calls to convergent functions can be duplicated, but only if the
duplicates are not control-flow dependent on any additional values.
Loop rotation doesn't meet the bar.

Reviewers: jingyue

Subscribers: mzolotukhin, llvm-commits, arsenm, joker.eph, resistor, tra, hfinkel, broune

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

llvm-svn: 260729

8 years agoAdd convergent property to CodeMetrics.
Justin Lebar [Fri, 12 Feb 2016 21:01:31 +0000 (21:01 +0000)]
Add convergent property to CodeMetrics.

Summary: No functional changes.

Reviewers: jingyue, arsenm

Subscribers: arsenm, llvm-commits

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

llvm-svn: 260728

8 years agoInitialize CodeMetrics' member variables inline with definitions.
Justin Lebar [Fri, 12 Feb 2016 20:59:20 +0000 (20:59 +0000)]
Initialize CodeMetrics' member variables inline with definitions.

Summary: No functional changes.

Reviewers: jingyue

Subscribers: llvm-commits

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

llvm-svn: 260727

8 years agoAdd initial LTO support.
Rafael Espindola [Fri, 12 Feb 2016 20:54:57 +0000 (20:54 +0000)]
Add initial LTO support.

llvm-svn: 260726

8 years ago[Hexagon] Recognize more instructions in isLoadFromStackSlot/isStoreToStackSlot
Krzysztof Parzyszek [Fri, 12 Feb 2016 20:54:15 +0000 (20:54 +0000)]
[Hexagon] Recognize more instructions in isLoadFromStackSlot/isStoreToStackSlot

llvm-svn: 260725

8 years agoELF: Remove use of MapVector from LinkerScript.
Rui Ueyama [Fri, 12 Feb 2016 20:41:43 +0000 (20:41 +0000)]
ELF: Remove use of MapVector from LinkerScript.

We don't have to use a MapVector here. Instead, just std::vector suffices.

llvm-svn: 260724

8 years agoGet rid of some GLOBAL_ISEL ifdefs that should be harmless for code size.
Quentin Colombet [Fri, 12 Feb 2016 20:41:24 +0000 (20:41 +0000)]
Get rid of some GLOBAL_ISEL ifdefs that should be harmless for code size.
More to come, but those were easy.

llvm-svn: 260723

8 years agoRemove unused variable
David Majnemer [Fri, 12 Feb 2016 20:33:51 +0000 (20:33 +0000)]
Remove unused variable

llvm-svn: 260722

8 years agoAdjust for Python-3.
Siva Chandra [Fri, 12 Feb 2016 20:30:47 +0000 (20:30 +0000)]
Adjust for Python-3.

Summary:
This does not yet give us a clean testsuite run but it does help with:
1. Actually building on linux
2. Run the testsuite with over 70% tests passing on linux.

Reviewers: tfiala, labath, zturner

Subscribers: lldb-commits

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

llvm-svn: 260721

8 years agoRemove LLVMGetTargetMachineData leftovers.
Benjamin Kramer [Fri, 12 Feb 2016 20:26:46 +0000 (20:26 +0000)]
Remove LLVMGetTargetMachineData leftovers.

llvm-svn: 260720

8 years agoAdded missing '__'.
Artem Belevich [Fri, 12 Feb 2016 20:26:43 +0000 (20:26 +0000)]
Added missing '__'.

llvm-svn: 260719

8 years ago[LSan] Print more helpful error message if LSan crashes during leak detection.
Alexey Samsonov [Fri, 12 Feb 2016 20:20:51 +0000 (20:20 +0000)]
[LSan] Print more helpful error message if LSan crashes during leak detection.

llvm-svn: 260717

8 years agoObjective-C++ is a kind of C++.
Sean Callanan [Fri, 12 Feb 2016 19:47:57 +0000 (19:47 +0000)]
Objective-C++ is a kind of C++.

llvm-svn: 260715

8 years ago[ADT] Revert the llvm/ADT/OptionSet.h header and unit test.
Argyrios Kyrtzidis [Fri, 12 Feb 2016 19:47:35 +0000 (19:47 +0000)]
[ADT] Revert the llvm/ADT/OptionSet.h header and unit test.

llvm-svn: 260714

8 years agoMake Target::CalculateProcess() return a sensible result.
Sean Callanan [Fri, 12 Feb 2016 19:45:31 +0000 (19:45 +0000)]
Make Target::CalculateProcess() return a sensible result.

The Calculate* functions in general should not derive any information that isn't
implicit, but for Target the process pointer is a member so it's fine to return
it for CalculateProcess().

llvm-svn: 260713

8 years ago[clang-tidy] Add check performance-faster-string-find
Samuel Benzaquen [Fri, 12 Feb 2016 19:28:14 +0000 (19:28 +0000)]
[clang-tidy] Add check performance-faster-string-find

Summary:
Add check performance-faster-string-find.
It replaces single character string literals to character literals in calls to string::find and friends.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 260712

8 years ago[GVN] Common code for local and non-local load availability [NFCI]
Philip Reames [Fri, 12 Feb 2016 19:24:57 +0000 (19:24 +0000)]
[GVN] Common code for local and non-local load availability [NFCI]

The attached patch removes all of the block local code for performing X-load forwarding by reusing the code used in the non-local case.

The motivation here is to remove duplication and in the process increase our test coverage of some fairly tricky code. I have some upcoming changes I'll be proposing in this area and wanted to have the code cleaned up a bit first.

Note: The review for this mostly happened in email which didn't make it to phabricator on the 258882 commit thread.

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

llvm-svn: 260711

8 years agotest/Headers/float.c: fix theoretical edge values
Hubert Tong [Fri, 12 Feb 2016 19:24:36 +0000 (19:24 +0000)]
test/Headers/float.c: fix theoretical edge values

For *_MANT_DIG, *_MAX_EXP and *_MIN_EXP, the C Standard does not list
the least requirements directly. This patch adjusts the test values with
refined ones.

Patch by Jorge Teixeira!

llvm-svn: 260710

8 years ago[AST] Fix typos in RecordLayoutBuilder
David Majnemer [Fri, 12 Feb 2016 19:21:02 +0000 (19:21 +0000)]
[AST] Fix typos in RecordLayoutBuilder

No functional change is intended.

llvm-svn: 260709

8 years ago[CMake] Pass stage1 tools through to stage2 when building with LTO
Chris Bieneman [Fri, 12 Feb 2016 19:06:12 +0000 (19:06 +0000)]
[CMake] Pass stage1 tools through to stage2 when building with LTO

This was originally a hacky if(APPLE) block. Now that we have an option for enabling LTO, it is better to properly gate this.

llvm-svn: 260707

8 years ago[LIR] Partially revert r252926(NFC), which introduced a very subtle change.
Chad Rosier [Fri, 12 Feb 2016 19:05:27 +0000 (19:05 +0000)]
[LIR] Partially revert r252926(NFC), which introduced a very subtle change.

In short, before r252926 we were comparing an unsigned (StoreSize) against an a
APInt (Stride), which is fine and well.  After we were zero extending the Stride
and then converting to an unsigned, which is not the same thing.  Obviously,
Stides can also be negative.  This commit just restores the original behavior.

AFAICT, it's not possible to write a test case to expose the issue because
the code already has checks to make sure the StoreSize can't overflow an
unsigned (which prevents the Stride from overflowing an unsigned as well).

llvm-svn: 260706

8 years ago[LVI] Exploit nsw/nuw when computing constant ranges
Philip Reames [Fri, 12 Feb 2016 19:05:16 +0000 (19:05 +0000)]
[LVI] Exploit nsw/nuw when computing constant ranges

As the title says. Modelled after similar code in SCEV.

This is useful when analysing induction variables in loops which have been canonicalized by other passes. I wrote the tests as non-loops specifically to avoid the generality introduced in http://reviews.llvm.org/D17174. While that can handle many induction variables without *needing* to exploit nsw, there's no reason not to use it if we've already proven it.

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

llvm-svn: 260705

8 years ago[CMake] don't build libLTO when LLVM_ENABLE_PIC is OFF
Hans Wennborg [Fri, 12 Feb 2016 19:02:39 +0000 (19:02 +0000)]
[CMake] don't build libLTO when LLVM_ENABLE_PIC is OFF

When cmake is run with -DLLVM_ENABLE_PIC=OFF, build fails while
linking shared library libLTO.so, because its dependencies are built
with -fno-PIC. More details here: https://llvm.org/bugs/show_bug.cgi?id=26484.
This diff reverts r252652 (git 9fd4377ddb83aee3c049dc8757e7771edbb8ee71),
which removed check NOT LLVM_ENABLE_PIC before disabling build for libLTO.so.

Patch by Igor Sugak!

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

llvm-svn: 260703

8 years agoGlobalISel is always built since r260566, reflect it in LLVMBuild.txt
Mehdi Amini [Fri, 12 Feb 2016 18:43:14 +0000 (18:43 +0000)]
GlobalISel is always built since r260566, reflect it in LLVMBuild.txt

Other component could not depends on an optional library in llvm-config

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260701

8 years agollvm-config: replace assertions with a helpful error message
Mehdi Amini [Fri, 12 Feb 2016 18:43:10 +0000 (18:43 +0000)]
llvm-config: replace assertions with a helpful error message

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260700

8 years agoRenamed TestRdar12991846 to the more descriptive TestUnicodeLiterals.
Sean Callanan [Fri, 12 Feb 2016 18:42:00 +0000 (18:42 +0000)]
Renamed TestRdar12991846 to the more descriptive TestUnicodeLiterals.

Test cases should not be named after PR or Radar numbers.  It's fine to
annotate them with these numbers in comments, however.

llvm-svn: 260699

8 years ago[Hexagon] Add utility functions to detect sign- and zero-extending loads
Krzysztof Parzyszek [Fri, 12 Feb 2016 18:37:23 +0000 (18:37 +0000)]
[Hexagon] Add utility functions to detect sign- and zero-extending loads

llvm-svn: 260698

8 years ago[CUDA] Tweak attribute-based overload resolution to match nvcc behavior.
Artem Belevich [Fri, 12 Feb 2016 18:29:18 +0000 (18:29 +0000)]
[CUDA] Tweak attribute-based overload resolution to match nvcc behavior.

This is an artefact of split-mode CUDA compilation that we need to
mimic. HD functions are sometimes allowed to call H or D functions. Due
to split compilation mode device-side compilation will not see host-only
function and thus they will not be considered at all. For clang both H
and D variants will become function overloads visible to
compiler. Normally target attribute is considered only if C++ rules can
not determine which function is better. However in this case we need to
ignore functions that would not be present during current compilation
phase before we apply normal overload resolution rules.

Changes:
* introduced another level of call preference to better describe
  possible call combinations.
* removed WrongSide functions from consideration if the set contains
  SameSide function.
* disabled H->D, D->H and G->H calls. These combinations are
  not allowed by CUDA and we were reluctantly allowing them to work
  around device-side calls to math functions in std namespace.
  We no longer need it after r258880.

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

llvm-svn: 260697

8 years ago[Hexagon] Replace expansion of spill pseudo-instructions in frame lowering
Krzysztof Parzyszek [Fri, 12 Feb 2016 18:19:53 +0000 (18:19 +0000)]
[Hexagon] Replace expansion of spill pseudo-instructions in frame lowering

Rewrite the code to handle all pseudo-instructions in a single pass.

This temporarily reverts spill slot optimization that used general-
purpose registers to hold values of spilled predicate registers.

llvm-svn: 260696

8 years ago[InstCombine] Don't aggressively replace xor with icmp
David Majnemer [Fri, 12 Feb 2016 18:12:38 +0000 (18:12 +0000)]
[InstCombine] Don't aggressively replace xor with icmp

For some cases, InstCombine replaces the sequence of xor/sub instruction
followed by cmp instruction into a single cmp instruction.

However, this replacement may result suboptimal result especially when
the xor/sub has more than one use, as discussed in
bug 26465 (https://llvm.org/bugs/show_bug.cgi?id=26465).

This patch make the replacement happen only when xor/sub has only one
use.

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

Patch by Taewook Oh!

llvm-svn: 260695

8 years ago[AMDGPU] Assembler: Swap operands of flat_store instructions to match AMD assembler
Tom Stellard [Fri, 12 Feb 2016 17:57:54 +0000 (17:57 +0000)]
[AMDGPU] Assembler: Swap operands of flat_store instructions to match AMD assembler

Historically, AMD internal sp3 assembler has flat_store* addr, data
format. To match existing code and to enable reuse, change LLVM
definitions to match.  Also update MC and CodeGen tests.

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

Patch by: Nikolay Haustov

llvm-svn: 260694

8 years agoAMDGPU/SI: Annotate Loops with Constant Condition in SIAnnotateControlFlow pass.
Changpeng Fang [Fri, 12 Feb 2016 17:11:04 +0000 (17:11 +0000)]
AMDGPU/SI: Annotate Loops with Constant Condition in SIAnnotateControlFlow pass.

Summary:
  It is possible that the loop condition can be a boolean constant (infinite loop,
for example). So we sould handle constant condition in annotating a loop. This
patch adds this functionality to support annotating constant condition.

Reviewers: tstellarAMD, arsenm

Subscribers: llvm-commits, arsenm

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

llvm-svn: 260692

8 years ago[Hexagon] Remove HexagonExpandPredSpillCode pass
Krzysztof Parzyszek [Fri, 12 Feb 2016 17:09:58 +0000 (17:09 +0000)]
[Hexagon] Remove HexagonExpandPredSpillCode pass

This code is dead. The expansion is now done in HexagonFrameLowering.

llvm-svn: 260691

8 years ago[Hexagon] Eliminate pseudo instructions for circ/brev loads and stores
Krzysztof Parzyszek [Fri, 12 Feb 2016 17:01:51 +0000 (17:01 +0000)]
[Hexagon] Eliminate pseudo instructions for circ/brev loads and stores

We can generate the actual instructions from the intrinsics without the
need for pseudo-instructions. Also, since the intrinsics have a side-
effect in a form of a store, attempt to optimize away loads from the
store location.

llvm-svn: 260690

8 years ago[AArch64] Reduce number of callee-save save/restores.
Geoff Berry [Fri, 12 Feb 2016 16:31:41 +0000 (16:31 +0000)]
[AArch64] Reduce number of callee-save save/restores.

Summary:
Before this change, callee-save registers would be rounded up to even
pairs of GPRs and FPRs.  This change eliminates these extra padding
load/stores, though it does keep the stack allocation the same size
unless both the GPR and FPR sets have an odd size, in which case one
full pair stack slot (16 bytes) is saved.

This optimization cannot currently be done for MachO targets since they
rely on a fast-path .debug_frame equivalent that can only encode
callee-save registers as pairs.

Reviewers: t.p.northover, rengolin, mcrosier, jmolloy

Subscribers: aemerson, rengolin, mcrosier, llvm-commits

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

llvm-svn: 260689

8 years ago[Hexagon] Handle out-of-range offsets in eliminateFrameIndex
Krzysztof Parzyszek [Fri, 12 Feb 2016 16:27:23 +0000 (16:27 +0000)]
[Hexagon] Handle out-of-range offsets in eliminateFrameIndex

Create a virtual register that will hold the actual address and use it
with the offset of 0 in the place of the original FI.

llvm-svn: 260688

8 years ago[AArch64] Add support for Qualcomm Kryo CPU.
Chad Rosier [Fri, 12 Feb 2016 15:51:51 +0000 (15:51 +0000)]
[AArch64] Add support for Qualcomm Kryo CPU.

Machine model description by Dave Estes <cestes@codeaurora.org>.

llvm-svn: 260686

8 years agomake needsPlt a pure predicate.
Rafael Espindola [Fri, 12 Feb 2016 15:47:37 +0000 (15:47 +0000)]
make needsPlt a pure predicate.

llvm-svn: 260685

8 years agoDelete the deprecated LLVMLinkModules.
Rafael Espindola [Fri, 12 Feb 2016 15:28:45 +0000 (15:28 +0000)]
Delete the deprecated LLVMLinkModules.

llvm-svn: 260683

8 years ago[AArch64] Merge two adjacent str WZR into str XZR
Jun Bum Lim [Fri, 12 Feb 2016 15:25:39 +0000 (15:25 +0000)]
[AArch64] Merge two adjacent str WZR into str XZR

Summary:
This change merges adjacent 32 bit zero stores into a 64 bit zero store.
e.g.,
  str wzr, [x0]
  str wzr, [x0, #4]
becomes
  str xzr, [x0]

Therefore, four adjacent 32 bit zero stores will be a single stp.
e.g.,
  str wzr, [x0]
  str wzr, [x0, #4]
  str wzr, [x0, #8]
  str wzr, [x0, #12]
becomes
  stp xzr, xzr, [x0]

Reviewers: mcrosier, jmolloy, gberry, t.p.northover

Subscribers: aemerson, rengolin, mcrosier, llvm-commits

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

llvm-svn: 260682

8 years agoReapply r260096.
Aaron Ballman [Fri, 12 Feb 2016 15:09:05 +0000 (15:09 +0000)]
Reapply r260096.

Expand the simplify boolean expression check to handle implicit conversion of integral types to bool and improve the handling of implicit conversion of member pointers to bool.

Implicit conversion of member pointers are replaced with explicit comparisons to nullptr.

Implicit conversions of integral types are replaced with explicit comparisons to 0.

Patch by Richard Thomson.

llvm-svn: 260681

8 years ago[Hexagon] Specify vector alignment in DataLayout string
Krzysztof Parzyszek [Fri, 12 Feb 2016 14:48:34 +0000 (14:48 +0000)]
[Hexagon] Specify vector alignment in DataLayout string

The DataLayout can calculate alignment of vectors based on the alignment
of the element type and the number of elements. In fact, it is the product
of these two values. The problem is that for vectors of N x i1, this will
return the alignment of N bytes, since the alignment of i1 is 8 bits. The
vector types of vNi1 should be aligned to N bits instead. Provide explicit
alignment for HVX vectors to avoid such complications.

llvm-svn: 260680

8 years agoRe-commit r260230 with a fix for clang-cmake-aarch64-42vma.
Daniel Sanders [Fri, 12 Feb 2016 14:48:19 +0000 (14:48 +0000)]
Re-commit r260230 with a fix for clang-cmake-aarch64-42vma.

There is now a default name_suffix ('default') which should appease the buildbot
and reveal why this builder lacks a suffix.

llvm-svn: 260679

8 years ago[Hexagon] Specify vector alignment in DataLayout string
Krzysztof Parzyszek [Fri, 12 Feb 2016 14:47:38 +0000 (14:47 +0000)]
[Hexagon] Specify vector alignment in DataLayout string

The DataLayout can calculate alignment of vectors based on the alignment
of the element type and the number of elements. In fact, it is the product
of these two values. The problem is that for vectors of N x i1, this will
return the alignment of N bytes, since the alignment of i1 is 8 bits. The
vector types of vNi1 should be aligned to N bits instead. Provide explicit
alignment for HVX vectors to avoid such complications.

llvm-svn: 260678

8 years ago[lld] [ELF/AArch64] Add support to some GD/LE/IS TLS relocations
Adhemerval Zanella [Fri, 12 Feb 2016 13:43:03 +0000 (13:43 +0000)]
[lld] [ELF/AArch64] Add support to some GD/LE/IS TLS relocations

This patch adds some TLS relocations and relaxations for AArch64.
Some Global-Dynamic relocation are handled by optimizing them to
Local-Exec (Initial-Exec is not yet supported). They are:

 - R_AARCH64_TLSDESC_ADR_PAGE21
 - R_AARCH64_TLSDESC_LD64_LO12_NC
 - R_AARCH64_TLSDESC_ADD_LO12_NC
 - R_AARCH64_TLSDESC_CALL

Also some Init-Exec is optimized to Local-Exec if possible. They are:

 - R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21
 - R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC

Finally some Local-Exec relocation are handled in relocateOne:

 - R_AARCH64_TLSLE_ADD_TPREL_HI12
 - R_AARCH64_TLSLE_ADD_TPREL_LO12_NC

This work is mainly for compiler bootstrap, where static binaries is
showing good progress (although shared object still lacking support
from both TLS aarch64 backend and some other issues).

llvm-svn: 260677

8 years agoFix uninitialized memory read.
Benjamin Kramer [Fri, 12 Feb 2016 12:37:21 +0000 (12:37 +0000)]
Fix uninitialized memory read.

Found by msan.

llvm-svn: 260676

8 years agoFix ICE with constexpr and friend functions
Olivier Goffart [Fri, 12 Feb 2016 12:34:44 +0000 (12:34 +0000)]
Fix ICE with constexpr and friend functions

Fix a crash while parsing this code:

  struct X  {
    friend constexpr int foo(X*) { return 12; }
    static constexpr int j = foo(static_cast<X*>(nullptr));
  };

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

llvm-svn: 260675

8 years ago[OMPT] Frame information for openmp taskwait
Jonas Hahnfeld [Fri, 12 Feb 2016 12:19:59 +0000 (12:19 +0000)]
[OMPT] Frame information for openmp taskwait

For pragma omp taskwait the runtime is called from the task context.
Therefore, the reentry frame information should be updated.

The information should be available for both taskwait event calls; therefore,
set before the first event and reset after the last event.

Patch by Joachim Protze
Differential Revision: http://reviews.llvm.org/D17145

llvm-svn: 260674

8 years ago[mips][micromips] Written missing test for CEIL.L.S, CEIL.L.D, FLOOR.L.S and FLOOR...
Hrvoje Varga [Fri, 12 Feb 2016 12:11:26 +0000 (12:11 +0000)]
[mips][micromips] Written missing test for CEIL.L.S, CEIL.L.D, FLOOR.L.S and FLOOR.L.D instructions
Differential Revision: http://reviews.llvm.org/D17192

llvm-svn: 260673

8 years agoRevert r260669 while the clang-cmake-aarch64-42vma failures is investigated.
Daniel Sanders [Fri, 12 Feb 2016 12:09:57 +0000 (12:09 +0000)]
Revert r260669 while the clang-cmake-aarch64-42vma failures is investigated.

There's no obvious reason it should fail in this way but it's the only change
on the blamelist. I suspect stale lit*.cfg's from previous builds.

llvm-svn: 260672

8 years ago[OpenCL] Disable C99 standard lib functions
Anastasia Stulova [Fri, 12 Feb 2016 12:07:04 +0000 (12:07 +0000)]
[OpenCL] Disable C99 standard lib functions

The library functions defined in the C99 standard headers
are not available (OpenCL v1.2 s6.9.f).

This change stops treating OpenCL builtin functions as standard C lib
functions to eliminate warning messages about printf format string.

Patch by Liu Yaxun (Sam)!

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

llvm-svn: 260671

8 years agoRemove LLVMGetTargetMachineData in go-binding.
Haojian Wu [Fri, 12 Feb 2016 11:35:11 +0000 (11:35 +0000)]
Remove LLVMGetTargetMachineData in go-binding.

Summary:
LLVMGetTargetMachineData has been removed, and LLVMGetDataLayout is
suggested to use. The LLVMGetDataLayout is exposed in go bindings.
So it's safe to remove the function.

Reviewers: bkramer

Subscribers: llvm-commits, axw

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

llvm-svn: 260670

8 years ago[msan+tsan] Bring back the tests that disappeared after r260230 and r259512.
Daniel Sanders [Fri, 12 Feb 2016 10:35:53 +0000 (10:35 +0000)]
[msan+tsan] Bring back the tests that disappeared after r260230 and r259512.

The lit test-suite containing the unit tests needs to be explicitly specified
as an argument to lit.py since it is no longer discovered when the other tests
are run (because they are one directory deeper).

dfsan, lsan, and sanitizer_common don't show the same problem.

llvm-svn: 260669

8 years ago[attrs] Simplify the convergent removal to directly use the pre-built
Chandler Carruth [Fri, 12 Feb 2016 09:47:49 +0000 (09:47 +0000)]
[attrs] Simplify the convergent removal to directly use the pre-built
node set rather than walking the SCC directly.

This directly exposes the functions and has already had null entries
filtered out. We also don't need need to handle optnone as it has
already been handled in the caller -- we never try to remove convergent
when there are optnone functions in the SCC.

With this change, the code for removing convergent should work with the
new pass manager and a different SCC analysis.

llvm-svn: 260668

8 years ago[clang-tidy] Fix failure in 'misc-misplaced-widening-cast' test.
Daniel Marjamaki [Fri, 12 Feb 2016 09:38:38 +0000 (09:38 +0000)]
[clang-tidy] Fix failure in 'misc-misplaced-widening-cast' test.

I added portability warnings when int results are casted to long. I forgot to handle uint, ulong and ulonglong.

Tested on x86 and powerpc targets, hope it works now on all buildbots.

llvm-svn: 260667

8 years ago[attrs] Consolidate the test for a non-SCC, non-convergent function call
Chandler Carruth [Fri, 12 Feb 2016 09:23:53 +0000 (09:23 +0000)]
[attrs] Consolidate the test for a non-SCC, non-convergent function call
with the test for a non-convergent intrinsic call.

While it is possible to use the call records to search for function
calls, we're going to do an instruction scan anyways to find the
intrinsics, we can handle both cases while scanning instructions. This
will also make the logic more amenable to the new pass manager which
doesn't use the same call graph structure.

My next patch will remove use of CallGraphNode entirely and allow this
code to work with both the old and new pass manager. Fortunately, it
should also get strictly simpler without changing functionality.

llvm-svn: 260666

8 years ago[clang-tidy] improve misc-misplaced-widening-cast so it also detects portability...
Daniel Marjamaki [Fri, 12 Feb 2016 07:51:10 +0000 (07:51 +0000)]
[clang-tidy] improve misc-misplaced-widening-cast so it also detects portability problems.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 260665

8 years agoThe data formatters for NSArray, NSDictionary and (only partially) NSSet contain...
Enrico Granata [Fri, 12 Feb 2016 07:50:15 +0000 (07:50 +0000)]
The data formatters for NSArray, NSDictionary and (only partially) NSSet contain logic to inspect the objects without running code.
However, they also contain fallback logic that - in cases where LLDB can't recognize the specific subclass - actually does run code in order to inspect those objects.

The argument for this logic was that these data types are critical enough that the risk of getting it wrong is outweighed by the advantage of always providing accurate child information.

Practical experience however shows that "po" - a code running data-inspection command - is quite frequently used, and not considered burdensome by users.
As such, this makes the code-running fallback in the data formatters a risk that carries very little actual reward. Also, unlike the time this code was originally written, we now have accurate class information for Objective-C, and thus we are less likely to improperly identify classes.

This commit removes support for the code-running fallback, and aligns the data formatters for NSArray, NSDictionary and NSSet to the general no-code-running behavior of other data formatters.

While it is possible for us to add support for some subclasses that are now no longer covered by static inspection alone, this is beyond the scope of this commit.

llvm-svn: 260664

8 years ago[unittests/ADT] OptionSetTest: ifdef out for now a specific test that fails on MSVC.
Argyrios Kyrtzidis [Fri, 12 Feb 2016 07:50:01 +0000 (07:50 +0000)]
[unittests/ADT] OptionSetTest: ifdef out for now a specific test that fails on MSVC.

llvm-svn: 260663

8 years ago[CMake] Add option to switch default C++ stdlib
Jonas Hahnfeld [Fri, 12 Feb 2016 07:48:37 +0000 (07:48 +0000)]
[CMake] Add option to switch default C++ stdlib

With this option one can optionally override the architecture dependent
default library to use if no -stdlib= is provided on compiler invocation.

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

llvm-svn: 260662

8 years agotests: Add explicit -stdlib=libstdc++ to tests that require it
Jonas Hahnfeld [Fri, 12 Feb 2016 07:48:28 +0000 (07:48 +0000)]
tests: Add explicit -stdlib=libstdc++ to tests that require it

This will be needed for the next commit that allows to switch the default
C++ library which would otherwise make these tests fail.

llvm-svn: 260661

8 years agoAMDGPU: Set flat_scratch from flat_scratch_init reg
Matt Arsenault [Fri, 12 Feb 2016 06:31:30 +0000 (06:31 +0000)]
AMDGPU: Set flat_scratch from flat_scratch_init reg

This was hardcoded to the static private size, but this
would be missing the offset and additional size for someday
when we have dynamic sizing.

Also stops always initializing flat_scratch even when unused.

In the future we should stop emitting this unless flat instructions
are used to access private memory. For example this will initialize
it almost always on VI because flat is used for global access.

llvm-svn: 260658

8 years agoC API: Remove LLVMGetDataLayout that was deprecated in 3.7
Mehdi Amini [Fri, 12 Feb 2016 06:22:00 +0000 (06:22 +0000)]
C API: Remove LLVMGetDataLayout that was deprecated in 3.7

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260657

8 years agoFix minor error with debug info doc.
Mark Lacey [Fri, 12 Feb 2016 06:19:16 +0000 (06:19 +0000)]
Fix minor error with debug info doc.

Replace 'third' with 'fourth' in the description of the fourth argument.

llvm-svn: 260656

8 years ago[unittests/ADT] OptionSetTest: ifdef out a part that fails to compile on MSVC.
Argyrios Kyrtzidis [Fri, 12 Feb 2016 05:52:37 +0000 (05:52 +0000)]
[unittests/ADT] OptionSetTest: ifdef out a part that fails to compile on MSVC.

llvm-svn: 260655

8 years ago[ADT] OptionSet: ifdef out some code that seems to be crashing MSVC.
Argyrios Kyrtzidis [Fri, 12 Feb 2016 04:36:48 +0000 (04:36 +0000)]
[ADT] OptionSet: ifdef out some code that seems to be crashing MSVC.

llvm-svn: 260654

8 years ago[attrs] Run clang-format over a newly added routine in function-attrs
Chandler Carruth [Fri, 12 Feb 2016 03:07:50 +0000 (03:07 +0000)]
[attrs] Run clang-format over a newly added routine in function-attrs
before I update it to be friendly with the new pass manager.

llvm-svn: 260653

8 years ago[ADT] Introduce ‘OptionSet’ in llvm/ADT headers, which is a utility class that makes...
Argyrios Kyrtzidis [Fri, 12 Feb 2016 02:48:26 +0000 (02:48 +0000)]
[ADT] Introduce ‘OptionSet’ in llvm/ADT headers, which is a utility class that makes it convenient to work with enumerators representing bit options.

llvm-svn: 260652

8 years agoAMDGPU: Set element_size in private resource descriptor
Matt Arsenault [Fri, 12 Feb 2016 02:40:47 +0000 (02:40 +0000)]
AMDGPU: Set element_size in private resource descriptor

Introduce a subtarget feature for this, and leave the default with
the current behavior which assumes up to 16-byte loads/stores can
be used. The field also seems to have the ability to be set to 2 bytes,
but I'm not sure what that would be used for.

llvm-svn: 260651

8 years ago[libFuzzer] make -runs=N flag also affect the simple runner (will execute every input...
Kostya Serebryany [Fri, 12 Feb 2016 02:32:03 +0000 (02:32 +0000)]
[libFuzzer] make -runs=N flag also affect the simple runner (will execute every input N times)

llvm-svn: 260649