platform/upstream/llvm.git
7 years ago[llvm-pdbdump] Add the option to sort functions and data.
Zachary Turner [Sun, 14 May 2017 01:13:40 +0000 (01:13 +0000)]
[llvm-pdbdump] Add the option to sort functions and data.

llvm-svn: 302998

7 years ago[SelectionDAG] Added support for EXTRACT_SUBVECTOR/CONCAT_VECTORS demandedelts in...
Simon Pilgrim [Sat, 13 May 2017 22:10:58 +0000 (22:10 +0000)]
[SelectionDAG] Added support for EXTRACT_SUBVECTOR/CONCAT_VECTORS demandedelts in ComputeNumSignBits

llvm-svn: 302997

7 years agoAdd missing files
Peter Collingbourne [Sat, 13 May 2017 22:10:13 +0000 (22:10 +0000)]
Add missing files

llvm-svn: 302996

7 years agoMove lib/LibDriver -> lib/ToolDrivers/llvm-lib. NFCI.
Peter Collingbourne [Sat, 13 May 2017 22:06:46 +0000 (22:06 +0000)]
Move lib/LibDriver -> lib/ToolDrivers/llvm-lib. NFCI.

This reorganisation prevents us from cluttering up the top-level lib directory
with more driver libraries such as llvm-dlltool (see D29892).

llvm-svn: 302995

7 years ago[X86][SSE] Test showing missing EXTRACT_SUBVECTOR/CONCAT_VECTORS demandedelts support...
Simon Pilgrim [Sat, 13 May 2017 21:50:18 +0000 (21:50 +0000)]
[X86][SSE] Test showing missing EXTRACT_SUBVECTOR/CONCAT_VECTORS demandedelts support in ComputeNumSignBits

llvm-svn: 302994

7 years ago[SelectionDAG] Add VECTOR_SHUFFLE support to ComputeNumSignBits
Simon Pilgrim [Sat, 13 May 2017 19:57:10 +0000 (19:57 +0000)]
[SelectionDAG] Add VECTOR_SHUFFLE support to ComputeNumSignBits

llvm-svn: 302993

7 years ago[X86][SSE] Test showing inability of ComputeNumSignBits to resolve shuffles
Simon Pilgrim [Sat, 13 May 2017 17:41:07 +0000 (17:41 +0000)]
[X86][SSE] Test showing inability of ComputeNumSignBits to resolve shuffles

llvm-svn: 302992

7 years ago[ValueTracking] Remove const_casts on several calls to computeKnownBits and ComputeSi...
Craig Topper [Sat, 13 May 2017 17:22:16 +0000 (17:22 +0000)]
[ValueTracking] Remove const_casts on several calls to computeKnownBits and ComputeSignBit. NFC

llvm-svn: 302991

7 years agoMSan: Mark MemorySanitizer tests that use x86 intrinsics as REQUIRES: x86
Justin Bogner [Sat, 13 May 2017 16:24:38 +0000 (16:24 +0000)]
MSan: Mark MemorySanitizer tests that use x86 intrinsics as REQUIRES: x86

Tests that use target intrinsics are inherently target specific. Mark
them as such.

llvm-svn: 302990

7 years ago[x86, SSE] AVX1 PR28129 (256-bit all-ones rematerialization)
Simon Pilgrim [Sat, 13 May 2017 13:42:35 +0000 (13:42 +0000)]
[x86, SSE] AVX1 PR28129 (256-bit all-ones rematerialization)

Further perf tests on Jaguar indicate that:

vxorps  %ymm0, %ymm0, %ymm0
vcmpps  $15, %ymm0, %ymm0, %ymm0

is consistently faster (by about 9%) than:

vpcmpeqd  %xmm0, %xmm0, %xmm0
vinsertf128  $1, %xmm0, %ymm0, %ymm0

Testing equivalent code on a SandyBridge (E5-2640) puts it slightly (~3%) faster as well.

Committed on behalf of @dtemirbulatov

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

llvm-svn: 302989

7 years ago[LoopOptimizer][Fix]PR32859, PR24738
Simon Pilgrim [Sat, 13 May 2017 13:25:57 +0000 (13:25 +0000)]
[LoopOptimizer][Fix]PR32859, PR24738

The Loop vectorizer pass introduced undef value while it is fixing output of LCSSA form.
Here it is:

before: %e.0.ph = phi i32 [ 0, %for.inc.2.i ]
after: %e.0.ph = phi i32 [ 0, %for.inc.2.i ], [ undef, %middle.block ]

and after this change we have:

%e.0.ph = phi i32 [ 0, %for.inc.2.i ]
%e.0.ph = phi i32 [ 0, %for.inc.2.i ], [ 0, %middle.block ]

Committed on behalf of @dtemirbulatov

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

llvm-svn: 302988

7 years ago[Simplify] Remove identical write removal. NFC.
Michael Kruse [Sat, 13 May 2017 12:20:57 +0000 (12:20 +0000)]
[Simplify] Remove identical write removal. NFC.

Removal of overwritten writes currently encompasses all the cases
of the identical write removal.

There is an observable behavioral change in that the last, instead
of the first, MemoryAccess is kept. This should not affect the
generated code, however.

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

llvm-svn: 302987

7 years ago[Simplify] Remove writes that are overwritten.
Michael Kruse [Sat, 13 May 2017 11:49:34 +0000 (11:49 +0000)]
[Simplify] Remove writes that are overwritten.

Remove memory writes that are overwritten by later writes. This works
for StoreInsts:

      store double 21.0, double* %A
      store double 42.0, double* %A

scalar writes at the end of a statement and mixes of these.

Multiple writes can be the result of DeLICM, which might map multiple
writes to the same location when it knows that these do no conflict
(for instance because they write the same value). Such writes
interfere with pattern-matched optimization such as gemm and may not
get removed by other LLVM passes after code generation.

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

llvm-svn: 302986

7 years agoThis reverts r302984
Vivek Pandya [Sat, 13 May 2017 10:59:05 +0000 (10:59 +0000)]
This reverts r302984

llvm-svn: 302985

7 years agoSimplify MIR Output used for Codegen Testing
Vivek Pandya [Sat, 13 May 2017 08:55:43 +0000 (08:55 +0000)]
Simplify MIR Output used for Codegen Testing

- MIRYamlMapping: Default value provided for fields which have optional
mappings. Implemented == operators for required classes. When a field's value is
same as default value specified YAML IO class will not print it.

- MIRPrinter: Above mentioned behaviour is not on by default. If -simplify-mir
option not specified, then make yaml::Output to print fields with default values
too.

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

llvm-svn: 302984

7 years ago[APInt] Use Lo_32/Hi_32/Make_64 in a few more places in the divide code. NFCI
Craig Topper [Sat, 13 May 2017 07:14:17 +0000 (07:14 +0000)]
[APInt] Use Lo_32/Hi_32/Make_64 in a few more places in the divide code. NFCI

llvm-svn: 302983

7 years ago[InstCombine] Prevent InstCombine from triggering an extra iteration if something...
Craig Topper [Sat, 13 May 2017 06:56:04 +0000 (06:56 +0000)]
[InstCombine] Prevent InstCombine from triggering an extra iteration if something changed in the initial Worklist creation

Summary:
If the Worklist build causes an IR change this change flag currently factors into the flag for running another iteration of the iteration loop. But only changes during processing should trigger another loop.

This patch captures the worklist creation change flag into the outside the loop flag currently used for DbgDeclares and only sends that flag up to the caller. Rerunning the loop only depends on IC.run() now.

This uses the debug output of InstCombine to determine if one or two iterations run. I couldn't think of a better way to detect it since the second spurious iteration shoudn't make any visible changes. Just wasted computation.

I can do a pre-commit of the test case with the CHECK-NOT as a CHECK if this is an ok way to check this.

This is a subset of D31678 as I'm still not sure how to verify the analysis behavior for that.

Reviewers: davide, majnemer, spatel, chandlerc

Reviewed By: davide

Subscribers: llvm-commits

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

llvm-svn: 302982

7 years ago[libcxxabi] Do not align field unwindHeader when building for ARM EHABI.
Akira Hatanaka [Sat, 13 May 2017 06:28:17 +0000 (06:28 +0000)]
[libcxxabi] Do not align field unwindHeader when building for ARM EHABI.

For ARM EHABI, _Unwind_Exception is an alias of _Unwind_Control_Block,
which is not aligned, so we shouldn't align unwindHeader either.

rdar://problem/25364625

llvm-svn: 302981

7 years agoConstProp: Split x86 SSE intrinsic tests out of calls.ll
Justin Bogner [Sat, 13 May 2017 05:52:17 +0000 (05:52 +0000)]
ConstProp: Split x86 SSE intrinsic tests out of calls.ll

This allows us to mark this as `REQUIRES: x86`, since it uses x86
target specific intrinsics.

llvm-svn: 302980

7 years agoInstCombine: Move tests that use target intrinsics into subdirectories
Justin Bogner [Sat, 13 May 2017 05:39:46 +0000 (05:39 +0000)]
InstCombine: Move tests that use target intrinsics into subdirectories

Tests with target intrinsics are inherently target specific, so it
doesn't actually make sense to run them if we've excluded their
target.

llvm-svn: 302979

7 years ago[libcxxabi] Align unwindHeader on a double-word boundary.
Akira Hatanaka [Sat, 13 May 2017 03:14:49 +0000 (03:14 +0000)]
[libcxxabi] Align unwindHeader on a double-word boundary.

r276215 made a change to annotate _Unwind_Exception with attribute
"aligned" so that an exception object following field __cxa_exception
is sufficiently aligned. This fix hasn't been incorporated to unwind.h
on Darwin since it is an ABI breaking change.

Instead of annotating struct _Unwind_Exception with the attribute, this
commit annotates field unwindHeader of __cxa_exception. This ensures the
exception object is sufficiently aligned without breaking the ABI.

This recommits r302763 with fixes to RUN lines in the test case.

rdar://problem/25364625

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

llvm-svn: 302978

7 years agoDisable llvm/test/Transforms/NewGVN/pr32934.ll while Davide is investigating.
NAKAMURA Takumi [Sat, 13 May 2017 03:05:38 +0000 (03:05 +0000)]
Disable llvm/test/Transforms/NewGVN/pr32934.ll while Davide is investigating.

llvm-svn: 302977

7 years ago[NewGVN] XFAIL a flaky test until I find out what's going on.
Davide Italiano [Sat, 13 May 2017 02:45:47 +0000 (02:45 +0000)]
[NewGVN] XFAIL a flaky test until I find out what's going on.

I bet the change is correct but this test seems to expose some underlying
problem that manifest only on some buildbots, and I'm not able to reproduce
locally. Unfortunately I can't debug right now but I don't want to annoy
people with spurious failures, so I'll XFAIL until I can take a look (over
the weekend).

llvm-svn: 302976

7 years ago[ASTImporter] Improve handling of incomplete types
Sean Callanan [Sat, 13 May 2017 00:46:33 +0000 (00:46 +0000)]
[ASTImporter] Improve handling of incomplete types

ASTImporter has some bugs when it's importing types
that themselves come from an ExternalASTSource. This
is exposed particularly in the behavior when
comparing complete TagDecls with forward
declarations. This patch does several things:

- Adds a test case making sure that conflicting
  forward-declarations are resolved correctly;
- Extends the clang-import-test harness to test
  two-level importing, so that we make sure we
  complete types when necessary; and
- Fixes a few bugs I found this way. Failure to
  complete types was one; however, I also discovered
  that complete RecordDecls aren't properly added to
  the redecls chain for existing forward
  declarations.

llvm-svn: 302975

7 years ago[APInt] Fix typo in comment. NFC
Craig Topper [Sat, 13 May 2017 00:35:30 +0000 (00:35 +0000)]
[APInt] Fix typo in comment. NFC

llvm-svn: 302974

7 years ago[AVR] When lowering Select8/Select16, put newly generated MBBs in the same spot
Dylan McKay [Sat, 13 May 2017 00:22:34 +0000 (00:22 +0000)]
[AVR] When lowering Select8/Select16, put newly generated MBBs in the same spot

Contributed by Dr. Gergő Érdi.

Fixes a bug.

Raised from (https://github.com/avr-rust/rust/issues/49).

llvm-svn: 302973

7 years agoAA: Use generic intrinsics for tests instead of target specific ones
Justin Bogner [Sat, 13 May 2017 00:12:52 +0000 (00:12 +0000)]
AA: Use generic intrinsics for tests instead of target specific ones

Update a few tests to use llvm.masked.load/store instead of arm neon
vector loads and stores, and move the tests that are actually specific
to those arm intrinsics to their own files. This lets us mark the
tests that use target specific intrinsics as requiring those targets.

llvm-svn: 302972

7 years ago[CodeView] Silence some -Wsign-compare warnings
Justin Bogner [Sat, 13 May 2017 00:11:39 +0000 (00:11 +0000)]
[CodeView] Silence some -Wsign-compare warnings

llvm-svn: 302971

7 years ago[AVR] Remove an unused variable
Dylan McKay [Sat, 13 May 2017 00:00:26 +0000 (00:00 +0000)]
[AVR] Remove an unused variable

llvm-svn: 302970

7 years agoAdd LangOptions method to query whether we are tracking the owning module for a local...
Richard Smith [Sat, 13 May 2017 00:00:16 +0000 (00:00 +0000)]
Add LangOptions method to query whether we are tracking the owning module for a local declaration.

In preparation for expanding this behavior to cover additional cases.

llvm-svn: 302969

7 years ago[PartialInlining] Profile based cost analysis
Xinliang David Li [Fri, 12 May 2017 23:41:43 +0000 (23:41 +0000)]
[PartialInlining] Profile based cost analysis

Implemented frequency based cost/saving analysis
and related options.

The pass is now in a state ready to be turne on
in the pipeline (in follow up).

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

llvm-svn: 302967

7 years agoRemove unused tracking of owning module for MacroInfo objects.
Richard Smith [Fri, 12 May 2017 23:40:52 +0000 (23:40 +0000)]
Remove unused tracking of owning module for MacroInfo objects.

llvm-svn: 302966

7 years ago[modules] When creating a declaration, cache its owning module immediately
Richard Smith [Fri, 12 May 2017 23:27:00 +0000 (23:27 +0000)]
[modules] When creating a declaration, cache its owning module immediately
rather than waiting until it's queried.

Currently this is only applied to local submodule visibility mode, as we don't
yet allocate storage for the owning module in non-local-visibility modules
compilations.

llvm-svn: 302965

7 years ago[GISel]: Add a getConstantFPVRegVal utility
Aditya Nandakumar [Fri, 12 May 2017 22:54:52 +0000 (22:54 +0000)]
[GISel]: Add a getConstantFPVRegVal utility

This might be useful across various GISel Passes

https://reviews.llvm.org/D33051

llvm-svn: 302964

7 years ago[GISel]: Fix undefined behavior while accessing DefaultAction map
Aditya Nandakumar [Fri, 12 May 2017 22:43:58 +0000 (22:43 +0000)]
[GISel]: Fix undefined behavior while accessing DefaultAction map

We end up dereferencing the end iterator here when the Aspect doesn't exist in the DefaultAction map.
Change the API to return Optional<LLT> and return None when not found.
Also update the callers to handle the None case

llvm-svn: 302963

7 years ago[XRay] Fix build with libc++ (NFC).
Eugene Zelenko [Fri, 12 May 2017 22:26:42 +0000 (22:26 +0000)]
[XRay] Fix build with libc++ (NFC).

llvm-svn: 302962

7 years ago[IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
Eugene Zelenko [Fri, 12 May 2017 22:25:07 +0000 (22:25 +0000)]
[IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).

llvm-svn: 302961

7 years ago[TLI] Add mapping for various '__<func>_finite' forms of the math routines to SVML...
Andrew Kaylor [Fri, 12 May 2017 22:11:26 +0000 (22:11 +0000)]
[TLI] Add mapping for various '__<func>_finite' forms of the math routines to SVML routines

Patch by Chris Chrulski

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

llvm-svn: 302957

7 years ago[ConstantFolding] Add folding for various math '__<func>_finite' routines generated...
Andrew Kaylor [Fri, 12 May 2017 22:11:20 +0000 (22:11 +0000)]
[ConstantFolding] Add folding for various math '__<func>_finite' routines generated from -ffast-math

Patch by Chris Chrulski

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

llvm-svn: 302956

7 years ago[TLI] Add declarations for various math header file routines from math-finite.h that...
Andrew Kaylor [Fri, 12 May 2017 22:11:12 +0000 (22:11 +0000)]
[TLI] Add declarations for various math header file routines from math-finite.h that create '__<func>_finite as functions

Patch by Chris Chrulski

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

llvm-svn: 302955

7 years agoFixed the OS X build after Error -> Status rename.
Sean Callanan [Fri, 12 May 2017 21:53:44 +0000 (21:53 +0000)]
Fixed the OS X build after Error -> Status rename.

llvm-svn: 302954

7 years ago[APInt] Add early outs for a division by 1 to udiv/urem/udivrem
Craig Topper [Fri, 12 May 2017 21:45:50 +0000 (21:45 +0000)]
[APInt] Add early outs for a division by 1 to udiv/urem/udivrem

We already counted the number of bits in the RHS so its pretty cheap to just check if the RHS is 1.

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

llvm-svn: 302953

7 years ago[APInt] In udivrem, remember the bit width in a local variable so we don't reread...
Craig Topper [Fri, 12 May 2017 21:45:44 +0000 (21:45 +0000)]
[APInt] In udivrem, remember the bit width in a local variable so we don't reread it from the LHS which might be aliased with Quotient or Remainder.

This helped the compiler generate better code for the single word case. It was able to remember that the bit width was still a single word when it created the Remainder APInt and not create code for it possibly being multiword.

llvm-svn: 302952

7 years agoLTO: Don't verify modules twice in verifyMergedModuleOnce
Adrian Prantl [Fri, 12 May 2017 21:38:32 +0000 (21:38 +0000)]
LTO: Don't verify modules twice in verifyMergedModuleOnce

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

llvm-svn: 302951

7 years ago[Doc] Document "Splat" in the lexicon
Sanjay Patel [Fri, 12 May 2017 21:30:31 +0000 (21:30 +0000)]
[Doc] Document "Splat" in the lexicon

Patch by Wei-Ren Chen (陳韋任)!

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

llvm-svn: 302950

7 years ago[x86] add vector tests for demanded bits; NFC
Sanjay Patel [Fri, 12 May 2017 20:53:48 +0000 (20:53 +0000)]
[x86] add vector tests for demanded bits; NFC

llvm-svn: 302949

7 years agoFix build on Mac OS.
Eugene Zemtsov [Fri, 12 May 2017 20:44:09 +0000 (20:44 +0000)]
Fix build on Mac OS.

llvm-svn: 302948

7 years agoRevert r302932, as it appears to be breaking stage2 for some of our modules-enabled...
Richard Smith [Fri, 12 May 2017 20:42:54 +0000 (20:42 +0000)]
Revert r302932, as it appears to be breaking stage2 for some of our modules-enabled buildbots.

llvm-svn: 302947

7 years ago[test] Add specific test for P0138R2, direct-list-init of fixed enums from integers...
Casey Carter [Fri, 12 May 2017 20:33:46 +0000 (20:33 +0000)]
[test] Add specific test for P0138R2, direct-list-init of fixed enums from integers, part 3/3.

Test the C++17 Core Language feature independently from other std::byte tests.

llvm-svn: 302946

7 years ago[test] Avoid P0138R2, direct-list-init of fixed enums from integers, part 2/3.
Casey Carter [Fri, 12 May 2017 20:33:41 +0000 (20:33 +0000)]
[test] Avoid P0138R2, direct-list-init of fixed enums from integers, part 2/3.

This C++17 Core Language feature isn't necessary when testing std::byte.
It's a minor convenience, but it limits test coverage to very new compilers.

This part activates the tests for more compilers.

llvm-svn: 302945

7 years ago[test] Avoid P0138R2, direct-list-init of fixed enums from integers, part 1/3.
Casey Carter [Fri, 12 May 2017 20:33:32 +0000 (20:33 +0000)]
[test] Avoid P0138R2, direct-list-init of fixed enums from integers, part 1/3.

This C++17 Core Language feature isn't necessary when testing std::byte.
It's a minor convenience, but it limits test coverage to very new compilers.

This part changes the code.

Fixes D32386.

llvm-svn: 302944

7 years agoAMDGPU/SI: Don't promote to vector if the load/store is volatile.
Changpeng Fang [Fri, 12 May 2017 20:31:12 +0000 (20:31 +0000)]
AMDGPU/SI: Don't promote to vector if the load/store is volatile.

Summary:
  We should not change volatile loads/stores in promoting alloca to vector.

Reviewers:
  arsenm

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

llvm-svn: 302943

7 years ago[NVPTX] Don't flag StoreRetVal memory chain operands as ReadMem (PR32146)
Simon Pilgrim [Fri, 12 May 2017 19:56:43 +0000 (19:56 +0000)]
[NVPTX] Don't flag StoreRetVal memory chain operands as ReadMem (PR32146)

This fixes 47 of the 75 NVPTX '-verify-machineinstrs with EXPENSIVE_CHECKS' errors in PR32146.

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

llvm-svn: 302942

7 years ago[Sema] Silence buildbot failures introduced by r302935
Simon Dardis [Fri, 12 May 2017 19:55:32 +0000 (19:55 +0000)]
[Sema] Silence buildbot failures introduced by r302935

Attempt to silence buildbot failures by pinning the test to a given
triple rather than the host's triple.

llvm-svn: 302941

7 years agoRemove ignore-empty-index-file option
Teresa Johnson [Fri, 12 May 2017 19:32:17 +0000 (19:32 +0000)]
Remove ignore-empty-index-file option

Summary:
Clang changes to remove this option and replace with a parameter
always set in the context of a ThinLTO distributed backend.

Depends on D33133.

Reviewers: pcc

Subscribers: mehdi_amini, eraman, cfe-commits

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

llvm-svn: 302940

7 years agoRemove ignore-empty-index-file option
Teresa Johnson [Fri, 12 May 2017 19:32:11 +0000 (19:32 +0000)]
Remove ignore-empty-index-file option

Summary:
As discussed in the D32195 review thread and on IRC, remove this option
and replace with parameter, which will be set to true when invoked
from clang in the context of a ThinLTO distributed backend.

Reviewers: pcc

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 302939

7 years agoAdd LiveRangeShrink pass to shrink live range within BB.
Dehao Chen [Fri, 12 May 2017 19:29:27 +0000 (19:29 +0000)]
Add LiveRangeShrink pass to shrink live range within BB.

Summary: LiveRangeShrink pass moves instruction right after the definition with the same BB if the instruction and its operands all have more than one use. This pass is inexpensive and guarantees optimal live-range within BB.

Reviewers: davidxl, wmi, hfinkel, MatzeB, andreadb

Reviewed By: MatzeB, andreadb

Subscribers: hiraditya, jyknight, sanjoy, skatkov, gberry, jholewinski, qcolombet, javed.absar, krytarowski, atrick, spatel, RKSimon, andreadb, MatzeB, mehdi_amini, mgorny, efriedma, davide, dberlin, llvm-commits

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

llvm-svn: 302938

7 years ago[PPC] Move the combine "a << (b % (sizeof(a) * 8)) -> (PPCshl a, b)" to the backend...
Tim Shen [Fri, 12 May 2017 19:25:37 +0000 (19:25 +0000)]
[PPC] Move the combine "a << (b % (sizeof(a) * 8)) -> (PPCshl a, b)" to the backend. NFC.

Summary:
Eli pointed out that it's unsafe to combine the shifts to ISD::SHL etc.,
because those are not defined for b > sizeof(a) * 8, even after some of
the combiners run.

However, PPCISD::SHL defines that behavior (as the instructions themselves).
Move the combination to the backend.

The tests in shift_mask.ll still pass.

Reviewers: echristo, hfinkel, efriedma, iteratee

Subscribers: nemanjai, llvm-commits

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

llvm-svn: 302937

7 years ago[CodeView] Add a random access type visitor.
Zachary Turner [Fri, 12 May 2017 19:18:12 +0000 (19:18 +0000)]
[CodeView] Add a random access type visitor.

This adds a visitor that is capable of accessing type
records randomly and caching intermediate results that it
learns about during partial linear scans.  This yields
amortized O(1) access to a type stream even though type
streams cannot normally be indexed.

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

llvm-svn: 302936

7 years ago[Sema] Support implicit scalar to vector conversions
Simon Dardis [Fri, 12 May 2017 19:11:06 +0000 (19:11 +0000)]
[Sema] Support implicit scalar to vector conversions

This patch teaches clang to perform implicit scalar to vector conversions
when one of the operands of a binary vector expression is a scalar which
can be converted to the element type of the vector without truncation
following GCC's implementation.

If the (constant) scalar is can be casted safely, it is implicitly casted to the
vector elements type and splatted to produce a vector of the same type.

Contributions from: Petar Jovanovic

Reviewers: bruno, vkalintiris

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

llvm-svn: 302935

7 years ago[include-fixer] Don't throw exception when parsing unknown arguments in
Haojian Wu [Fri, 12 May 2017 19:01:02 +0000 (19:01 +0000)]
[include-fixer] Don't throw exception when parsing unknown arguments in
vim script.

llvm-svn: 302934

7 years ago[AArch64][Falkor] Refine modeling of multiply accumulate forwarding.
Geoff Berry [Fri, 12 May 2017 18:57:10 +0000 (18:57 +0000)]
[AArch64][Falkor] Refine modeling of multiply accumulate forwarding.

llvm-svn: 302933

7 years ago[modules] Simplify module macro handling in non-local-submodule-visibility mode.
Richard Smith [Fri, 12 May 2017 18:56:03 +0000 (18:56 +0000)]
[modules] Simplify module macro handling in non-local-submodule-visibility mode.

When reaching the end of a module, we used to convert its macros to
ModuleMacros but also leave them in the MacroDirective chain for the
identifier. This meant that every lookup of such a macro would find two
(identical) definitions. It also made it difficult to determine the correct
owner for a macro when reaching the end of a module: the most recent
MacroDirective in the chain could be from an #included submodule rather than
the current module.

Simplify this: whenever we convert a MacroDirective to a ModuleMacro when
leaving a module, clear out the MacroDirective chain for that identifier, and
just rely on the ModuleMacro to provide the macro definition information.

(We don't want to do this for local submodule visibility mode, because in that
mode we maintain a distinct MacroDirective chain for each submodule, and we
need to keep around the prior MacroDirective in case we re-enter the submodule
-- for instance, if its header is #included more than once in a module build,
we need the include guard directive to stick around. But the problem doesn't
arise in this case for the same reason: each submodule has its own
MacroDirective chain, so the macros don't leak out of submodules in the first
place.)

llvm-svn: 302932

7 years ago[APInt] Add an assert to check for divide by zero in udivrem. NFC
Craig Topper [Fri, 12 May 2017 18:19:01 +0000 (18:19 +0000)]
[APInt] Add an assert to check for divide by zero in udivrem. NFC

udiv and urem already had the same assert.

llvm-svn: 302931

7 years ago[APInt] Remove unnecessary checks of rhsWords==1 with lhsWords==1 from udiv and udivr...
Craig Topper [Fri, 12 May 2017 18:18:57 +0000 (18:18 +0000)]
[APInt] Remove unnecessary checks of rhsWords==1 with lhsWords==1 from udiv and udivrem. NFC

At this point in the code rhsWords is guaranteed to be non-zero and less than or equal to lhsWords. So if lhsWords is 1, rhsWords must also be 1. urem alread had the check removed so this makes all 3 consistent.

llvm-svn: 302930

7 years agoClang-format and whitespace cleanup of source code
Jonathan Peyton [Fri, 12 May 2017 18:01:32 +0000 (18:01 +0000)]
Clang-format and whitespace cleanup of source code

This patch contains the clang-format and cleanup of the entire code base. Some
of clang-formats changes made the code look worse in places. A best effort was
made to resolve the bulk of these problems, but many remain. Most of the
problems were mangling line-breaks and tabbing of comments.

Patch by Terry Wilmarth

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

llvm-svn: 302929

7 years agoAMDGPU: Add lit.local.cfg to disable global-isel tests when global-isel is disabled
Tom Stellard [Fri, 12 May 2017 17:59:30 +0000 (17:59 +0000)]
AMDGPU: Add lit.local.cfg to disable global-isel tests when global-isel is disabled

This should fix bots broken by r302919.

llvm-svn: 302928

7 years agoStrip trailing whitespace. NFCI.
Simon Pilgrim [Fri, 12 May 2017 17:42:36 +0000 (17:42 +0000)]
Strip trailing whitespace. NFCI.

llvm-svn: 302927

7 years ago[Simplify] Reset all stats between runs.
Michael Kruse [Fri, 12 May 2017 17:23:07 +0000 (17:23 +0000)]
[Simplify] Reset all stats between runs.

llvm-svn: 302926

7 years ago[KnownBits] Add bit counting methods to KnownBits struct and use them where possible
Craig Topper [Fri, 12 May 2017 17:20:30 +0000 (17:20 +0000)]
[KnownBits] Add bit counting methods to KnownBits struct and use them where possible

This patch adds min/max population count, leading/trailing zero/one bit counting methods.

The min methods return answers based on bits that are known without considering unknown bits. The max methods give answers taking into account the largest count that unknown bits could give.

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

llvm-svn: 302925

7 years ago[ubsan] Enable debug info in test binaries
Reid Kleckner [Fri, 12 May 2017 17:06:16 +0000 (17:06 +0000)]
[ubsan] Enable debug info in test binaries

This fixes tests that use debug info to check ubsan stack traces.  One
was XFAILd on Windows and the other was actively failing for weeks.

llvm-svn: 302924

7 years ago[codeview] Fix assertion failure introduced in r295354 refactoring
Reid Kleckner [Fri, 12 May 2017 17:02:40 +0000 (17:02 +0000)]
[codeview] Fix assertion failure introduced in r295354 refactoring

CodeViewDebug sets Asm to nullptr to disable debug info generation.  You
can get a .ll file like no-cus.ll from 'clang -gcodeview -g0', which
happens in the ubsan test suite.

llvm-svn: 302923

7 years agoMake sure we have actually written what is expected by the test.
Galina Kistanova [Fri, 12 May 2017 17:00:13 +0000 (17:00 +0000)]
Make sure we have actually written what is expected by the test.

llvm-svn: 302922

7 years ago[ELF] - Apply clang-format. NFC.
George Rimar [Fri, 12 May 2017 17:00:07 +0000 (17:00 +0000)]
[ELF] - Apply clang-format. NFC.

llvm-svn: 302921

7 years agoDisable two failing darwin lsan tests
Francis Ricci [Fri, 12 May 2017 16:52:19 +0000 (16:52 +0000)]
Disable two failing darwin lsan tests

These tests don't fail consistently in all cases, but they
fail most of the time on the buildbots. Mark as UNSUPPORTED for now to
avoid buildbots failing due to XPASS.

llvm-svn: 302920

7 years agoAMDGPU/GlobalISel: Mark 32-bit integer constants as legal
Tom Stellard [Fri, 12 May 2017 16:46:46 +0000 (16:46 +0000)]
AMDGPU/GlobalISel: Mark 32-bit integer constants as legal

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, igorb, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 302919

7 years ago[index] Index template specialization arguments for function templats
Alex Lorenz [Fri, 12 May 2017 16:32:26 +0000 (16:32 +0000)]
[index] Index template specialization arguments for function templats

Also ensure that class template specialization arguments are covered

rdar://31812032

llvm-svn: 302918

7 years ago[asan/win] Re-enable Win64 asan tests on Win8+
Reid Kleckner [Fri, 12 May 2017 16:30:56 +0000 (16:30 +0000)]
[asan/win] Re-enable Win64 asan tests on Win8+

Our theory is that reserving large amounts of shadow memory isn't
reliable on Win7 and earlier NT kernels. This affects the
clang-x64-ninja-win7 buildbot, which uses Windows 7.

llvm-svn: 302917

7 years ago[APInt] Use MathExtras.h BitsToFloat/Double and Float/DoubleToBits instead of type...
Craig Topper [Fri, 12 May 2017 16:28:21 +0000 (16:28 +0000)]
[APInt] Use MathExtras.h BitsToFloat/Double and Float/DoubleToBits instead of type punning through a union

The functions in MathExtras.h uses a safer memcpy instead of going through a union.

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

llvm-svn: 302916

7 years agoSimplify DINamespace caching in CGDebugInfo
Adrian Prantl [Fri, 12 May 2017 16:23:53 +0000 (16:23 +0000)]
Simplify DINamespace caching in CGDebugInfo

This addresses review feedback from r302840.

By not canonicalizing namespace decls and using lexical decl context
instead of lookuing up the semantic decl context we can take advantage
of the fact that DINamespaces a reuniqued. This way non-module debug
info is unchanged and module debug info still gets distinct namespace
declarations when they ocur in different modules.

Thanks to Richard Smith for pointing this out!

llvm-svn: 302915

7 years ago[SPARC] Support 'f' and 'e' inline asm constraints.
James Y Knight [Fri, 12 May 2017 16:01:23 +0000 (16:01 +0000)]
[SPARC] Support 'f' and 'e' inline asm constraints.

Patch by Patrick Boettcher.

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

llvm-svn: 302913

7 years agoDisable two failing darwin lsan tests
Francis Ricci [Fri, 12 May 2017 16:01:15 +0000 (16:01 +0000)]
Disable two failing darwin lsan tests

These are causing buildbot failures, disable for now.

llvm-svn: 302912

7 years ago[SPARC] Support 'f' and 'e' inline asm constraints.
James Y Knight [Fri, 12 May 2017 15:59:10 +0000 (15:59 +0000)]
[SPARC] Support 'f' and 'e' inline asm constraints.

Based on patch by Patrick Boettcher and Chris Dewhurst.

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

llvm-svn: 302911

7 years ago[x86] add tests for potential vector narrowing optimization (PR32790)
Sanjay Patel [Fri, 12 May 2017 15:56:39 +0000 (15:56 +0000)]
[x86] add tests for potential vector narrowing optimization (PR32790)

llvm-svn: 302910

7 years ago[LoopUnroll] Fix a test. REQUIRE should be REQUIRES.
Davide Italiano [Fri, 12 May 2017 15:30:58 +0000 (15:30 +0000)]
[LoopUnroll] Fix a test. REQUIRE should be REQUIRES.

Found by inspection.

llvm-svn: 302909

7 years ago[NewGVN] Improve debug output a bit. NFCI.
Davide Italiano [Fri, 12 May 2017 15:28:12 +0000 (15:28 +0000)]
[NewGVN] Improve debug output a bit. NFCI.

While debugging a predicate info problem, I noticed this was missing
a newline, making the debug output slightly less readable.

llvm-svn: 302908

7 years ago[DAGCombine] Use SelectionDAG::getAnyExtOrTrunc helper. NFCI.
Simon Pilgrim [Fri, 12 May 2017 15:26:50 +0000 (15:26 +0000)]
[DAGCombine] Use SelectionDAG::getAnyExtOrTrunc helper. NFCI.

llvm-svn: 302907

7 years ago[NewGVN] Format an assertion and fix a typo. NFCI.
Davide Italiano [Fri, 12 May 2017 15:25:56 +0000 (15:25 +0000)]
[NewGVN] Format an assertion and fix a typo. NFCI.

llvm-svn: 302906

7 years ago[NewGVN] Don't incorrectly reset the memory leader.
Davide Italiano [Fri, 12 May 2017 15:22:45 +0000 (15:22 +0000)]
[NewGVN] Don't incorrectly reset the memory leader.

This code was missing a check for stores, so we were thinking the
congruency class didn't have any memory members, and reset the
memory leader.

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

llvm-svn: 302905

7 years agoEnable lsan test suite on Darwin x86_64 builds
Francis Ricci [Fri, 12 May 2017 15:10:05 +0000 (15:10 +0000)]
Enable lsan test suite on Darwin x86_64 builds

Reviewers: kubamracek, alekseyshl

Subscribers: mgorny, llvm-commits

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

llvm-svn: 302904

7 years agoOptimize orphan placement in a general way.
Rafael Espindola [Fri, 12 May 2017 14:52:22 +0000 (14:52 +0000)]
Optimize orphan placement in a general way.

We used to place orphans by just using compareSectionsNonScript.

Then we noticed that since linker scripts can use another order, we
should first try match the section to a given PT_LOAD. But there is
nothing special about PT_LOAD. The same issue can show up for
PT_GNU_RELRO for example.

In general, we have to search for the most similar section and put the
orphan next to it. Most similar being defined as how long they follow
the same code path in compareSecitonsNonScript.

That is what this patch does. We now compute a rank for each output
section, with a bit for each branch in what was
compareSectionsNonScript.

With this findOrphanPos is now fully general and orphan placement can
be optimized by placing every section with the same rank at once.

The included testcase is a variation of many-sections.s that uses
allocatable sections to avoid the fast path in the existing
code. Without threads it goes form 46 seconds to 0.9 seconds.

llvm-svn: 302903

7 years ago[Polly][NewPM] Port ScopDetection to the new PassManager
Philip Pfaffe [Fri, 12 May 2017 14:37:29 +0000 (14:37 +0000)]
[Polly][NewPM] Port ScopDetection to the new PassManager

Summary: This is a proof of concept of how to port polly-passes to the new PassManager architecture.  This approach works ootb for Function-Passes, but might not be directly applicable to Scop/Region-Passes. While we could just run the Analyses/Transforms over functions instead, we'd surrender the nice pipelining behaviour we have now.

Reviewers: Meinersbur, grosser

Reviewed By: grosser

Subscribers: pollydev, sanjoy, nemanjai, llvm-commits

Tags: #polly

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

llvm-svn: 302902

7 years agoEnabling the /bigobj flag for SemaDeclAttr.cpp.
Aaron Ballman [Fri, 12 May 2017 14:30:49 +0000 (14:30 +0000)]
Enabling the /bigobj flag for SemaDeclAttr.cpp.

This resolves compile errors with MSVC 2015 x64 debug builds where SemaDeclAttr.cpp is hitting the section symbol limit.

llvm-svn: 302901

7 years agoAdd dyld to sanitizer procmaps on darwin
Francis Ricci [Fri, 12 May 2017 14:10:53 +0000 (14:10 +0000)]
Add dyld to sanitizer procmaps on darwin

Summary:
Sanitizer procmaps uses dyld apis to iterate over the list of images
in the process. This is much more performan than manually recursing
over all of the memory regions in the process, however, dyld does
not report itself in the list of images. In order to prevent reporting
leaks from dyld globals and to symbolize dyld functions in stack traces,
this patch special-cases dyld and ensures that it is added to the
list of modules.

This is accomplished by recursing through the memory map of the process
until a dyld Mach header is found. While this recursion is expensive,
it is run before the full set of images has been loaded in the process,
so only a few calls are required. The result is cached so that it never
needs to be searched for when the full process memory map exists, as this
would be incredibly slow, on the order of minutes for leak sanitizer with
only 25 or so libraries loaded.

Reviewers: alekseyshl, kubamracek

Subscribers: llvm-commits

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

llvm-svn: 302899

7 years agoAccount for stack redzone when computing sp on darwin
Francis Ricci [Fri, 12 May 2017 14:10:51 +0000 (14:10 +0000)]
Account for stack redzone when computing sp on darwin

thread_get_register_pointer_values handles the redzone computation
automatically, but is marked as an unavailable API function. This
patch replicates its logic accounting for the stack redzone on
x86_64.

Should fix flakiness in the use_stack_threaded test for lsan on darwin.

llvm-svn: 302898

7 years ago[DAGCombine] Use SelectionDAG::getZExtOrTrunc helper. NFCI.
Simon Pilgrim [Fri, 12 May 2017 13:22:12 +0000 (13:22 +0000)]
[DAGCombine] Use SelectionDAG::getZExtOrTrunc helper. NFCI.

llvm-svn: 302897

7 years agoUse SDValue::getOperand() helper. NFCI.
Simon Pilgrim [Fri, 12 May 2017 13:20:24 +0000 (13:20 +0000)]
Use SDValue::getOperand() helper. NFCI.

llvm-svn: 302896

7 years ago[Hexagon] Make sure to pass empty struct arguments with nontrivial ctors
Krzysztof Parzyszek [Fri, 12 May 2017 13:18:07 +0000 (13:18 +0000)]
[Hexagon] Make sure to pass empty struct arguments with nontrivial ctors

Thanks to Richard Smith for the suggested fix.

This fixes llvm.org/PR33009

llvm-svn: 302895

7 years agoUse SDValue::getOperand() helper. NFCI.
Simon Pilgrim [Fri, 12 May 2017 13:08:45 +0000 (13:08 +0000)]
Use SDValue::getOperand() helper. NFCI.

llvm-svn: 302894

7 years agoclang-format: [JS] support non-null assertions after all identifiers.
Martin Probst [Fri, 12 May 2017 13:00:33 +0000 (13:00 +0000)]
clang-format: [JS] support non-null assertions after all identifiers.

Summary:
Previously:
    x = namespace !;

Now:
    x = namespace!;

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 302893