platform/upstream/llvm.git
7 years ago[ELF] Add a NOP instruction to make LLVM generate a mapping symbol
Peter Smith [Fri, 31 Mar 2017 13:08:49 +0000 (13:08 +0000)]
[ELF] Add a NOP instruction to make LLVM generate a mapping symbol

This is a test change applicable for ARM targets.

Previously LLVM would generate a mapping symbol when code contains only
data. This was changed as part of

https://reviews.llvm.org/D30724

and to be more close to the ARM ELF ABI.

The test case is changed to check for behavior with minimal changes.

Patch by Shankar Easwaran

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

llvm-svn: 299212

7 years agoMake naming in Host.h in line with coding standards.
Kristof Beyls [Fri, 31 Mar 2017 13:06:40 +0000 (13:06 +0000)]
Make naming in Host.h in line with coding standards.

Based on post-commit review comments by Chandler Carruth on
https://reviews.llvm.org/D31236. Thanks!

llvm-svn: 299211

7 years agoclang-format vs plugin support for Visual Studio 2017
Hans Wennborg [Fri, 31 Mar 2017 12:50:42 +0000 (12:50 +0000)]
clang-format vs plugin support for Visual Studio 2017

With the release of Visual Studio 2017, we need to at the very least
claim support for it in the current manifest file. With the changes
introducted in this patch we can install the extension again, but a
warning message will be shown stating that it's not supported
(https://twitter.com/parsley72/status/846558416751411200).

To get the rid of the warning more work is necessary, as VS 2017 changed
some things about extensions, see more here:
https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-migrate-extensibility-projects-to-visual-studio-2017.
While working on those changes, it has been suggested in the
mail list that this first patch is integrated in the meantime.

Patch by Hugo Puhlmann!

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

llvm-svn: 299210

7 years agoUse the current working directory in the glob expansion
Rafael Espindola [Fri, 31 Mar 2017 12:46:39 +0000 (12:46 +0000)]
Use the current working directory in the glob expansion

This fixes tests that do things like

mkdir <dir>
cd <dir>
..
<cmd> *.foo

llvm-svn: 299209

7 years agoRemove unnecessary cast and branch. NFC.
James Henderson [Fri, 31 Mar 2017 12:31:23 +0000 (12:31 +0000)]
Remove unnecessary cast and branch. NFC.

llvm-svn: 299208

7 years agoUpdate comment for r299098 per feedback from James Henderson.
Yaron Keren [Fri, 31 Mar 2017 12:08:45 +0000 (12:08 +0000)]
Update comment for r299098 per feedback from James Henderson.

llvm-svn: 299207

7 years agoRemove unused variable.
Sam McCall [Fri, 31 Mar 2017 12:07:58 +0000 (12:07 +0000)]
Remove unused variable.

llvm-svn: 299206

7 years ago[ScalarEvolution] Re-enable Predicate implication from operations
Max Kazantsev [Fri, 31 Mar 2017 12:05:30 +0000 (12:05 +0000)]
[ScalarEvolution] Re-enable Predicate implication from operations

The patch rL298481 was reverted due to crash on clang-with-lto-ubuntu build.
The reason of the crash was type mismatch between either a or b and RHS in the following situation:

  LHS = sext(a +nsw b) > RHS.

This is quite rare, but still possible situation. Normally we need to cast all {a, b, RHS} to their widest type.
But we try to avoid creation of new SCEV that are not constants to avoid initiating recursive analysis that
can take a lot of time and/or cache a bad value for iterations number. To deal with this, in this patch we
reject this case and will not try to analyze it if the type of sum doesn't match with the type of RHS. In this
situation we don't need to create any non-constant SCEVs.

This patch also adds an assertion to the method IsProvedViaContext so that we could fail on it and not
go further into range analysis etc (because in some situations these analyzes succeed even when the passed
arguments have wrong types, what should not normally happen).

The patch also contains a fix for a problem with too narrow scope of the analysis caused by wrong
usage of predicates in recursive invocations.

The regression test on the said failure: test/Analysis/ScalarEvolution/implied-via-addition.ll

Reviewers: reames, apilipenko, anna, sanjoy

Reviewed By: sanjoy

Subscribers: mzolotukhin, mehdi_amini, llvm-commits

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

llvm-svn: 299205

7 years agoclang-format: [JavaScript] Ignore QT keywords.
Daniel Jasper [Fri, 31 Mar 2017 12:04:37 +0000 (12:04 +0000)]
clang-format: [JavaScript] Ignore QT keywords.

llvm-svn: 299204

7 years agoDo not pollute the namespace in a header file.
Kristof Beyls [Fri, 31 Mar 2017 12:00:24 +0000 (12:00 +0000)]
Do not pollute the namespace in a header file.

llvm-svn: 299203

7 years ago[AMDGPU] SDWA Peephole: improve search for immediates in SDWA patterns
Sam Kolton [Fri, 31 Mar 2017 11:42:43 +0000 (11:42 +0000)]
[AMDGPU] SDWA Peephole: improve search for immediates in SDWA patterns

Previously compiler often extracted common immediates into specific register, e.g.:
```
%vreg0 = S_MOV_B32 0xff;
%vreg2 = V_AND_B32_e32 %vreg0, %vreg1
%vreg4 = V_AND_B32_e32 %vreg0, %vreg3
```
Because of this SDWA peephole failed to find SDWA convertible pattern. E.g. in previous example this could be converted into 2 SDWA src operands:
```
SDWA src: %vreg2 src_sel:BYTE_0
SDWA src: %vreg4 src_sel:BYTE_0
```
With this change peephole check if operand is either immediate or register that is copy of immediate.

llvm-svn: 299202

7 years ago[DAGCombiner] Add vector demanded elements support to computeKnownBitsForTargetNode
Simon Pilgrim [Fri, 31 Mar 2017 11:24:16 +0000 (11:24 +0000)]
[DAGCombiner] Add vector demanded elements support to computeKnownBitsForTargetNode

Follow up to D25691, this sets up the plumbing necessary to support vector demanded elements support in known bits calculations in target nodes.

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

llvm-svn: 299201

7 years ago[LLDB][MIPS] Core Dump Support.
Nitesh Jain [Fri, 31 Mar 2017 11:14:02 +0000 (11:14 +0000)]
[LLDB][MIPS] Core Dump Support.

Reviewers: labath, emaste

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 299200

7 years ago[LLDB][MIPS] Fix Core file Architecture and OS information.
Nitesh Jain [Fri, 31 Mar 2017 11:06:25 +0000 (11:06 +0000)]
[LLDB][MIPS] Fix Core file Architecture and OS information.

Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 299199

7 years agoSpelling mistakes in comments. NFCI.
Simon Pilgrim [Fri, 31 Mar 2017 11:00:53 +0000 (11:00 +0000)]
Spelling mistakes in comments. NFCI.

llvm-svn: 299198

7 years agoSpelling mistakes in comments. NFCI.
Simon Pilgrim [Fri, 31 Mar 2017 10:59:37 +0000 (10:59 +0000)]
Spelling mistakes in comments. NFCI.

llvm-svn: 299197

7 years ago[LLDB][MIPS] Check if memory_info.GetName() is empty before finding corresponding...
Nitesh Jain [Fri, 31 Mar 2017 10:55:55 +0000 (10:55 +0000)]
[LLDB][MIPS] Check if memory_info.GetName() is empty before finding corresponding module.

Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 299196

7 years agoFix MSVC 'not all control paths return a value' warning
Simon Pilgrim [Fri, 31 Mar 2017 10:46:47 +0000 (10:46 +0000)]
Fix MSVC 'not all control paths return a value' warning

llvm-svn: 299195

7 years agoFix signed/unsigned warning
Simon Pilgrim [Fri, 31 Mar 2017 10:45:35 +0000 (10:45 +0000)]
Fix signed/unsigned warning

llvm-svn: 299194

7 years agoStrip trailing whitespace
Simon Pilgrim [Fri, 31 Mar 2017 10:40:56 +0000 (10:40 +0000)]
Strip trailing whitespace

llvm-svn: 299193

7 years ago[OpenCL] Do not generate "kernel_arg_type_qual" metadata for non-pointer args
Egor Churaev [Fri, 31 Mar 2017 10:14:52 +0000 (10:14 +0000)]
[OpenCL] Do not generate "kernel_arg_type_qual" metadata for non-pointer args

Summary:
"kernel_arg_type_qual" metadata should contain const/volatile/restrict
tags only for pointer types to match the corresponding requirement of
the OpenCL specification.

OpenCL 2.0 spec 5.9.3 Kernel Object Queries:

CL_KERNEL_ARG_TYPE_VOLATILE is returned if the argument is a pointer
and the referenced type is declared with the volatile qualifier.
[...]
Similarly, CL_KERNEL_ARG_TYPE_CONST is returned if the argument is a
pointer and the referenced type is declared with the restrict or const
qualifier.
[...]
CL_KERNEL_ARG_TYPE_RESTRICT will be returned if the pointer type is
marked restrict.

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

llvm-svn: 299192

7 years ago[msan] Turn off lifetime markers even when use after scope checking is on.
Benjamin Kramer [Fri, 31 Mar 2017 09:19:25 +0000 (09:19 +0000)]
[msan] Turn off lifetime markers even when use after scope checking is on.

Since r299174 use after scope checking is on by default. Even though
msan doesn't check for use after scope it gets confused by the lifetime
markers emitted for it, making unit tests fail. This is covered by
ninja check-msan.

llvm-svn: 299191

7 years ago[clang-tidy] Correct code-block in the doc.
Haojian Wu [Fri, 31 Mar 2017 07:55:22 +0000 (07:55 +0000)]
[clang-tidy] Correct code-block in the doc.

llvm-svn: 299190

7 years agoInstsimplify: Adding shufflevector test. NFC.
Zvi Rackover [Fri, 31 Mar 2017 07:46:02 +0000 (07:46 +0000)]
Instsimplify: Adding shufflevector test. NFC.

Adding some test-cases demonstrating cases that need to be improved.
To be followed by patches that improve these cases.

llvm-svn: 299189

7 years ago[asan] Move AsanCheckDynamicRTPrereqs check under flag
Maxim Ostapenko [Fri, 31 Mar 2017 06:36:37 +0000 (06:36 +0000)]
[asan] Move AsanCheckDynamicRTPrereqs check under flag

The patch addresses https://github.com/google/sanitizers/issues/786. Currently AsanCheckDynamicRTPrereqs prevents
dynamic ASan runtime from running in some important environments e.g. cowbuilder and fakeroot that may also work with interposition.
Let's allow users to switch off the check given that they know what they do.

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

llvm-svn: 299188

7 years ago[APInt] Add unittests that demonstrate how very broken APIntOps::isShiftedMask is.
Craig Topper [Fri, 31 Mar 2017 06:30:25 +0000 (06:30 +0000)]
[APInt] Add unittests that demonstrate how very broken APIntOps::isShiftedMask is.

Did you know that 0 is a shifted mask? But 0x0000ff00 and 0x000000ff aren't? At least we get 0xff000000 right.

I only see one usage of this function in the code base today and its in InstCombine. I think its protected against 0 being misreported as a mask. I guess we just don't have tests for the missed cases.

llvm-svn: 299187

7 years ago[Scalarizer] Handle scalar arguments in vector GEP
Mikael Holmen [Fri, 31 Mar 2017 06:29:49 +0000 (06:29 +0000)]
[Scalarizer] Handle scalar arguments in vector GEP

Summary:
Triggered by commit r298620: "[LV] Vectorize GEPs".

If we encounter a vector GEP with scalar arguments, we splat the scalar
into a vector of appropriate size before we scatter the argument.

Reviewers: arsenm, mehdi_amini, bkramer

Reviewed By: arsenm

Subscribers: bjope, mssimpso, wdng, llvm-commits

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

llvm-svn: 299186

7 years agoGo binding: Add GetCurrentDebugLocation to obtain debug location from builder
Andrew Wilkins [Fri, 31 Mar 2017 04:59:57 +0000 (04:59 +0000)]
Go binding: Add GetCurrentDebugLocation to obtain debug location from builder

Summary:

Currently Go binding only has SetCurrentDebugLocation method.
I added GetCurrentDebugLocation method to IRBuilder instance.

I added this because I want to save current debug location, change debug location temporary and restore the saved one finally.
This is useful when source location jumps and goes back after while LLVM IR generation.

I also added tests for this to ir_test.go.
I confirmed that all test passed with this patch based on r298890

Patch by Ryuichi Hayashida!

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

llvm-svn: 299185

7 years agoRe-apply r299168 and r299169 now that the libdeps are fixed.
Peter Collingbourne [Fri, 31 Mar 2017 04:47:07 +0000 (04:47 +0000)]
Re-apply r299168 and r299169 now that the libdeps are fixed.

llvm-svn: 299184

7 years agoMove llvm::emitLinkerFlagsForGlobalCOFF() to Mangler.
Peter Collingbourne [Fri, 31 Mar 2017 04:46:50 +0000 (04:46 +0000)]
Move llvm::emitLinkerFlagsForGlobalCOFF() to Mangler.

llvm-svn: 299183

7 years agoMove llvm::canBeOmittedFromSymbolTable() to Analysis.
Peter Collingbourne [Fri, 31 Mar 2017 04:46:31 +0000 (04:46 +0000)]
Move llvm::canBeOmittedFromSymbolTable() to Analysis.

llvm-svn: 299182

7 years agoRevert test added in r299152
Teresa Johnson [Fri, 31 Mar 2017 04:29:07 +0000 (04:29 +0000)]
Revert test added in r299152

Removing the test until I can figure out how to get the ThinLTO backend
invocation of clang to use the correct target.

llvm-svn: 299181

7 years ago[libFuzzer] simplify the code a bit
Kostya Serebryany [Fri, 31 Mar 2017 04:17:45 +0000 (04:17 +0000)]
[libFuzzer] simplify the code a bit

llvm-svn: 299180

7 years ago[libFuzzer] tests: don't test 64-bit comparison on 32-bit builds
Kostya Serebryany [Fri, 31 Mar 2017 03:51:40 +0000 (03:51 +0000)]
[libFuzzer] tests: don't test 64-bit comparison on 32-bit builds

llvm-svn: 299179

7 years agoAdd target-cpu
Teresa Johnson [Fri, 31 Mar 2017 03:49:52 +0000 (03:49 +0000)]
Add target-cpu

Sigh, another follow-on fix needed for test in r299152 causing bot
failures. We also need the target-cpu for the ThinLTO BE clang
invocation.

llvm-svn: 299178

7 years ago[libFuzzer] ensure that strncmp is not inlined in a test
Kostya Serebryany [Fri, 31 Mar 2017 03:34:33 +0000 (03:34 +0000)]
[libFuzzer] ensure that strncmp is not inlined in a test

llvm-svn: 299177

7 years agoAdd more target triples to test
Teresa Johnson [Fri, 31 Mar 2017 03:27:47 +0000 (03:27 +0000)]
Add more target triples to test

Third and hopefully final fix to test for r299152 that is causing bot
failures: make sure the target triple specified for the ThinLTO backend
clang invocations as well.

llvm-svn: 299176

7 years ago[asan] Turn -fsanitize-address-use-after-scope on by default [compiler-rt part]
Kuba Mracek [Fri, 31 Mar 2017 03:00:29 +0000 (03:00 +0000)]
[asan] Turn -fsanitize-address-use-after-scope on by default [compiler-rt part]

AddressSanitizer has an optional compile-time flag, -fsanitize-address-use-after-scope, which enables detection of use-after-scope bugs. We'd like to have this feature on by default, because it is already very well tested, it's used in several projects already (LLVM automatically enables it when using -DLLVM_USE_SANITIZER=Address), it's low overhead and there are no known issues or incompatibilities.

This patch enables use-after-scope by default via the Clang driver, where we set true as the default value for AsanUseAfterScope. This also causes the lifetime markers to be generated whenever fsanitize=address is used. This has some nice consequences, e.g. we now have line numbers for all local variables.

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

llvm-svn: 299175

7 years ago[asan] Turn -fsanitize-address-use-after-scope on by default [clang part]
Kuba Mracek [Fri, 31 Mar 2017 03:00:09 +0000 (03:00 +0000)]
[asan] Turn -fsanitize-address-use-after-scope on by default [clang part]

AddressSanitizer has an optional compile-time flag, -fsanitize-address-use-after-scope, which enables detection of use-after-scope bugs. We'd like to have this feature on by default, because it is already very well tested, it's used in several projects already (LLVM automatically enables it when using -DLLVM_USE_SANITIZER=Address), it's low overhead and there are no known issues or incompatibilities.

This patch enables use-after-scope by default via the Clang driver, where we set true as the default value for AsanUseAfterScope. This also causes the lifetime markers to be generated whenever fsanitize=address is used. This has some nice consequences, e.g. we now have line numbers for all local variables.

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

llvm-svn: 299174

7 years agoFix new compile command in test
Teresa Johnson [Fri, 31 Mar 2017 02:55:31 +0000 (02:55 +0000)]
Fix new compile command in test

My previous attempt to fix bot failures from r299152 didn't add the
necessary option to get bitcode out of the cc1 step.

llvm-svn: 299173

7 years ago[XRay][docs] Add XRayExample to docindex.
Dean Michael Berris [Fri, 31 Mar 2017 02:51:19 +0000 (02:51 +0000)]
[XRay][docs] Add XRayExample to docindex.

llvm-svn: 299172

7 years agoRevert r299168 and r299169 due to library dependency issues.
Peter Collingbourne [Fri, 31 Mar 2017 02:44:50 +0000 (02:44 +0000)]
Revert r299168 and r299169 due to library dependency issues.

http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux/builds/25073/steps/build_llvmclang/logs/stdio

llvm-svn: 299171

7 years agoAdd triple to new test
Teresa Johnson [Fri, 31 Mar 2017 02:36:47 +0000 (02:36 +0000)]
Add triple to new test

Attempt to fix bot errors from r299152 by using clang_cc1 and specifying
target triple to compile step.

llvm-svn: 299170

7 years agoFix 32-bit build.
Peter Collingbourne [Fri, 31 Mar 2017 02:32:53 +0000 (02:32 +0000)]
Fix 32-bit build.

llvm-svn: 299169

7 years agoLTO: Reduce memory consumption by creating an in-memory symbol table for InputFiles...
Peter Collingbourne [Fri, 31 Mar 2017 02:28:30 +0000 (02:28 +0000)]
LTO: Reduce memory consumption by creating an in-memory symbol table for InputFiles. NFCI.

Introduce symbol table data structures that can be potentially written to
disk, have the LTO library build those data structures using temporarily
constructed modules and redirect the LTO library implementation to go through
those data structures. This allows us to remove the LLVMContext and Modules
owned by InputFile.

With this change I measured a peak memory consumption decrease from 5.4GB to
2.8GB in a no-op incremental ThinLTO link of Chromium on Linux. The impact on
memory consumption is larger in COFF linkers where we are currently forced
to materialize all metadata in order to read linker options. Peak memory
consumption linking a large piece of Chromium for Windows with full LTO and
debug info decreases from >64GB (OOM) to 15GB.

Part of PR27551.

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

llvm-svn: 299168

7 years ago[libFuzzer] make sure we don't execute libFuzzer's mem* and str* hooks while calling...
Kostya Serebryany [Fri, 31 Mar 2017 02:21:28 +0000 (02:21 +0000)]
[libFuzzer] make sure we don't execute libFuzzer's mem* and str* hooks while calling mem*/str* inside libFuzzer itself

llvm-svn: 299167

7 years agoTemporarily revert "[PPC] In PPCBoolRetToInt change the bool value to i64 if the...
Eric Christopher [Fri, 31 Mar 2017 02:16:54 +0000 (02:16 +0000)]
Temporarily revert "[PPC] In PPCBoolRetToInt change the bool value to i64 if the target is ppc64" as it's causing test failures, I've given Carrot a testcase offline.

This reverts commit r298955.

llvm-svn: 299153

7 years ago[ThinLTO] Set up lto::Config properly for codegen in ThinLTO backends
Teresa Johnson [Fri, 31 Mar 2017 02:05:15 +0000 (02:05 +0000)]
[ThinLTO] Set up lto::Config properly for codegen in ThinLTO backends

Summary:
This involved refactoring out pieces of
EmitAssemblyHelper::CreateTargetMachine for use in runThinLTOBackend.

Subsumes D31114.

Reviewers: mehdi_amini, pcc

Subscribers: Prazek, cfe-commits

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

llvm-svn: 299152

7 years agoUpdate x86-64 ABI link with the one from linuxbase.org since the other
Eric Christopher [Fri, 31 Mar 2017 01:59:40 +0000 (01:59 +0000)]
Update x86-64 ABI link with the one from linuxbase.org since the other
seems to be down.

llvm-svn: 299151

7 years ago[XRay][tools] Remove some assertions in llvm-xray graph
Dean Michael Berris [Fri, 31 Mar 2017 01:56:45 +0000 (01:56 +0000)]
[XRay][tools] Remove some assertions in llvm-xray graph

Summary:
Assertions assuming that function calls may not have zero durations do
not seem to hold in the wild. There are valid cases where the conversion
of the tsc counters end up becoming zero-length durations. These
assertions don't really hold and the algorithms don't need those to be
true for them to work.

Reviewers: dblaikie, echristo

Subscribers: llvm-commits

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

llvm-svn: 299150

7 years agoFix typo, defind -> defined.
Eric Christopher [Fri, 31 Mar 2017 01:46:30 +0000 (01:46 +0000)]
Fix typo, defind -> defined.

llvm-svn: 299149

7 years agoFix typo, defind -> defined.
Eric Christopher [Fri, 31 Mar 2017 01:45:39 +0000 (01:45 +0000)]
Fix typo, defind -> defined.

llvm-svn: 299148

7 years agoDon't add a newline if the object description already has one.
Jim Ingham [Fri, 31 Mar 2017 01:32:57 +0000 (01:32 +0000)]
Don't add a newline if the object description already has one.

<rdar://problem/25755431>

llvm-svn: 299147

7 years ago[clang-tidy] Revert D31406 (Reuse FileID in getLocation)
Chih-Hung Hsieh [Fri, 31 Mar 2017 01:11:11 +0000 (01:11 +0000)]
[clang-tidy] Revert D31406 (Reuse FileID in getLocation)

Somehow the change failed test clang-tidy/llvm-include-order.cpp
on Windows platform.

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

llvm-svn: 299146

7 years ago[libFuzzer] try to fix value-profile-strncmp on the Mac bot
Kostya Serebryany [Fri, 31 Mar 2017 00:52:39 +0000 (00:52 +0000)]
[libFuzzer] try to fix value-profile-strncmp on the Mac bot

llvm-svn: 299145

7 years agoTry to fix the libcxx build with mingw64
Reid Kleckner [Fri, 31 Mar 2017 00:34:05 +0000 (00:34 +0000)]
Try to fix the libcxx build with mingw64

Summary:
mingw64 has lots of default libs that libc++ and its test programs
should link against.

With this patch, cmake now runs successfully with GCC on Windows.

Reviewers: mati865, EricWF

Subscribers: mgorny, cfe-commits

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

llvm-svn: 299144

7 years ago[libc++abi] Remove missed use of config.h
Shoaib Meenai [Fri, 31 Mar 2017 00:29:25 +0000 (00:29 +0000)]
[libc++abi] Remove missed use of config.h

llvm-svn: 299143

7 years agoModuleSummaryAnalysis: Use a more precise #include. NFC.
Peter Collingbourne [Fri, 31 Mar 2017 00:08:24 +0000 (00:08 +0000)]
ModuleSummaryAnalysis: Use a more precise #include. NFC.

llvm-svn: 299142

7 years ago[WebAssembly] Initial linking metadata support
Dan Gohman [Thu, 30 Mar 2017 23:58:19 +0000 (23:58 +0000)]
[WebAssembly] Initial linking metadata support

Add support for the new relocations and linking metadata section support in
https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md. In
particular, this allows LLVM to indicate which variable is the stack pointer,
so that it can be linked with other objects.

This also adds support for emitting type relocations for call_indirect
instructions.

Right now, this is mainly tested by using wabt and hexdump to examine the
output on selected testcases. We'll add more tests as the design stablizes
and more of the pieces are in place.

llvm-svn: 299141

7 years agoAMDGPU: Rename isKernel
Matt Arsenault [Thu, 30 Mar 2017 23:58:04 +0000 (23:58 +0000)]
AMDGPU: Rename isKernel

What we really want to do is distinguish functions that may
be called by other functions, and graphics shaders are not
called kernels.

llvm-svn: 299140

7 years ago[XRay][docs] Examples for how to use XRay
Dean Michael Berris [Thu, 30 Mar 2017 23:46:36 +0000 (23:46 +0000)]
[XRay][docs] Examples for how to use XRay

Summary:
This document is an attempt at showing how XRay could be used to debug
latency issues with LLVM tools, and how to use the llvm-xray tool to
analyse XRay traces.

Reviewers: echristo, mehdi_amini, davide

Subscribers: llvm-commits

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

llvm-svn: 299133

7 years agoThinLTOBitcodeWriter: Use Module::global_values(). NFCI.
Peter Collingbourne [Thu, 30 Mar 2017 23:43:08 +0000 (23:43 +0000)]
ThinLTOBitcodeWriter: Use Module::global_values(). NFCI.

llvm-svn: 299132

7 years agoLangRef: Don't refer to a 'generic' address space.
Matt Arsenault [Thu, 30 Mar 2017 23:36:47 +0000 (23:36 +0000)]
LangRef: Don't refer to a 'generic' address space.

Consistently call this the default address space.

llvm-svn: 299131

7 years agoFixup for r299085: Keep the scribble.cc test on Darwin only, while I investigate...
Kuba Mracek [Thu, 30 Mar 2017 23:34:44 +0000 (23:34 +0000)]
Fixup for r299085: Keep the scribble.cc test on Darwin only, while I investigate why this test sometimes fails on Linux.

llvm-svn: 299130

7 years ago[libc++abi] Delete config.h
Shoaib Meenai [Thu, 30 Mar 2017 23:31:33 +0000 (23:31 +0000)]
[libc++abi] Delete config.h

Summary: It's now completely empty, so we can remove it entirely.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 299129

7 years agoUpdate comments.
Rui Ueyama [Thu, 30 Mar 2017 22:57:49 +0000 (22:57 +0000)]
Update comments.

llvm-svn: 299128

7 years agofixup: use CHECK for non-atttribute sets
Dean Michael Berris [Thu, 30 Mar 2017 22:46:49 +0000 (22:46 +0000)]
fixup: use CHECK for non-atttribute sets

llvm-svn: 299127

7 years ago[XRay][clang] Fix the -fxray-instruction-threshold flag processing
Dean Michael Berris [Thu, 30 Mar 2017 22:46:45 +0000 (22:46 +0000)]
[XRay][clang] Fix the -fxray-instruction-threshold flag processing

Summary:
The refactoring introduced a regression in the flag processing for
-fxray-instruction-threshold which causes it to not get passed properly.
This change should restore the previous behaviour.

Reviewers: rnk, pelikan

Subscribers: cfe-commits

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

llvm-svn: 299126

7 years agoAdd testcase for r299124.
Eric Christopher [Thu, 30 Mar 2017 22:35:10 +0000 (22:35 +0000)]
Add testcase for r299124.

Patch by Tim Shen!

llvm-svn: 299125

7 years agogetPristineRegs is not accurately considering shrink wrapping puts
Eric Christopher [Thu, 30 Mar 2017 22:34:20 +0000 (22:34 +0000)]
getPristineRegs is not accurately considering shrink wrapping puts
registers not saved in certain blocks. Use explicit getCalleeSavedInfo
and isLiveIn instead.

This fixes pr32292.

Patch by Tim Shen!

llvm-svn: 299124

7 years ago[InstCombine] Fix typo last->least. NFC
Craig Topper [Thu, 30 Mar 2017 22:28:55 +0000 (22:28 +0000)]
[InstCombine] Fix typo last->least. NFC

llvm-svn: 299123

7 years agoAMDGPU: Add all atomicrmw fields to atomic.inc/dec
Matt Arsenault [Thu, 30 Mar 2017 22:21:40 +0000 (22:21 +0000)]
AMDGPU: Add all atomicrmw fields to atomic.inc/dec

Add scope, order, isVolatile

llvm-svn: 299122

7 years ago[InstSimplify] Use m_SignBit instead of calling getSignBit and using m_Specific....
Craig Topper [Thu, 30 Mar 2017 22:21:16 +0000 (22:21 +0000)]
[InstSimplify] Use m_SignBit instead of calling getSignBit and using m_Specific. NFCI

llvm-svn: 299121

7 years ago[InstSimplify] Use APInt::isMaxSignedValue() instead of comparing with ~APInt::getSig...
Craig Topper [Thu, 30 Mar 2017 22:10:54 +0000 (22:10 +0000)]
[InstSimplify] Use APInt::isMaxSignedValue() instead of comparing with ~APInt::getSignBit. NFC

llvm-svn: 299120

7 years ago[clang-tidy] Reuse FileID in getLocation
Chih-Hung Hsieh [Thu, 30 Mar 2017 22:09:17 +0000 (22:09 +0000)]
[clang-tidy] Reuse FileID in getLocation

One FileID per warning will increase and overflow NextLocalOffset
when input file is large with many warnings.
Reusing FileID avoids this problem.

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

llvm-svn: 299119

7 years ago[SimplifyIndvar] Replace the sdiv used by IV if we can prove both of its operands...
Hongbin Zheng [Thu, 30 Mar 2017 21:56:56 +0000 (21:56 +0000)]
[SimplifyIndvar] Replace the sdiv used by IV if we can prove both of its operands are non-negative

Since there is no sdiv in SCEV, an 'udiv' is a better canonical form than an 'sdiv' as the user of induction variable

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

llvm-svn: 299118

7 years agoClang changes for alloc_align attribute
Erich Keane [Thu, 30 Mar 2017 21:48:55 +0000 (21:48 +0000)]
Clang changes for alloc_align attribute

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.

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

llvm-svn: 299117

7 years agoadd NetBSD files to Xcode project to resolve failure from r299109
Tim Hammerquist [Thu, 30 Mar 2017 21:27:51 +0000 (21:27 +0000)]
add NetBSD files to Xcode project to resolve failure from r299109

llvm-svn: 299116

7 years agoInclude filenames in error messages to report broken files.
Rui Ueyama [Thu, 30 Mar 2017 21:13:00 +0000 (21:13 +0000)]
Include filenames in error messages to report broken files.

llvm-svn: 299115

7 years ago[AVX-512] Fix bad comment from r299112. NFC
Craig Topper [Thu, 30 Mar 2017 21:05:33 +0000 (21:05 +0000)]
[AVX-512] Fix bad comment from r299112. NFC

llvm-svn: 299114

7 years agoUse os.path.realpath when tracking the cwd.
Rafael Espindola [Thu, 30 Mar 2017 21:05:31 +0000 (21:05 +0000)]
Use os.path.realpath when tracking the cwd.

This is needed by TestCases/Posix/coverage-direct.cc

The problem is that the test does:

mkdir <dir>
cd <dir>
cd ..
rm -rf <dir>
<more commands>

the current directory currently looks like "/.../<dir>/../" which
doesn't exist when dir is deleted.

at some point we should probably switch to using the os current
directory (specially if we want to add subshell), but this is a small
incremental improvement.

llvm-svn: 299113

7 years ago[AVX-512] Fix another case where fastisel was generating a GR8 to VK1 copy. This...
Craig Topper [Thu, 30 Mar 2017 21:02:52 +0000 (21:02 +0000)]
[AVX-512] Fix another case where fastisel was generating a GR8 to VK1 copy. This time after calls returning i1.

Fixes PR32472.

llvm-svn: 299112

7 years agolit: support redirect from globs
Rafael Espindola [Thu, 30 Mar 2017 20:48:58 +0000 (20:48 +0000)]
lit: support redirect from globs

This adds support for commands like

FileCheck < foobar*

which is used by some asan tests because the file they want to read
has a pid in the name.

llvm-svn: 299111

7 years agoDo not enclose an entire file with namespaces.
Rui Ueyama [Thu, 30 Mar 2017 20:31:19 +0000 (20:31 +0000)]
Do not enclose an entire file with namespaces.

This change is to improve consistency with other files.

llvm-svn: 299110

7 years agoBattery of NetBSD support improvements
Kamil Rytarowski [Thu, 30 Mar 2017 20:25:29 +0000 (20:25 +0000)]
Battery of NetBSD support improvements

Summary:
Include initial support for:
 - single step mode (PT_STEP)
 - single step trap handling (TRAP_TRACE)
 - exec() trap (TRAP_EXEC)
 - add placeholder interfaces for FPR
 - initial code for NetBSD core(5) files
 - minor tweaks

While there improve style of altered elf-core/ files.

This code raises the number of passing tests on NetBSD to around 50% (600+/1200+).

The introduced code is subject to improve afterwards for additional features and bug fixes.

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg, emaste, kettenis

Reviewed By: labath

Subscribers: srhines, #lldb

Tags: #lldb

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

llvm-svn: 299109

7 years ago[AMDGPU] Add GlobalOpt parameter to Always Inliner pass
Stanislav Mekhanoshin [Thu, 30 Mar 2017 20:16:02 +0000 (20:16 +0000)]
[AMDGPU] Add GlobalOpt parameter to Always Inliner pass

If set to false it does not remove global aliases. With this parameter
set to false it should be safe to run the pass before link.

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

llvm-svn: 299108

7 years agoTeach stripNonLineTableDebugInfo() to remap DILocations in !llvm.loop nodes.
Adrian Prantl [Thu, 30 Mar 2017 20:10:56 +0000 (20:10 +0000)]
Teach stripNonLineTableDebugInfo() to remap DILocations in !llvm.loop nodes.

llvm-svn: 299107

7 years agoAdd parsing of mllvm command line options.
Rui Ueyama [Thu, 30 Mar 2017 20:10:40 +0000 (20:10 +0000)]
Add parsing of mllvm command line options.

Patch by Alberto Magni
Original patch by Kyungwoo Lee <kyulee@microsoft.com>

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

llvm-svn: 299106

7 years agoFix LWG 2934 - optional<const T> doesn't compare with T
Eric Fiselier [Thu, 30 Mar 2017 20:06:52 +0000 (20:06 +0000)]
Fix LWG 2934 - optional<const T> doesn't compare with T

llvm-svn: 299105

7 years ago[Object] Remove check for BIND_OPCODE_DONE/REBASE_OPCODE_DONE.
Juergen Ributzka [Thu, 30 Mar 2017 19:56:50 +0000 (19:56 +0000)]
[Object] Remove check for BIND_OPCODE_DONE/REBASE_OPCODE_DONE.

BIND_OPCODE_DONE/REBASE_OPCODE_DONE may appear at the end of the opcode array,
but they are not required to. The linker only adds them as padding to align the
opcodes to pointer size.

This fixes rdar://problem/31285560.

llvm-svn: 299104

7 years ago[AArch64ISelLowering] Remove `else` after `return` in LowerGlobalTLSAddress.
Davide Italiano [Thu, 30 Mar 2017 19:52:31 +0000 (19:52 +0000)]
[AArch64ISelLowering] Remove `else` after `return` in LowerGlobalTLSAddress.

llvm-svn: 299103

7 years ago[AArch64] Simplify isSingExtended()/isZeroExtended(). NFCI.
Davide Italiano [Thu, 30 Mar 2017 19:46:18 +0000 (19:46 +0000)]
[AArch64] Simplify isSingExtended()/isZeroExtended(). NFCI.

llvm-svn: 299102

7 years ago[WebAssembly] Improve support for WebAssembly binary format
Derek Schuff [Thu, 30 Mar 2017 19:44:09 +0000 (19:44 +0000)]
[WebAssembly] Improve support for WebAssembly binary format

Mostly this change adds support converting to and from
YAML which will allow us to write more test cases for
the WebAssembly MC and lld ports.

Better support for objdump, readelf, and nm will be in
followup CLs.

I had to update the two wasm test binaries because they
used the old style 'name' section which is no longer
supported.

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

Patch by Sam Clegg

llvm-svn: 299101

7 years agoImplement LWG 2842 - optional(U&&) needs to SFINAE on decay_t<in_place_t>
Eric Fiselier [Thu, 30 Mar 2017 19:43:50 +0000 (19:43 +0000)]
Implement LWG 2842 - optional(U&&) needs to SFINAE on decay_t<in_place_t>

llvm-svn: 299100

7 years agoFixup for r299085: Disable the scribble.cc test on AArch64.
Kuba Mracek [Thu, 30 Mar 2017 19:36:49 +0000 (19:36 +0000)]
Fixup for r299085: Disable the scribble.cc test on AArch64.

llvm-svn: 299099

7 years agoFollowing r297661, disable dup workaround to disable duplicate STDOUT fd closing...
Yaron Keren [Thu, 30 Mar 2017 19:30:51 +0000 (19:30 +0000)]
Following r297661, disable dup workaround to disable duplicate STDOUT fd closing and instead directly prevent closing of STD* file descriptors.

We do not want to close STDOUT as there may have been several uses of it
such as the case: llc %s -o=- -pass-remarks-output=- -filetype=asm
which cause multiple closes of STDOUT_FILENO and/or use-after-close of it.
Using dup() in getFD doesn't work as we end up with original STDOUT_FILENO
open anyhow.

reviewed by Rafael Espindola

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

llvm-svn: 299098

7 years agoChange the error message format for undefined symbols.
Rui Ueyama [Thu, 30 Mar 2017 19:13:47 +0000 (19:13 +0000)]
Change the error message format for undefined symbols.

Previously, undefined symbol errors are one line like this
and wasn't easy to read.

  /ssd/clang/bin/ld.lld: error: /ssd/llvm-project/lld/ELF/Writer.cpp:207: undefined symbol 'lld::elf::EhFrameSection<llvm::object::ELFType<(llvm::support::endianness)0, true> >::addSection(lld::elf::InputSectionBase*)'

This patch make it more structured like this.

  bin/ld.lld: error: undefined symbol: lld::elf::EhFrameSection<llvm::object::ELFType<(llvm::support::endianness)0, true>
  >>> Referenced by Writer.cpp:207 (/ssd/llvm-project/lld/ELF/Writer.cpp:207)
  >>>               Writer.cpp.o in archive lib/liblldELF.a

Discussion thread:
http://lists.llvm.org/pipermail/llvm-dev/2017-March/111459.html

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

llvm-svn: 299097

7 years ago[DAGCombiner] Initial support for the fast-math flag contract
Adam Nemet [Thu, 30 Mar 2017 18:53:04 +0000 (18:53 +0000)]
[DAGCombiner] Initial support for the fast-math flag contract

Now alternatively to the TargetOption.AllowFPOpFusion global flag, FMUL->FADD
can also use the per operation FMF to allow fusion.

The idea here is not to port everything to the new scheme (e.g. fused
multiply-and-sub will be ported later) but that this work all the way from
clang.

The transformation is conditionalized on *both* the FADD and the FMUL having
the FMF contract flag.

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

llvm-svn: 299096

7 years agoRevert r298776 - Expression: add missing linkage to RuntimeDyld ...
Michal Gorny [Thu, 30 Mar 2017 18:24:07 +0000 (18:24 +0000)]
Revert r298776 - Expression: add missing linkage to RuntimeDyld ...

This needs to be addressed within LLVM itself.

llvm-svn: 299095

7 years agoCorrecting a typo; NFC.
Aaron Ballman [Thu, 30 Mar 2017 18:11:20 +0000 (18:11 +0000)]
Correcting a typo; NFC.

llvm-svn: 299094