platform/upstream/llvm.git
7 years ago[NVPTX] Auto-upgrade some NVPTX intrinsics to LLVM target-generic code.
Justin Lebar [Sat, 21 Jan 2017 01:00:32 +0000 (01:00 +0000)]
[NVPTX] Auto-upgrade some NVPTX intrinsics to LLVM target-generic code.

Summary:
Specifically, we upgrade llvm.nvvm.:

 * brev{32,64}
 * clz.{i,ll}
 * popc.{i,ll}
 * abs.{i,ll}
 * {min,max}.{i,ll,u,ull}
 * h2f

These either map directly to an existing LLVM target-generic
intrinsic or map to a simple LLVM target-generic idiom.

In all cases, we check that the code we generate is lowered to PTX as we
expect.

These builtins don't need to be backfilled in clang: They're not
accessible to user code from nvcc.

Reviewers: tra

Subscribers: majnemer, cfe-commits, llvm-commits, jholewinski

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

llvm-svn: 292694

7 years ago[NVPTX] Move getDivF32Level, usePrecSqrtF32, and useF32FTZ into out of DAGToDAG and...
Justin Lebar [Sat, 21 Jan 2017 01:00:14 +0000 (01:00 +0000)]
[NVPTX] Move getDivF32Level, usePrecSqrtF32, and useF32FTZ into out of DAGToDAG and into TargetLowering.

Summary:
DADToDAG has access to TargetLowering, but not vice versa, so this is
the more general location for these functions.

NFC

Reviewers: tra

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 292693

7 years ago[ConstantFolding] Constant-fold llvm.sqrt(x) like other intrinsics.
Justin Lebar [Sat, 21 Jan 2017 00:59:57 +0000 (00:59 +0000)]
[ConstantFolding] Constant-fold llvm.sqrt(x) like other intrinsics.

Summary:
Currently we return undef, but we're in the process of changing the
LangRef so that llvm.sqrt behaves like the other math intrinsics,
matching the return value of the standard libcall but not setting errno.

This change is legal even without the LangRef change because currently
calling llvm.sqrt(x) where x is negative is spec'ed to be UB.  But in
practice it's also safe because we're simply constant-folding fewer
inputs: Inputs >= -0 get constant-folded as before, but inputs < -0 now
aren't constant-folded, because ConstantFoldFP aborts if the host math
function raises an fp exception.

Reviewers: hfinkel, efriedma, sanjoy

Subscribers: llvm-commits

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

llvm-svn: 292692

7 years ago[ValueTracking] Clarify comments on CannotBeOrderedLessThanZero and SignBitMustBeZero.
Justin Lebar [Sat, 21 Jan 2017 00:59:40 +0000 (00:59 +0000)]
[ValueTracking] Clarify comments on CannotBeOrderedLessThanZero and SignBitMustBeZero.

Reviewers: hfinkel, efriedma, sanjoy

Subscribers: llvm-commits

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

llvm-svn: 292691

7 years ago[NVPTX] Add explicit check for llvm.sqrt.f32 to intrinsics.ll.
Justin Lebar [Sat, 21 Jan 2017 00:59:23 +0000 (00:59 +0000)]
[NVPTX] Add explicit check for llvm.sqrt.f32 to intrinsics.ll.

Test-only change.

llvm-svn: 292690

7 years agoFix recent build errors
Eric Fiselier [Sat, 21 Jan 2017 00:57:29 +0000 (00:57 +0000)]
Fix recent build errors

llvm-svn: 292689

7 years ago[AMDGPU] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Sat, 21 Jan 2017 00:53:49 +0000 (00:53 +0000)]
[AMDGPU] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 292688

7 years ago[APFloat] Add asserts and descriptions. NFC.
Tim Shen [Sat, 21 Jan 2017 00:37:53 +0000 (00:37 +0000)]
[APFloat] Add asserts and descriptions. NFC.

llvm-svn: 292687

7 years ago[libFuzzer] use print+exit(1) instead of assert to report an error
Kostya Serebryany [Sat, 21 Jan 2017 00:13:50 +0000 (00:13 +0000)]
[libFuzzer] use print+exit(1) instead of assert to report an error

llvm-svn: 292685

7 years agoImplement P0513R0 - "Poisoning the Hash"
Eric Fiselier [Sat, 21 Jan 2017 00:02:12 +0000 (00:02 +0000)]
Implement P0513R0 - "Poisoning the Hash"

Summary:
Exactly what the title says.

This patch also adds a `std::hash<nullptr_t>` specialization in C++17, but it was not added by this paper and I can't find the actual paper that adds it.

See http://wg21.link/P0513R0 for more info.

If there are no comments in the next couple of days I'll commit this

Reviewers: mclow.lists, K-ballo, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 292684

7 years ago[libFuzzer] re-enable LLVMFuzzer-RepeatedMemcmp test, cleanup the test runner nearby
Kostya Serebryany [Sat, 21 Jan 2017 00:01:27 +0000 (00:01 +0000)]
[libFuzzer] re-enable LLVMFuzzer-RepeatedMemcmp test, cleanup the test runner nearby

llvm-svn: 292683

7 years ago[InstCombine] auto-generate checks; NFC
Sanjay Patel [Fri, 20 Jan 2017 23:39:01 +0000 (23:39 +0000)]
[InstCombine] auto-generate checks; NFC

llvm-svn: 292682

7 years ago[libFuzzer] call __sanitizer_dump_coverage via EF
Kostya Serebryany [Fri, 20 Jan 2017 23:35:29 +0000 (23:35 +0000)]
[libFuzzer] call __sanitizer_dump_coverage via  EF

llvm-svn: 292681

7 years ago[PPC] Give unaligned memory access lower cost on processor that supports it
Guozhi Wei [Fri, 20 Jan 2017 23:35:27 +0000 (23:35 +0000)]
[PPC] Give unaligned memory access lower cost on processor that supports it

Newer ppc supports unaligned memory access, it reduces the cost of unaligned memory access significantly. This patch handles this case in PPCTTIImpl::getMemoryOpCost.

This patch fixes pr31492.

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

llvm-svn: 292680

7 years ago[ThinLTO] Don't perform computeDeadSymbols during O0 link, as the result is never...
Mehdi Amini [Fri, 20 Jan 2017 23:34:12 +0000 (23:34 +0000)]
[ThinLTO] Don't perform computeDeadSymbols during O0 link, as the result is never used (NFC)

llvm-svn: 292679

7 years ago[NewGVN] Optimize processing for instructions found trivially dead.
Davide Italiano [Fri, 20 Jan 2017 23:29:28 +0000 (23:29 +0000)]
[NewGVN] Optimize processing for instructions found trivially dead.

Don't call `isTriviallyDeadInstructions()` once we discover that
an instruction is dead. Instead, set DFS number zero (as suggested
by Danny) and forget about it (this also speeds up things as we
won't try to reprocess that block).

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

llvm-svn: 292676

7 years agoGlobalISel: prevent heap use-after-free when looking up VReg.
Tim Northover [Fri, 20 Jan 2017 23:25:17 +0000 (23:25 +0000)]
GlobalISel: prevent heap use-after-free when looking up VReg.

Translating the constant can create more VRegs, which can invalidate the
reference into the DenseMap. So we have to look up the value again after all
that's happened.

llvm-svn: 292675

7 years agoLowerTypeTests: Simplify; always create SizeM1 with type IntPtrTy, move initializatio...
Peter Collingbourne [Fri, 20 Jan 2017 23:22:28 +0000 (23:22 +0000)]
LowerTypeTests: Simplify; always create SizeM1 with type IntPtrTy, move initialization out of if statement.

llvm-svn: 292674

7 years agoFix failing lld pdb test.
Zachary Turner [Fri, 20 Jan 2017 22:57:24 +0000 (22:57 +0000)]
Fix failing lld pdb test.

llvm-svn: 292673

7 years agoAdd indirect call promotion to SamplePGO
Dehao Chen [Fri, 20 Jan 2017 22:56:07 +0000 (22:56 +0000)]
Add indirect call promotion to SamplePGO

Summary: This patch adds metadata for indirect call promotion in the sample profile loader.

Reviewers: xur, davidxl, dnovillo

Reviewed By: davidxl

Subscribers: llvm-commits

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

llvm-svn: 292672

7 years ago[Basic] Remove the 32-bit x86 and ARM targets for Fuchsia
Petr Hosek [Fri, 20 Jan 2017 22:53:38 +0000 (22:53 +0000)]
[Basic] Remove the 32-bit x86 and ARM targets for Fuchsia

The 32-bit architectures are no longer supported by Fuchsia.

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

llvm-svn: 292671

7 years ago[libFuzzer] Don't use `#ifdef` for defined macros, instead use `#if`.
Marcos Pividori [Fri, 20 Jan 2017 22:49:13 +0000 (22:49 +0000)]
[libFuzzer] Don't use `#ifdef` for defined macros, instead use `#if`.

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

llvm-svn: 292670

7 years ago[libFuzzer] Use clang as linker on Windows, to properly include sanitizer libraries.
Marcos Pividori [Fri, 20 Jan 2017 22:49:08 +0000 (22:49 +0000)]
[libFuzzer] Use clang as linker on Windows, to properly include sanitizer libraries.

In order to use sanitizers on Windows, we need to link against many runtime
libraries which will depend on the target being created (executable or dll) and
the c runtime library used (MT/MD).
By default, cmake uses link.exe for linking, which fails because we don't
specify the appropiate dependencies. As we don't want to consider all of that
possible situations which depends on the implementation of the compiler-rt, the
simplest option is to change the rules for linking executables and shared
libraries, using the compiler instead of link.exe.
Clang driver will consider the sanitizer flags, and automatically provide the
required libraries to the linker.

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

llvm-svn: 292669

7 years ago[libFuzzer] Properly use compiler options supported on Windows.
Marcos Pividori [Fri, 20 Jan 2017 22:48:47 +0000 (22:48 +0000)]
[libFuzzer] Properly use compiler options supported on Windows.

Replace "-g" by "-gline-tables-only". "-g" is not supported by clang-cl.

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

llvm-svn: 292668

7 years ago[ThinLTO] The "codegen only" path didn't honor the recently added file-based API
Mehdi Amini [Fri, 20 Jan 2017 22:45:34 +0000 (22:45 +0000)]
[ThinLTO] The "codegen only" path didn't honor the recently added file-based API

llvm-svn: 292667

7 years agoImprove PGO support for the new inliner
Easwaran Raman [Fri, 20 Jan 2017 22:44:04 +0000 (22:44 +0000)]
Improve PGO support for the new inliner

This adds the following to the new PM based inliner in PGO mode:

* Use block frequency analysis to derive callsite's profile count and use
that to adjust thresholds of hot and cold callsites.

* Incrementally update the BFI of the caller after a callee gets inlined
into it. This incremental update is only within an invocation of the run
method - BFI is not preserved across calls to run.
Update the function entry count of the callee after inlining it into a
caller.

* I've tuned the thresholds for the hot and cold callsites using a hacked
up version of the old inliner that explicitly computes BFI on a set of
internal benchmarks and spec. Once the new PM based pipeline stabilizes
(IIRC Chandler mentioned there are known issues) I'll benchmark this
again and adjust the thresholds if required.
Inliner PGO support.

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

llvm-svn: 292666

7 years ago[pdb] Write the Named Stream mapping to Yaml and binary.
Zachary Turner [Fri, 20 Jan 2017 22:42:09 +0000 (22:42 +0000)]
[pdb] Write the Named Stream mapping to Yaml and binary.

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

llvm-svn: 292665

7 years ago[pdb] Merge NamedStreamMapBuilder and NamedStreamMap.
Zachary Turner [Fri, 20 Jan 2017 22:41:40 +0000 (22:41 +0000)]
[pdb] Merge NamedStreamMapBuilder and NamedStreamMap.

While the builder pattern has proven useful for certain other
larger types, in this case it was hampering the ability to use
the data structure, as for runtime access we need a map that
we can efficiently read from and write to.  So the two are merged
into a single data structure that can efficiently be read to,
written from, deserialized from bytes, and serialized to bytes.

llvm-svn: 292664

7 years ago[PDB] Rename some files to be more intuitive.
Zachary Turner [Fri, 20 Jan 2017 22:41:15 +0000 (22:41 +0000)]
[PDB] Rename some files to be more intuitive.

llvm-svn: 292663

7 years agoIRGen: Start using the WriteThinLTOBitcode pass.
Peter Collingbourne [Fri, 20 Jan 2017 22:39:16 +0000 (22:39 +0000)]
IRGen: Start using the WriteThinLTOBitcode pass.

This is the final change necessary to support CFI with ThinLTO.

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

llvm-svn: 292662

7 years agoIPO, LTO: Plumb the summary from the LTO API into the pass manager.
Peter Collingbourne [Fri, 20 Jan 2017 22:18:52 +0000 (22:18 +0000)]
IPO, LTO: Plumb the summary from the LTO API into the pass manager.

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

llvm-svn: 292661

7 years ago[ValueTracking] recognize variations of 'clamp' to improve codegen (PR31693)
Sanjay Patel [Fri, 20 Jan 2017 22:18:47 +0000 (22:18 +0000)]
[ValueTracking] recognize variations of 'clamp' to improve codegen (PR31693)

By enhancing value tracking, we allow an existing min/max canonicalization to
kick in and improve codegen for several targets that have min/max instructions.

Unfortunately, recognizing min/max in value tracking may cause us to hit
a hack in InstCombiner::visitICmpInst() more often:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/109340.html
...but I'm hoping we can remove that soon.

Correctness proofs based on Alive:

Name: smaxmin
Pre: C1 < C2
%cmp2 = icmp slt i8 %x, C2
%min = select i1 %cmp2, i8 %x, i8 C2
%cmp3 = icmp slt i8 %x, C1
%r = select i1 %cmp3, i8 C1, i8 %min
=>
%cmp2 = icmp slt i8 %x, C2
%min = select i1 %cmp2, i8 %x, i8 C2
%cmp1 = icmp sgt i8 %min, C1
%r = select i1 %cmp1, i8 %min, i8 C1

Name: sminmax
Pre: C1 > C2
%cmp2 = icmp sgt i8 %x, C2
%max = select i1 %cmp2, i8 %x, i8 C2
%cmp3 = icmp sgt i8 %x, C1
%r = select i1 %cmp3, i8 C1, i8 %max
=>
%cmp2 = icmp sgt i8 %x, C2
%max = select i1 %cmp2, i8 %x, i8 C2
%cmp1 = icmp slt i8 %max, C1
%r = select i1 %cmp1, i8 %max, i8 C1

----------------------------------------
Optimization: smaxmin
Done: 1
Optimization is correct!
----------------------------------------
Optimization: sminmax
Done: 1
Optimization is correct!

Name: umaxmin
Pre: C1 u< C2
%cmp2 = icmp ult i8 %x, C2
%min = select i1 %cmp2, i8 %x, i8 C2
%cmp3 = icmp ult i8 %x, C1
%r = select i1 %cmp3, i8 C1, i8 %min
=>
%cmp2 = icmp ult i8 %x, C2
%min = select i1 %cmp2, i8 %x, i8 C2
%cmp1 = icmp ugt i8 %min, C1
%r = select i1 %cmp1, i8 %min, i8 C1

Name: uminmax
Pre: C1 u> C2
%cmp2 = icmp ugt i8 %x, C2
%max = select i1 %cmp2, i8 %x, i8 C2
%cmp3 = icmp ugt i8 %x, C1
%r = select i1 %cmp3, i8 C1, i8 %max
=>
%cmp2 = icmp ugt i8 %x, C2
%max = select i1 %cmp2, i8 %x, i8 C2
%cmp1 = icmp ult i8 %max, C1
%r = select i1 %cmp1, i8 %max, i8 C1

----------------------------------------
Optimization: umaxmin
Done: 1
Optimization is correct!
----------------------------------------
Optimization: uminmax
Done: 1
Optimization is correct!

llvm-svn: 292660

7 years ago[Altivec] Change vec_sl to a << (b % (sizeof(a) * 8))
Tim Shen [Fri, 20 Jan 2017 22:05:33 +0000 (22:05 +0000)]
[Altivec] Change vec_sl to a << (b % (sizeof(a) * 8))

For a << b (as original vec_sl does), if b >= sizeof(a) * 8, the
behavior is undefined. However, Power instructions do define the
behavior, which is equivalent to a << (b % (sizeof(a) * 8)).

This patch changes altivec.h to use a << (b % (sizeof(a) * 8)), to
ensure the consistent semantic of the instructions. Then it combines
the generated multiple instructions back to a single shift.

This patch handles left shift only. Right shift, on the other hand, is
more complicated, considering arithematic/logical right shift.

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

llvm-svn: 292659

7 years agodocs: Document that !absolute_symbol { all-ones, all-ones } means the full set.
Peter Collingbourne [Fri, 20 Jan 2017 21:56:37 +0000 (21:56 +0000)]
docs: Document that !absolute_symbol { all-ones, all-ones } means the full set.

llvm-svn: 292657

7 years ago[ThinLTO] Drop non-prevailing non-ODR weak to declarations
Teresa Johnson [Fri, 20 Jan 2017 21:54:58 +0000 (21:54 +0000)]
[ThinLTO] Drop non-prevailing non-ODR weak to declarations

Summary:
Allow non-ODR weak/linkonce non-prevailing copies to be marked
as available_externally in the index. Add support for dropping these to
declarations in the backend.

Reviewers: mehdi_amini, pcc

Subscribers: llvm-commits

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

llvm-svn: 292656

7 years ago[InstCombine] add tests to show missed canonicalization of min/max; NFC
Sanjay Patel [Fri, 20 Jan 2017 21:49:41 +0000 (21:49 +0000)]
[InstCombine] add tests to show missed canonicalization of min/max; NFC

Unfortunately, recognizing these in value tracking may cause us to hit
a hack in InstCombiner::visitICmpInst() more often:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/109340.html

...but besides being the obviously Right Thing To Do, there's a clear
codegen win from identifying these patterns for several targets.

llvm-svn: 292655

7 years agoLowerTypeTests: Implement importing of type identifiers.
Peter Collingbourne [Fri, 20 Jan 2017 21:49:34 +0000 (21:49 +0000)]
LowerTypeTests: Implement importing of type identifiers.

To import a type identifier we read the summary and create external
references to the symbols defined when exporting.

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

llvm-svn: 292654

7 years ago[globalisel] Fix an unused variable warning when NDEBUG is defined.
Daniel Sanders [Fri, 20 Jan 2017 21:40:05 +0000 (21:40 +0000)]
[globalisel] Fix an unused variable warning when NDEBUG is defined.

llvm-svn: 292653

7 years ago[libFuzzer] add an assert to protect against LLVMFuzzerInitialize changing argv[0]
Kostya Serebryany [Fri, 20 Jan 2017 21:34:24 +0000 (21:34 +0000)]
[libFuzzer] add an assert to protect against  LLVMFuzzerInitialize changing argv[0]

llvm-svn: 292652

7 years agoAMDGPU/R600: Serialize vector trunc stores to private AS
Jan Vesely [Fri, 20 Jan 2017 21:24:26 +0000 (21:24 +0000)]
AMDGPU/R600: Serialize vector trunc stores to private AS

Add DUMMY_CHAIN SDNode to denote stores of interest

Bugzilla: https://llvm.org/bugs/show_bug.cgi?id=28915
Bugzilla: https://llvm.org/bugs/show_bug.cgi?id=30411

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

llvm-svn: 292651

7 years ago[sanitizer] [asan] Use macros to simplify weak aliases on Windows.
Marcos Pividori [Fri, 20 Jan 2017 21:09:36 +0000 (21:09 +0000)]
[sanitizer] [asan] Use macros to simplify weak aliases on Windows.

This patch adds some useful macros for dealing with pragma directives on
Windows. Also, I add appropriate documentation for future users.

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

llvm-svn: 292650

7 years agoNewGVN: Remove pr31686.ll, it is tested by pr31594.ll, which is much smaller and...
Daniel Berlin [Fri, 20 Jan 2017 21:04:58 +0000 (21:04 +0000)]
NewGVN: Remove pr31686.ll, it is tested by pr31594.ll, which is much smaller and simpler

llvm-svn: 292649

7 years agoNewGVN: Fix PR 31686 and PR 31698 by rewriting store leader handling.
Daniel Berlin [Fri, 20 Jan 2017 21:04:30 +0000 (21:04 +0000)]
NewGVN: Fix PR 31686 and PR 31698 by rewriting store leader handling.

Summary:

This rewrites store expression/leader handling.  We no longer use the
value operand as the leader, instead, we store it separately.  We also
now store the stored value as part of the expression, and compare it
when comparing stores for equality.  This enables us to get rid of a
bunch of our previous hacks and machinations, as the existing
machinery takes care of everything *except* updating the stored value
on classes.  The only time we have to update it is if the storecount
goes to 0, and when we do, we destroy it.

Since we no longer use the value operand as the leader, during elimination, we have to use the value operand.  Doing this also fixes a bunch of store forwarding cases we were missing.

Any value operand we use is guaranteed to either be updated by previous eliminations, or minimized by future ones.

(IE the fact that we don't use the most dominating value operand when it's not a constant does not affect anything).

Sadly, this change also exposes that we didn't pay attention to the
output of the pr31594.ll test, as it also very clearly exposes the
same store leader bug we are fixing here.

(I added pr31682.ll anyway, but maybe we think that's too large to be useful)

On the plus side, propagate-ir-flags.ll now passes due to the
corrected store forwarding.

This change was 3 stage'd on darwin and linux, with the full test-suite.

Reviewers:
davide
Subscribers:
llvm-commits

llvm-svn: 292648

7 years agoLowerTypeTests: Compute SizeM1BitWidth in exportTypeId. NFCI.
Peter Collingbourne [Fri, 20 Jan 2017 20:57:40 +0000 (20:57 +0000)]
LowerTypeTests: Compute SizeM1BitWidth in exportTypeId. NFCI.

This avoids needing to store it in a separate field in TypeIdLowering.

llvm-svn: 292647

7 years ago[libFuzzer] experimental support for 'equivalance fuzzing'
Kostya Serebryany [Fri, 20 Jan 2017 20:57:07 +0000 (20:57 +0000)]
[libFuzzer] experimental support for 'equivalance fuzzing'

llvm-svn: 292646

7 years ago[WebAssembly] Don't create bitcast-wrappers for varargs.
Dan Gohman [Fri, 20 Jan 2017 20:50:29 +0000 (20:50 +0000)]
[WebAssembly] Don't create bitcast-wrappers for varargs.

WebAssembly varargs functions use a significantly different ABI than
non-varargs functions, and the current code in
WebAssemblyFixFunctionBitcasts doesn't handle that difference. For now,
just avoid creating wrapper functions in the presence of varargs.

llvm-svn: 292645

7 years agoDon't create a bogus PT_PHDR if we don't allocate the headers.
Rafael Espindola [Fri, 20 Jan 2017 20:46:15 +0000 (20:46 +0000)]
Don't create a bogus PT_PHDR if we don't allocate the headers.

llvm-svn: 292644

7 years agoRevert "Don't inline dllimport functions referencing non-imported methods"
Reid Kleckner [Fri, 20 Jan 2017 20:44:50 +0000 (20:44 +0000)]
Revert "Don't inline dllimport functions referencing non-imported methods"

This reverts commit r292522. It appears to be causing crashes in builds
using dllimport.

llvm-svn: 292643

7 years agoReduce code duplication when allocating program headers.
Rafael Espindola [Fri, 20 Jan 2017 20:41:18 +0000 (20:41 +0000)]
Reduce code duplication when allocating program headers.

This will simplify a bug fix.

llvm-svn: 292642

7 years ago[ThinLTO] Fix lazy-loading of MDString instruction attachments
Mehdi Amini [Fri, 20 Jan 2017 20:29:16 +0000 (20:29 +0000)]
[ThinLTO] Fix lazy-loading of MDString instruction attachments

CFI is using intrinsics that takes MDString as arguments, and this
was broken during lazy-loading of metadata.

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

llvm-svn: 292641

7 years ago[x86] add tests to show missed min/max vector codegen (PR31693)
Sanjay Patel [Fri, 20 Jan 2017 20:14:11 +0000 (20:14 +0000)]
[x86] add tests to show missed min/max vector codegen (PR31693)

llvm-svn: 292640

7 years agoRevert r292508 given that we intend to remove driver options for cxx modules.
Manman Ren [Fri, 20 Jan 2017 20:03:00 +0000 (20:03 +0000)]
Revert r292508 given that we intend to remove driver options for cxx modules.

llvm-svn: 292639

7 years agoFix catch_reference_nullptr.pass.cpp test for GCC.
Eric Fiselier [Fri, 20 Jan 2017 19:34:19 +0000 (19:34 +0000)]
Fix catch_reference_nullptr.pass.cpp test for GCC.

This test contained an implicit conversion from nullptr to bool.
Clang warns about this but the test had supressed that warning.
However GCC diagnoses the same code as an error and requires
-fpermissive to accept it.

This patch fixes both the warning and the error by explicitly
converting the pointer to bool.

llvm-svn: 292638

7 years ago[docs] Regenerate DiagnosticsReference.rst. We don't have automatic generation of...
Richard Smith [Fri, 20 Jan 2017 19:27:09 +0000 (19:27 +0000)]
[docs] Regenerate DiagnosticsReference.rst. We don't have automatic generation of this set up server-side yet.

llvm-svn: 292637

7 years agoAMDGPU: Add builtin for getreg intrinsic
Matt Arsenault [Fri, 20 Jan 2017 19:24:22 +0000 (19:24 +0000)]
AMDGPU: Add builtin for getreg intrinsic

llvm-svn: 292636

7 years ago[Sema] Remove dead typedef
Bruno Cardoso Lopes [Fri, 20 Jan 2017 19:04:01 +0000 (19:04 +0000)]
[Sema] Remove dead typedef

llvm-svn: 292635

7 years ago[DWARF] [ObjectYAML] Adding APIs for unittesting
Chris Bieneman [Fri, 20 Jan 2017 19:03:14 +0000 (19:03 +0000)]
[DWARF] [ObjectYAML] Adding APIs for unittesting

Summary: This patch adds some new APIs to enable using the YAML DWARF representation in unit tests. The most basic new API is DWARFYAML::EmitDebugSections which converts a YAML string into a series of owned MemoryBuffer objects stored in a StringMap. The string map can then be used to construct a DWARFContext for parsing in place of an ObjectFile.

Reviewers: dblaikie, clayborg

Subscribers: mgorny, fhahn, jgosnell, aprantl, llvm-commits

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

llvm-svn: 292634

7 years agoRecommit "[InlineCost] Use TTI to check if GEP is free." #3
Haicheng Wu [Fri, 20 Jan 2017 18:51:22 +0000 (18:51 +0000)]
Recommit "[InlineCost] Use TTI to check if GEP is free." #3

This is the third attemp to recommit r292526.

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: 292633

7 years agoFix actually-reachable llvm_unreachable.
Richard Smith [Fri, 20 Jan 2017 18:50:12 +0000 (18:50 +0000)]
Fix actually-reachable llvm_unreachable.

llvm-svn: 292632

7 years ago[SLP] Initial test for fix of PR31690.
Alexey Bataev [Fri, 20 Jan 2017 18:40:21 +0000 (18:40 +0000)]
[SLP] Initial test for fix of PR31690.

llvm-svn: 292631

7 years ago[scudo] Replacing std::atomic with Sanitizer's atomics
Kostya Kortchinsky [Fri, 20 Jan 2017 18:32:18 +0000 (18:32 +0000)]
[scudo] Replacing std::atomic with Sanitizer's atomics

Summary:
In an effort to getting rid of dependencies to external libraries, we are
replacing atomic PackedHeader use of std::atomic with Sanitizer's
atomic_uint64_t, which allows us to avoid -latomic.

Reviewers: kcc, phosek, alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 292630

7 years agoARM: tLDR_postidx should be marked mayLoad
Matthias Braun [Fri, 20 Jan 2017 18:30:28 +0000 (18:30 +0000)]
ARM: tLDR_postidx should be marked mayLoad

This fixes -verify-machineinstrs complaints.

llvm-svn: 292629

7 years agoSimplify. NFC.
Rafael Espindola [Fri, 20 Jan 2017 18:20:37 +0000 (18:20 +0000)]
Simplify. NFC.

addIgnored already creates the symbol only if there is a reference to
it.

llvm-svn: 292628

7 years ago[InstCombine][X86] Add MULDQ/MULUDQ undef handling
Simon Pilgrim [Fri, 20 Jan 2017 18:20:30 +0000 (18:20 +0000)]
[InstCombine][X86] Add MULDQ/MULUDQ undef handling

llvm-svn: 292627

7 years ago[SLP] A new test for horizontal vectorization for non-power-of-2
Alexey Bataev [Fri, 20 Jan 2017 18:04:29 +0000 (18:04 +0000)]
[SLP] A new test for horizontal vectorization for non-power-of-2
instructions.

llvm-svn: 292626

7 years agoAArch64LoadStoreOptimizer: Update kill flags when merging stores
Matthias Braun [Fri, 20 Jan 2017 18:04:27 +0000 (18:04 +0000)]
AArch64LoadStoreOptimizer: Update kill flags when merging stores

Kill flags need to be updated correctly when moving stores up/down to
form store pair instructions.
Those invalid flags have been ignored before but as of r290014 they are
recognized when using -mllvm -verify-machineinstrs.

Also simplifies test/CodeGen/AArch64/ldst-opt-dbg-limit.mir, renames it
to ldst-opt.mir test and adds a new tests for this change.

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

llvm-svn: 292625

7 years ago[mips] Fix debug information for __thread variable
Petar Jovanovic [Fri, 20 Jan 2017 17:53:30 +0000 (17:53 +0000)]
[mips] Fix debug information for __thread variable

This patch fixes debug information for __thread variable on Mips
using .dtprelword and .dtpreldword directives.

Patch by Aleksandar Beserminji.

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

llvm-svn: 292624

7 years ago[AMDGPU] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Fri, 20 Jan 2017 17:52:16 +0000 (17:52 +0000)]
[AMDGPU] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 292623

7 years ago[RegisterCoalescing] Recommit the patch "Remove partial redundent copy".
Wei Mi [Fri, 20 Jan 2017 17:38:54 +0000 (17:38 +0000)]
[RegisterCoalescing] Recommit the patch "Remove partial redundent copy".

The recommit fixes a bug related with live interval update after the partial
redundent copy is moved.

The original patch is to solve the performance problem described in PR27827.
Register coalescing sometimes cannot remove a copy because of interference.
But if we can find a reverse copy in one of the predecessor block of the copy,
the copy is partially redundent and we may remove the copy partially by moving
it to the predecessor block without the reverse copy.

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

llvm-svn: 292621

7 years ago[InstCombine][SSE] Tests showing missed opportunities to handle muldq/muludq with...
Simon Pilgrim [Fri, 20 Jan 2017 17:06:38 +0000 (17:06 +0000)]
[InstCombine][SSE] Tests showing missed opportunities to handle muldq/muludq with undef arguments

Fixed a typo in existing test names at the same time

llvm-svn: 292619

7 years agoRevert "Recommit "[InlineCost] Use TTI to check if GEP is free." #2"
Haicheng Wu [Fri, 20 Jan 2017 16:52:22 +0000 (16:52 +0000)]
Revert "Recommit "[InlineCost] Use TTI to check if GEP is free." #2"

This reverts commit r292616 because the test case still has problem.

llvm-svn: 292618

7 years ago[Frontend] The macro that describes the Objective-C bool type should
Alex Lorenz [Fri, 20 Jan 2017 16:48:25 +0000 (16:48 +0000)]
[Frontend] The macro that describes the Objective-C bool type should
be defined for non Objective-C code as well

rdar://29794915

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

llvm-svn: 292617

7 years agoRecommit "[InlineCost] Use TTI to check if GEP is free." #2
Haicheng Wu [Fri, 20 Jan 2017 16:36:34 +0000 (16:36 +0000)]
Recommit "[InlineCost] Use TTI to check if GEP is free." #2

This is the second attemp to recommit r292526.

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: 292616

7 years ago[Sema] Improve the error diagnostic for dot destructor calls on pointer objects
Alex Lorenz [Fri, 20 Jan 2017 15:38:58 +0000 (15:38 +0000)]
[Sema] Improve the error diagnostic for dot destructor calls on pointer objects

This commit improves the mismatched destructor type error by detecting when the
destructor call has used a '.' instead of a '->' on a pointer to the destructed
type. The diagnostic now suggests to use '->' instead of '.', and adds a fixit
where appropriate.

rdar://28766702

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

llvm-svn: 292615

7 years ago[ELF] Cleanup createThunks() NFC.
Peter Smith [Fri, 20 Jan 2017 15:25:45 +0000 (15:25 +0000)]
[ELF] Cleanup createThunks() NFC.

Include removal of call to getThunkExpr() as it has already been
called and recorded by scanRelocs()

Cleanup suggestions by Rafael.

llvm-svn: 292614

7 years agoRemove trailing whitespace. NFCI.
Simon Pilgrim [Fri, 20 Jan 2017 15:15:59 +0000 (15:15 +0000)]
Remove trailing whitespace. NFCI.

llvm-svn: 292613

7 years ago[CostModel][X86] Removed unused cost. NFCI.
Simon Pilgrim [Fri, 20 Jan 2017 15:14:38 +0000 (15:14 +0000)]
[CostModel][X86] Removed unused cost. NFCI.

SHL v8i32 is already handled in the SSE41 cost table

llvm-svn: 292612

7 years agoPrevent client from querying each thread's PC at each stop.
Pavel Labath [Fri, 20 Jan 2017 14:17:16 +0000 (14:17 +0000)]
Prevent client from querying each thread's PC at each stop.

Summary:
The server was no longer sending the thread PCs the way the client
expected them.
I changed the server to send them back as a threadstop info field,
similar to the Apple version of the server.
I also changed the client to look for them there, before querying the
server.
I added a test to ensure the server doesn't stop sending them.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D28880
Author: Jason Majors

llvm-svn: 292611

7 years ago[InstCombine][SSE] Tests showing missed opportunities to constant fold packss/packus
Simon Pilgrim [Fri, 20 Jan 2017 13:21:30 +0000 (13:21 +0000)]
[InstCombine][SSE] Tests showing missed opportunities to constant fold packss/packus

llvm-svn: 292609

7 years ago[Thumb] Add support for tMUL in the compare instruction peephole optimizer.
Sjoerd Meijer [Fri, 20 Jan 2017 13:10:12 +0000 (13:10 +0000)]
[Thumb] Add support for tMUL in the compare instruction peephole optimizer.

We also want to optimise tests like this: return a*b == 0.  The MULS
instruction is flag setting, so we don't need the CMP instruction but can
instead branch on the result of the MULS. The generated instructions sequence
for this example was: MULS, MOVS, MOVS, CMP. The MOVS instruction load the
boolean values resulting from the select instruction, but these MOVS
instructions are flag setting and were thus preventing this optimisation. Now
we first reorder and move the MULS to before the CMP and generate sequence
MOVS, MOVS, MULS, CMP so that the optimisation could trigger. Reordering of the
MULS and MOVS is safe to do because the subsequent MOVS instructions just set
the CPSR register and don't use it, i.e. the CPSR is dead.

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

llvm-svn: 292608

7 years agoDon't default older GCC's to C++17, but C++14 or C++11 instead
Eric Fiselier [Fri, 20 Jan 2017 12:54:45 +0000 (12:54 +0000)]
Don't default older GCC's to C++17, but C++14 or C++11 instead

llvm-svn: 292607

7 years agoRevert "Don't default older GCC's to C++17, but C++14 or C++11 instead"
Eric Fiselier [Fri, 20 Jan 2017 12:52:59 +0000 (12:52 +0000)]
Revert "Don't default older GCC's to C++17, but C++14 or C++11 instead"

The commit isn't quite right, and I want to only have to merge one
commit into 4.0

llvm-svn: 292606

7 years agoDon't default older GCC's to C++17, but C++14 or C++11 instead
Eric Fiselier [Fri, 20 Jan 2017 12:46:57 +0000 (12:46 +0000)]
Don't default older GCC's to C++17, but C++14 or C++11 instead

llvm-svn: 292605

7 years ago[clang-format] Remove redundant test in style-on-command-line.cpp
Krasimir Georgiev [Fri, 20 Jan 2017 12:39:05 +0000 (12:39 +0000)]
[clang-format] Remove redundant test in style-on-command-line.cpp

Summary:
rL292562 added a fix to always format if the fallback style is set to "none".
In test/Format/style-on-command-line.cpp:19 is redundant, since -fallback-style
has a default value of LLVM set in ClangFormat.cpp:72.

@amaiorano: I believe that the rest of the test cases still cover your change in
case the fallback style is explicitly set to "none". Please, if this is not the
case, initiate a discussion.

Reviewers: ioeric, bkramer

Reviewed By: ioeric

Subscribers: cfe-commits, klimek, amaiorano

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

llvm-svn: 292604

7 years ago[InstCombine][SSE] Tests showing missed opportunities to handle packss/packus with...
Simon Pilgrim [Fri, 20 Jan 2017 11:28:07 +0000 (11:28 +0000)]
[InstCombine][SSE] Tests showing missed opportunities to handle packss/packus with undef arguments

llvm-svn: 292601

7 years agoRemove 'RUN: false' from Driver/response-file.c
Krasimir Georgiev [Fri, 20 Jan 2017 11:06:58 +0000 (11:06 +0000)]
Remove 'RUN: false' from Driver/response-file.c

Summary:
It seems that rL292518 introduced a RUN: false, but the continuation rL292545
forgot to remove it back.

This has flown under the radar, because it's a long test and doesn't get
executed by default during sanity testing.

To test:
$ cd llvm_build
$ ./bin/llvm-lit --param run_long_tests=true tools/clang/test/Driver/response-file.c

@rsmith: have a look if this change is OK please.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits, rsmith

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

llvm-svn: 292600

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