platform/upstream/llvm.git
7 years agoAMDGPU: Fix clobbering CSR VGPRs when spilling SGPR to it
Matt Arsenault [Wed, 2 Aug 2017 01:52:45 +0000 (01:52 +0000)]
AMDGPU: Fix clobbering CSR VGPRs when spilling SGPR to it

llvm-svn: 309783

7 years agoAMDGPU: Fix emitting encoded calls
Matt Arsenault [Wed, 2 Aug 2017 01:42:04 +0000 (01:42 +0000)]
AMDGPU: Fix emitting encoded calls

This was failing on out of bounds access to the extra operands
on the s_swappc_b64 beyond those in the instruction definition.

This was working, but somehow regressed within the past few weeks,
although I don't see any obvious commit.

llvm-svn: 309782

7 years agoAMDGPU: Analyze callee resource usage in AsmPrinter
Matt Arsenault [Wed, 2 Aug 2017 01:31:28 +0000 (01:31 +0000)]
AMDGPU: Analyze callee resource usage in AsmPrinter

llvm-svn: 309781

7 years agoUpdate the new PM pipeline to make ICP aware if it is SamplePGO build.
Dehao Chen [Wed, 2 Aug 2017 01:28:31 +0000 (01:28 +0000)]
Update the new PM pipeline to make ICP aware if it is SamplePGO build.

Summary: In ThinLTO backend compile, OPTOptions are not set so that the ICP in ThinLTO backend does not know if it is a SamplePGO build, in which profile count needs to be annotated directly on call instructions. This patch cleaned up the PGOOptions handling logic and passes down PGOOptions to ThinLTO backend.

Reviewers: chandlerc, tejohnson, davidxl

Reviewed By: chandlerc

Subscribers: sanjoy, llvm-commits, mehdi_amini

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

llvm-svn: 309780

7 years ago[AMDGPU] Fix asan error after last commit
Stanislav Mekhanoshin [Wed, 2 Aug 2017 01:18:57 +0000 (01:18 +0000)]
[AMDGPU] Fix asan error after last commit

Previous change "Turn s_and_saveexec_b64 into s_and_b64 if
result is unused" introduced asan use-after-poison error.
Instruction was analyzed after eraseFromParent() calls.

Move analysys higher than erase.

llvm-svn: 309779

7 years ago[Driver] Disable static C++ library support on Fuchsia
Petr Hosek [Wed, 2 Aug 2017 01:18:02 +0000 (01:18 +0000)]
[Driver] Disable static C++ library support on Fuchsia

Don't support or build static C++ libraries for Fuchsia.

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

llvm-svn: 309778

7 years ago[DAG] Refactor store merge subexpressions. NFC.
Nirav Dave [Wed, 2 Aug 2017 01:08:38 +0000 (01:08 +0000)]
[DAG] Refactor store merge subexpressions. NFC.

Distribute various expressions across ifs.

llvm-svn: 309777

7 years agoAMDGPU: Don't place arguments in emergency stack slot
Matt Arsenault [Wed, 2 Aug 2017 00:59:51 +0000 (00:59 +0000)]
AMDGPU: Don't place arguments in emergency stack slot

When finding the fixed offsets for function arguments,
this needs to skip over the 4 bytes reserved for the
emergency stack slot.

llvm-svn: 309776

7 years agoDAG: Undo and->or combine with FrameIndexes
Matt Arsenault [Wed, 2 Aug 2017 00:43:42 +0000 (00:43 +0000)]
DAG: Undo and->or combine with FrameIndexes

This pattern shows up when lowering byval copies on AMDGPU.

The byval object access is split into 4-byte chunks, adding a
constant offset to the FixedStack base. When some of the offsets
turn into ors, this prevents combining the constant offsets.

This makes it not apparent that the object is there when matching
addressing modes, so it ends up using a scratch wave offset
relative access and the lengthy frame index expansion for that.

llvm-svn: 309775

7 years agoX86: Do not use llc -march in tests.
Matthias Braun [Wed, 2 Aug 2017 00:28:10 +0000 (00:28 +0000)]
X86: Do not use llc -march in tests.

`llc -march` is problematic because it only switches the target
architecture, but leaves the operating system unchanged. This
occasionally leads to indeterministic tests because the OS from
LLVM_DEFAULT_TARGET_TRIPLE is used.

However we can simply always use `llc -mtriple` instead. This changes
all the tests to do this to avoid people using -march when they copy and
paste parts of tests.

See also the discussion in https://reviews.llvm.org/D35287

llvm-svn: 309774

7 years agoUpdate LiveDebugValues to generate DIExpressions for spill offsets
Adrian Prantl [Wed, 2 Aug 2017 00:16:56 +0000 (00:16 +0000)]
Update LiveDebugValues to generate DIExpressions for spill offsets
instead of using the deprecated offset field of DBG_VALUE.

This has no observable effect on the generated DWARF, but the
assembler comments will look different.

rdar://problem/33580047

llvm-svn: 309773

7 years agoFix a mis-feature with propagation of breakpoint options -> location options.
Jim Ingham [Wed, 2 Aug 2017 00:16:10 +0000 (00:16 +0000)]
Fix a mis-feature with propagation of breakpoint options -> location options.

When an option was set at on a location, I was just copying the whole option set
to the location, and letting it shadow the breakpoint options.  That was wrong since
it meant changes to unrelated options on the breakpoint would no longer take on this
location.  I added a mask of set options and use that for option propagation.

I also added a "location" property to breakpoints, and added SBBreakpointLocation.{G,S}etCommandLineCommands
since I wanted to use them to write some more test cases.

<rdar://problem/24397798>

llvm-svn: 309772

7 years agoRevert "Reland "[llvm][llvm-objcopy] Added support for outputting to binary in llvm...
Petr Hosek [Wed, 2 Aug 2017 00:03:33 +0000 (00:03 +0000)]
Revert "Reland "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy""

This is failing to compile on 32-bit ARM bots.

This reverts commit r309768.

llvm-svn: 309771

7 years agoUpdate MIR testcase to reflect change in r309751.
Adrian Prantl [Tue, 1 Aug 2017 23:47:23 +0000 (23:47 +0000)]
Update MIR testcase to reflect change in r309751.

rdar://problem/33580047

llvm-svn: 309769

7 years agoReland "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy"
Petr Hosek [Tue, 1 Aug 2017 23:46:33 +0000 (23:46 +0000)]
Reland "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy"

This change adds the "-O binary" flag which directs llvm-objcopy to
output the object file to the same format as GNU objcopy does when given
the flag "-O binary". This was done by splitting the Object class into
two subclasses ObjectELF and ObjectBianry which each output a different
format but relay on the same code to read in the Object in Object.

Patch by Jake Ehrlich

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

llvm-svn: 309768

7 years ago[AMDGPU] Turn s_and_saveexec_b64 into s_and_b64 if result is unused
Stanislav Mekhanoshin [Tue, 1 Aug 2017 23:44:35 +0000 (23:44 +0000)]
[AMDGPU] Turn s_and_saveexec_b64 into s_and_b64 if result is unused

With SI_END_CF elimination for some nested control flow we can now
eliminate saved exec register completely by turning a saveexec version
of instruction into just a logical instruction.

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

llvm-svn: 309766

7 years agoRemove unused accessor (NFC)
Adrian Prantl [Tue, 1 Aug 2017 23:16:36 +0000 (23:16 +0000)]
Remove unused accessor (NFC)

rdar://problem/33580047

llvm-svn: 309763

7 years ago[AMDGPU] Collapse adjacent SI_END_CF
Stanislav Mekhanoshin [Tue, 1 Aug 2017 23:14:32 +0000 (23:14 +0000)]
[AMDGPU] Collapse adjacent SI_END_CF

Add a pass to remove redundant S_OR_B64 instructions enabling lanes in
the exec. If two SI_END_CF (lowered as S_OR_B64) come together without any
vector instructions between them we can only keep outer SI_END_CF, given
that CFG is structured and exec bits of the outer end statement are always
not less than exec bit of the inner one.

This needs to be done before the RA to eliminate saved exec bits registers
but after register coalescer to have no vector registers copies in between
of different end cf statements.

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

llvm-svn: 309762

7 years agoAssert that the offset of a MachineLocation is always 0.
Adrian Prantl [Tue, 1 Aug 2017 22:57:05 +0000 (22:57 +0000)]
Assert that the offset of a MachineLocation is always 0.
This is to convince me that it may safely be removed in a follow-up commit.

rdar://problem/33580047

llvm-svn: 309761

7 years ago[sanitizer_common] Fuchsia-specific symbolizer
Vitaly Buka [Tue, 1 Aug 2017 22:54:51 +0000 (22:54 +0000)]
[sanitizer_common] Fuchsia-specific symbolizer

Summary:
Fuchsia doesn't support built-in symbolization per se at all.
Instead, it always emits a Fuchsia-standard "symbolizer markup"
format that makes it possible for a post-processing filter to
massage the logs into symbolized format.  Hence, it does not
support user-specified formatting options for backtraces or other
symbolization.

Reviewers: vitalybuka, alekseyshl, kcc

Subscribers: kubamracek, mgorny, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309760

7 years ago[SCEV/IndVars] Always compute loop exiting values if the backedge count is 0
Sanjoy Das [Tue, 1 Aug 2017 22:37:58 +0000 (22:37 +0000)]
[SCEV/IndVars] Always compute loop exiting values if the backedge count is 0

If SCEV can prove that the backedge taken count for a loop is zero, it does not
need to "understand" a recursive PHI to compute its exiting value.

This should fix PR33885.

llvm-svn: 309758

7 years agoUse helper function instead of manually constructing DBG_VALUEs (NFC)
Adrian Prantl [Tue, 1 Aug 2017 22:37:35 +0000 (22:37 +0000)]
Use helper function instead of manually constructing DBG_VALUEs (NFC)

rdar://problem/33580047

llvm-svn: 309757

7 years ago[sanitizer_common] Fuchsia OS support code
Vitaly Buka [Tue, 1 Aug 2017 22:22:25 +0000 (22:22 +0000)]
[sanitizer_common] Fuchsia OS support code

Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: vitalybuka

Subscribers: cryptoad, srhines, kubamracek, mgorny, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309756

7 years agoARM: Do not use llc -march in tests.
Matthias Braun [Tue, 1 Aug 2017 22:20:49 +0000 (22:20 +0000)]
ARM: Do not use llc -march in tests.

`llc -march` is problematic because it only switches the target
architecture, but leaves the operating system unchanged. This
occasionally leads to indeterministic tests because the OS from
LLVM_DEFAULT_TARGET_TRIPLE is used.

However we can simply always use `llc -mtriple` instead. This changes
all the tests to do this to avoid people using -march when they copy and
paste parts of tests.

See also the discussion in https://reviews.llvm.org/D35287

llvm-svn: 309755

7 years agoPowerPC: Do not use llc -march in tests.
Matthias Braun [Tue, 1 Aug 2017 22:20:41 +0000 (22:20 +0000)]
PowerPC: Do not use llc -march in tests.

`llc -march` is problematic because it only switches the target
architecture, but leaves the operating system unchanged. This
occasionally leads to indeterministic tests because the OS from
LLVM_DEFAULT_TARGET_TRIPLE is used.

However we can simply always use `llc -mtriple` instead. This changes
all the tests to do this to avoid people using -march when they copy and
paste parts of tests.

This patch:
- Removes -march if the .ll file already has a matching `target triple`
  directive or -mtriple argument.
- In all other cases changes -march=ppc32/-march=ppc64 to
  -mtriple=ppc32--/-mtriple=ppc64--

See also the discussion in https://reviews.llvm.org/D35287

llvm-svn: 309754

7 years ago[ForwardOpTree] Execute canForwardTree also in release builds.
Michael Kruse [Tue, 1 Aug 2017 22:15:04 +0000 (22:15 +0000)]
[ForwardOpTree] Execute canForwardTree also in release builds.

Commit r309730 moved the call to canForwardTree into an assert(), even
though this function has side-effects if its DoIt parameter is true. To
avoid a warning in release builds, do an (void)Execution of its result
instead.

To avoid such confusion in the future, rename
canForwardTree() to forwardTree().

llvm-svn: 309753

7 years ago[Headers][Darwin] Allow #include_next<float.h> to work on Darwin prior to 10.7
Bruno Cardoso Lopes [Tue, 1 Aug 2017 22:10:36 +0000 (22:10 +0000)]
[Headers][Darwin] Allow #include_next<float.h> to work on Darwin prior to 10.7

This fixes PR31504 and it's a follow up from adding #include_next<float.h>
for Darwin in r289018.

rdar://problem/29856682

llvm-svn: 309752

7 years agoRemove PrologEpilogInserter's usage of DBG_VALUE's offset field
Adrian Prantl [Tue, 1 Aug 2017 21:45:24 +0000 (21:45 +0000)]
Remove PrologEpilogInserter's usage of DBG_VALUE's offset field

In the last half-dozen commits to LLVM I removed code that became dead
after removing the offset parameter from llvm.dbg.value gradually
proceeding from IR towards the backend. Before I can move on to
DwarfDebug and friends there is one last side-called offset I need to
remove:  This patch modifies PrologEpilogInserter's use of the
DBG_VALUE's offset argument to use a DIExpression instead. Because the
PrologEpilogInserter runs at the Machine level I had to play a little
trick with a named llvm.dbg.mir node to get the DIExpressions to print
in MIR dumps (which print the llvm::Module followed by the
MachineFunction dump).

I also had to add rudimentary DwarfExpression support to CodeView and
as a side-effect also fixed a bug (CodeViewDebug::collectVariableInfo
was supposed to give up on variables with complex DIExpressions, but
would fail to do so for fragments, which are also modeled as
DIExpressions).

With this last holdover removed we will have only one canonical way of
representing offsets to debug locations which will simplify the code
in DwarfDebug (and future versions of CodeViewDebug once it starts
handling more complex expressions) and make it easier to reason about.

This patch is NFC-ish: All test case changes are for assembler
comments and the binary output does not change.

rdar://problem/33580047
Differential Revision: https://reviews.llvm.org/D36125

llvm-svn: 309751

7 years ago[clang] Change the condition of unnecessary packed warning
Yan Wang [Tue, 1 Aug 2017 21:41:39 +0000 (21:41 +0000)]
[clang] Change the condition of unnecessary packed warning

Summary:
Change the condition of this unnecessary packed warning. The packed is unnecessary when
1. the alignment of the struct/class won't alter.
2. the size is unchanged.
3. the offset of each field is the same.

Remove all field-level warning.

Reviewers: chh, akyrtzi, rtrieu

Reviewed By: chh

Subscribers: rsmith, srhines, cfe-commits, xazax.hun

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

llvm-svn: 309750

7 years ago[sanitizer_common] Disable filesystem-related code for Fuchsia
Vitaly Buka [Tue, 1 Aug 2017 21:28:39 +0000 (21:28 +0000)]
[sanitizer_common] Disable filesystem-related code for Fuchsia

Summary:
Fuchsia doesn't support filesystem access per se at low level.
So it won't use any of the filesystem-oriented code in sanitizer_common.

Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: vitalybuka

Subscribers: kubamracek, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309749

7 years ago[AArch64] Fix a typo in isExtFreeImpl()
Haicheng Wu [Tue, 1 Aug 2017 21:26:45 +0000 (21:26 +0000)]
[AArch64] Fix a typo in isExtFreeImpl()

next => not

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

llvm-svn: 309748

7 years ago[llvm-cov] Allow specifying distinct architectures for each loaded binary
Vedant Kumar [Tue, 1 Aug 2017 21:23:26 +0000 (21:23 +0000)]
[llvm-cov] Allow specifying distinct architectures for each loaded binary

The coverage tool needs to know which slice to look at when it's handed
a universal binary. Some projects need to look at aggregate coverage
reports for a variety of slices in different binaries: this patch adds
support for these kinds of projects to llvm-cov.

rdar://problem/33579007

llvm-svn: 309747

7 years ago[Hexagon] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Tue, 1 Aug 2017 21:20:10 +0000 (21:20 +0000)]
[Hexagon] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 309746

7 years ago[sanitizer_common] Fuchsia support for interceptors
Vitaly Buka [Tue, 1 Aug 2017 21:15:19 +0000 (21:15 +0000)]
[sanitizer_common] Fuchsia support for interceptors

Summary:
Actually Fuchsia non-support for interceptors.  Fuchsia doesn't use
interceptors in the common sense at all.  Almost all system library
functions don't need interception at all, because the system
libraries are just themselves compiled with sanitizers enabled and
have specific hook interfaces where needed to inform the sanitizer
runtime about thread lifetimes and the like.  For the few functions
that do get intercepted, they don't use a generic mechanism like
dlsym with RTLD_NEXT to find the underlying system library function.
Instead, they use specific extra symbol names published by the
system library (e.g. __unsanitized_memcpy).

Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc, filcab

Reviewed By: filcab

Subscribers: kubamracek, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309745

7 years ago[AArch64] Rewrite stack frame handling for win64 vararg functions
Martin Storsjo [Tue, 1 Aug 2017 21:13:54 +0000 (21:13 +0000)]
[AArch64] Rewrite stack frame handling for win64 vararg functions

The previous attempt, which made do with a single offset in
computeCalleeSaveRegisterPairs, wasn't quite enough. The previous
attempt only worked as long as CombineSPBump == true (since the
offset would be adjusted later in fixupCalleeSaveRestoreStackOffset).

Instead include the size for the fixed stack area used for win64
varargs in calculations in emitPrologue/emitEpilogue. The stack
consists of mainly three parts;
- AFI->getLocalStackSize()
- AFI->getCalleeSavedStackSize()
- FixedObject

Most of the places in the code which previously used the CSStackSize
now use PrologueSaveSize instead, which is the sum of the latter
two, while some cases which need exactly the middle one use
AFI->getCalleeSavedStackSize() explicitly instead of a local variable.

In addition to moving the offsetting into emitPrologue/emitEpilogue
(which fixes functions with CombineSPBump == false), also set the
frame pointer to point to the right location, where the frame pointer
and link register actually are stored. In addition to the prologue/epilogue,
this also requires changes to resolveFrameIndexReference.

Add tests for a function that keeps a frame pointer and another one
that uses a VLA.

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

llvm-svn: 309744

7 years agoAMDGPU: Fix handling of div_scale with undef inputs
Matt Arsenault [Tue, 1 Aug 2017 20:49:41 +0000 (20:49 +0000)]
AMDGPU: Fix handling of div_scale with undef inputs

The src0 register must match src1 or src2, but if these
were undefined they could end up using different implicit_defed
virtual registers. Force these to use one undef vreg or pick the
defined other register.

Also fixes producing invalid nodes without the right number of
inputs when src2 is undef.

llvm-svn: 309743

7 years ago[ubsan] Enable UBSan build for Fuchsia
Vitaly Buka [Tue, 1 Aug 2017 20:48:36 +0000 (20:48 +0000)]
[ubsan] Enable UBSan build for Fuchsia

Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: vitalybuka

Subscribers: srhines, kubamracek, mgorny, phosek, filcab, llvm-commits

Tags: #sanitizers

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

llvm-svn: 309742

7 years agoFix creating bitcasts with wrong address space
Matt Arsenault [Tue, 1 Aug 2017 20:36:57 +0000 (20:36 +0000)]
Fix creating bitcasts with wrong address space

In a future commit AMDGPU will start passing
aggregates directly to more functions, triggering
asserts in test/CodeGenOpenCL/addr-space-struct-arg.cl

llvm-svn: 309741

7 years ago[DAG] Factor out common expressions. NFC.
Nirav Dave [Tue, 1 Aug 2017 20:30:52 +0000 (20:30 +0000)]
[DAG] Factor out common expressions. NFC.

llvm-svn: 309740

7 years ago[Value Tracking] Default argument to true and rename accordingly. NFC.
Chad Rosier [Tue, 1 Aug 2017 20:18:54 +0000 (20:18 +0000)]
[Value Tracking] Default argument to true and rename accordingly. NFC.

IMHO this is a bit more readable.

llvm-svn: 309739

7 years ago[clang-diff] Renames, NFC
Johannes Altmanninger [Tue, 1 Aug 2017 20:17:46 +0000 (20:17 +0000)]
[clang-diff] Renames, NFC

llvm-svn: 309738

7 years ago[clang-diff] Move data declarations to the public header
Johannes Altmanninger [Tue, 1 Aug 2017 20:17:40 +0000 (20:17 +0000)]
[clang-diff] Move data declarations to the public header

llvm-svn: 309737

7 years ago[Simplify] Rewrite redundant write detection algorithm.
Michael Kruse [Tue, 1 Aug 2017 20:01:34 +0000 (20:01 +0000)]
[Simplify] Rewrite redundant write detection algorithm.

The previous algorithm was to search a writes and the sours of its value
operand, and see whether the write just stores the same read value back,
which includes a search whether there is another write access between
them. This is O(n^2) in the max number of accesses in a statement
(+ the complexity of isl comparing the access functions).

The new algorithm is more similar to the one used for searching for
overwrites and coalescable writes. It scans over all accesses in order
of execution while tracking which array elements still have the same
value since it was read. This is O(n), not counting the complexity
within isl. It should be more reliable than trying to catch all
non-conforming cases in the previous approach. It is also less code.

We now also support if the write is a partial write of the read's
domain, and to some extent non-affine subregions.

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

llvm-svn: 309734

7 years agoAMDGPU: Add test for r308774
Matt Arsenault [Tue, 1 Aug 2017 19:54:58 +0000 (19:54 +0000)]
AMDGPU: Add test for r308774

llvm-svn: 309733

7 years agoAMDGPU: Initial implementation of calls
Matt Arsenault [Tue, 1 Aug 2017 19:54:18 +0000 (19:54 +0000)]
AMDGPU: Initial implementation of calls

Includes a hack to fix the type selected for
the GlobalAddress of the function, which will be
fixed by changing the default datalayout to use
generic pointers for 0.

llvm-svn: 309732

7 years agoRevert "Thread Safety Analysis: fix assert_capability."
Josh Gao [Tue, 1 Aug 2017 19:53:31 +0000 (19:53 +0000)]
Revert "Thread Safety Analysis: fix assert_capability."

This reverts commit rL309725.

Broke test/Sema/attr-capabilities.c.

llvm-svn: 309731

7 years agoSilence -Wunused-variable warning in NDEBUG builds
Reid Kleckner [Tue, 1 Aug 2017 19:53:01 +0000 (19:53 +0000)]
Silence -Wunused-variable warning in NDEBUG builds

llvm-svn: 309730

7 years ago[DebugInfo] Don't turn dbg.declare into DBG_VALUE for static allocas
Reid Kleckner [Tue, 1 Aug 2017 19:45:09 +0000 (19:45 +0000)]
[DebugInfo] Don't turn dbg.declare into DBG_VALUE for static allocas

Summary:
We already have information about static alloca stack locations in our
side table. Emitting instructions for them is inefficient, and it only
happens when the address of the alloca has been materialized within the
current block, which isn't often.

Reviewers: aprantl, probinson, dblaikie

Subscribers: jfb, dschuff, sbc100, jgravelle-google, hiraditya, llvm-commits, aheejin

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

llvm-svn: 309729

7 years ago[Simplify] Improve scalability.
Michael Kruse [Tue, 1 Aug 2017 19:39:11 +0000 (19:39 +0000)]
[Simplify] Improve scalability.

With a lot of reads and writes to the same array in a statement,
some isl sets that capture the state between access can become
complex such that isl takes more considerable time and memory
for operations on them.

The problems identified were:

- is_subset() takes considerable time with many disjoints in the
  arguments. We limit the number of disjoints to 4, any additional
  information is thrown away.

- subtract() can lead to many disjoints. We instead assume that any
  array element is possibly accessed, which removes all disjoints.

- subtract_domain() may lead to considerable processing, even if all
  elements are are to be removed. Instead, we remove determine and
  remove the affected spaces manually. No behaviour is changed.

llvm-svn: 309728

7 years agoUpdate to isl-0.18-809-gd5b4535
Tobias Grosser [Tue, 1 Aug 2017 19:37:50 +0000 (19:37 +0000)]
Update to isl-0.18-809-gd5b4535

This fixes some undefined behavior in the isl schedule tree code.

llvm-svn: 309727

7 years ago[Value Tracking] Refactor and/or logic into helper. NFC.
Chad Rosier [Tue, 1 Aug 2017 19:22:36 +0000 (19:22 +0000)]
[Value Tracking] Refactor and/or logic into helper. NFC.

llvm-svn: 309726

7 years agoThread Safety Analysis: fix assert_capability.
Josh Gao [Tue, 1 Aug 2017 19:18:05 +0000 (19:18 +0000)]
Thread Safety Analysis: fix assert_capability.

Summary:
Previously, the assert_capability attribute was completely ignored by
thread safety analysis.

Reviewers: delesley, rnk

Reviewed By: delesley

Subscribers: cfe-commits

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

llvm-svn: 309725

7 years ago[CMake] Include sancov tool in Fuchsia toolchain
Petr Hosek [Tue, 1 Aug 2017 19:15:32 +0000 (19:15 +0000)]
[CMake] Include sancov tool in Fuchsia toolchain

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

llvm-svn: 309724

7 years ago[AMDGPU] Put a function used only inside assert() under NDEBUG.
Davide Italiano [Tue, 1 Aug 2017 19:07:20 +0000 (19:07 +0000)]
[AMDGPU] Put a function used only inside assert() under NDEBUG.

llvm-svn: 309723

7 years ago[Sema] Fix lax conversion between non ext vectors
Bruno Cardoso Lopes [Tue, 1 Aug 2017 19:05:25 +0000 (19:05 +0000)]
[Sema] Fix lax conversion between non ext vectors

r282968 introduced a regression due to the lack of proper testing.
Re-add lax conversion support between non ext vectors for compound
assignments and add a test for that.

rdar://problem/28639467

llvm-svn: 309722

7 years ago[lanai] Add getIntImmCost in LanaiTargetTransformInfo.
Jacques Pienaar [Tue, 1 Aug 2017 18:40:08 +0000 (18:40 +0000)]
[lanai] Add getIntImmCost in LanaiTargetTransformInfo.

Add simple int immediate cost function.

llvm-svn: 309721

7 years ago[clangd] Fix more MSVC compilation failures.
Ilya Biryukov [Tue, 1 Aug 2017 18:27:58 +0000 (18:27 +0000)]
[clangd] Fix more MSVC compilation failures.

It turns out MSVC does not allow non-copyable classes in std::future
and std::promise template arguments.

llvm-svn: 309720

7 years agoPull out VectorNumElements value. NFC.
Nirav Dave [Tue, 1 Aug 2017 18:19:56 +0000 (18:19 +0000)]
Pull out VectorNumElements value. NFC.

llvm-svn: 309719

7 years ago[X86][SSE3] Add scheduler tests for MONITOR/MWAIT
Simon Pilgrim [Tue, 1 Aug 2017 18:16:44 +0000 (18:16 +0000)]
[X86][SSE3] Add scheduler tests for MONITOR/MWAIT

llvm-svn: 309718

7 years agoRevert "[DAG] Extend visitSCALAR_TO_VECTOR optimization to truncated vector."
Nirav Dave [Tue, 1 Aug 2017 18:09:25 +0000 (18:09 +0000)]
Revert "[DAG] Extend visitSCALAR_TO_VECTOR optimization to truncated vector."

This reverts commit r309680 which appears to be raising an assertion
in the test-suite.

llvm-svn: 309717

7 years ago[libFuzzer] temporarty remove pc-tables and disable test/fuzzer-printcovpcs.test...
Kostya Serebryany [Tue, 1 Aug 2017 18:02:19 +0000 (18:02 +0000)]
[libFuzzer] temporarty remove pc-tables and disable test/fuzzer-printcovpcs.test until this can be fixed on Windows

llvm-svn: 309716

7 years ago[X86][SSE] Added missing vector logic intrinsic schedules
Simon Pilgrim [Tue, 1 Aug 2017 17:51:20 +0000 (17:51 +0000)]
[X86][SSE] Added missing vector logic intrinsic schedules

Improves atom scheduler test coverage (to make it easier to upgrade them for PR32431).

Merged SSE_VEC_BIT_ITINS_P + SSE_BIT_ITINS_P as we were interchanging between them.

llvm-svn: 309715

7 years agoxfail test_get_process_info pending bot fixes
Sean Callanan [Tue, 1 Aug 2017 17:43:54 +0000 (17:43 +0000)]
xfail test_get_process_info pending bot fixes

llvm-svn: 309714

7 years agoclang-format: [JS] no whitespace between typeof operator and l_paren.
Martin Probst [Tue, 1 Aug 2017 17:42:16 +0000 (17:42 +0000)]
clang-format: [JS] no whitespace between typeof operator and l_paren.

llvm-svn: 309713

7 years agoclang-format: [JS] prefer wrapping chains over empty literals.
Martin Probst [Tue, 1 Aug 2017 17:35:57 +0000 (17:35 +0000)]
clang-format: [JS] prefer wrapping chains over empty literals.

Summary:
E.g. don't wrap like this:

    (foo.bar.baz).and.bam(Blah.of({
    }))

But rather:

    (foo.bar.baz)
        .and.bam(Blah.of({}))

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 309712

7 years ago[CGP] use narrower types in memcmp expansion when possible
Sanjay Patel [Tue, 1 Aug 2017 17:24:54 +0000 (17:24 +0000)]
[CGP] use narrower types in memcmp expansion when possible

This only affects very small memcmp on x86 for now, but it
will become more important if we allow vector-sized load and
compares.

llvm-svn: 309711

7 years agoclang-format: [JS] whitespace between keywords and parenthesized expressions.
Martin Probst [Tue, 1 Aug 2017 17:22:15 +0000 (17:22 +0000)]
clang-format: [JS] whitespace between keywords and parenthesized expressions.

Summary: `throw (...)` should have a whitespace following it, as do await and void.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 309710

7 years agoRemember to make API headers Public in the LLDB target.
Jim Ingham [Tue, 1 Aug 2017 17:19:59 +0000 (17:19 +0000)]
Remember to make API headers Public in the LLDB target.

llvm-svn: 309709

7 years ago[DAG] Convert extload check to equivalent type check. NFC.
Nirav Dave [Tue, 1 Aug 2017 17:19:41 +0000 (17:19 +0000)]
[DAG] Convert extload check to equivalent type check. NFC.

Replace check with check that consuming store has the same type.

llvm-svn: 309708

7 years agoclang-format: [JS] handle union types in arrow functions.
Martin Probst [Tue, 1 Aug 2017 17:19:32 +0000 (17:19 +0000)]
clang-format: [JS] handle union types in arrow functions.

Summary: clang-format would previously fail to detect that an arrow functions parameter block is not an expression, and thus insert whitespace around the `|` and `&` type operators in it.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 309707

7 years ago[X86] Use BEXTR/BEXTRI for 64-bit 'and' with a large mask
Craig Topper [Tue, 1 Aug 2017 17:18:14 +0000 (17:18 +0000)]
[X86] Use BEXTR/BEXTRI for 64-bit 'and' with a large mask

Summary: The 64-bit 'and' with immediate instruction only supports a 32-bit immediate. So for larger constants we have to load the constant into a register first. If the immediate happens to be a mask we can use the BEXTRI instruction to perform the masking. We already do something similar using the BZHI instruction from the BMI2 instruction set.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 309706

7 years ago[clangd] Fixed MSVC compilation failures.
Ilya Biryukov [Tue, 1 Aug 2017 17:17:37 +0000 (17:17 +0000)]
[clangd] Fixed MSVC compilation failures.

llvm-svn: 309705

7 years agoRevert rL309634 until upstream buildbots have upgraded libc.
Sterling Augustine [Tue, 1 Aug 2017 17:16:05 +0000 (17:16 +0000)]
Revert rL309634 until upstream buildbots have upgraded libc.

llvm-svn: 309704

7 years agoclang-format: [JS] consistenly format enums.
Martin Probst [Tue, 1 Aug 2017 17:12:15 +0000 (17:12 +0000)]
clang-format: [JS] consistenly format enums.

Summary: Previously, const enums would get formatted differently because the modifier was not recognized.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 309703

7 years ago[build system] Add SBProcessInfo to the xcodeproj
Sean Callanan [Tue, 1 Aug 2017 17:08:46 +0000 (17:08 +0000)]
[build system] Add SBProcessInfo to the xcodeproj

llvm-svn: 309702

7 years ago[X86][SSE] Added missing PACKSS/PACKUS intrinsic schedules
Simon Pilgrim [Tue, 1 Aug 2017 16:47:48 +0000 (16:47 +0000)]
[X86][SSE] Added missing PACKSS/PACKUS intrinsic schedules

Improves atom scheduler test coverage (to make it easier to upgrade them for PR32431).

Checked on Agner that these actually match the UNPACK schedules, but better to include a separate class

llvm-svn: 309701

7 years ago[X86] Split bmi.ll into a bmi test and a bmi2 test.
Craig Topper [Tue, 1 Aug 2017 16:45:11 +0000 (16:45 +0000)]
[X86] Split bmi.ll into a bmi test and a bmi2 test.

This moves all the bmi2 specific intrinsics to a separate test file and adds a bmi1 only command line to the existing bmi test.

This will allow us to see the missed opportunity to use bextr to handle 64-bit 'and' with a large mask. This will be improved in an upcoming patch.

llvm-svn: 309700

7 years ago[X86][SSSE3] Added missing PHADDS/PHSUBS/PSIGN intrinsic schedules
Simon Pilgrim [Tue, 1 Aug 2017 16:18:25 +0000 (16:18 +0000)]
[X86][SSSE3] Added missing PHADDS/PHSUBS/PSIGN intrinsic schedules

llvm-svn: 309699

7 years ago[DAG] Move extload check in store merge. NFC.
Nirav Dave [Tue, 1 Aug 2017 16:00:47 +0000 (16:00 +0000)]
[DAG] Move extload check in store merge. NFC.

Move candidate check from later check to initial candidate check.

llvm-svn: 309698

7 years agoclang-format: [JS] support default imports.
Martin Probst [Tue, 1 Aug 2017 15:54:43 +0000 (15:54 +0000)]
clang-format: [JS] support default imports.

Summary: Formerly, `import {default as X} from y;` would not be recognized as an import.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 309697

7 years ago[clangd] Rewrote AST and Preamble management.
Ilya Biryukov [Tue, 1 Aug 2017 15:51:38 +0000 (15:51 +0000)]
[clangd] Rewrote AST and Preamble management.

Summary: The new implementation allows code completion that never waits for AST.

Reviewers: bkramer, krasimir, klimek

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 309696

7 years agoclang-format: [JS] handle object types in extends positions.
Martin Probst [Tue, 1 Aug 2017 15:46:10 +0000 (15:46 +0000)]
clang-format: [JS] handle object types in extends positions.

Summary:
clang-format would previously drop the whitespace after `extends` in code such as:

    class Foo extends {} {}

Where the first set of curly braces is an inline object literal type.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 309695

7 years ago[X86] Fix a crash in FEntryInserter Pass.
Manoj Gupta [Tue, 1 Aug 2017 15:39:12 +0000 (15:39 +0000)]
[X86] Fix a crash in FEntryInserter Pass.

Summary:
FEntryInserter pass unconditionally derefs the first Instruction
in the first Basic Block. The pass crashes when the first
BasicBlock is empty. Fix the crash by not dereferencing the basic
Block iterator. This fixes an issue observed when building Linux kernel
4.4 with clang.

Fixes PR33971.

Reviewers: hfinkel, niravd, dblaikie

Reviewed By: niravd

Subscribers: davide, llvm-commits

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

llvm-svn: 309694

7 years ago[AVX-512] Don't use unmasked VMOVDQU8/16 for 8-bit or 16-bit element stores even...
Craig Topper [Tue, 1 Aug 2017 15:31:24 +0000 (15:31 +0000)]
[AVX-512] Don't use unmasked VMOVDQU8/16 for 8-bit or 16-bit element stores even when BWI instructions are supported. Always use VMOVDQA32/VMOVDQU32.

We were already using the 32 bit element opcode if BWI isn't enabled, but there's no reason to change opcode if we have BWI. We will still use the 8/16 opcodes for masked stores though.

This allows us to use the aligned opcode when we can which makes our test output more consistent between different modes. It also reduces the number of isel patterns we need.

This is a slight inconsistency with loads which default to 64 bit element opcodes. I'll probably rectify that in a future patch.

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

llvm-svn: 309693

7 years ago[X86][SSSE3] Fix typos in pabsw/pmulhrsw tests for load folding scheduling.
Simon Pilgrim [Tue, 1 Aug 2017 15:31:24 +0000 (15:31 +0000)]
[X86][SSSE3] Fix typos in pabsw/pmulhrsw tests for load folding scheduling.

llvm-svn: 309692

7 years ago[X86] Added missing cpu to fix generic scheduling model tests
Simon Pilgrim [Tue, 1 Aug 2017 15:14:35 +0000 (15:14 +0000)]
[X86] Added missing cpu to fix generic scheduling model tests

llvm-svn: 309691

7 years ago[InstCombine] Remove explicit check for impossible condition. Replace with assert
Craig Topper [Tue, 1 Aug 2017 15:10:25 +0000 (15:10 +0000)]
[InstCombine] Remove explicit check for impossible condition. Replace with assert

Summary:
As far as I can tell the earlier call getLimitedValue will guaranteed ShiftAmt is saturated to BitWidth-1 preventing it from ever being equal or greater than BitWidth.

At one point in the past the getLimitedValue call was only passed BitWidth not BitWidth - 1. This would have allowed the equality case to get here. And in fact this check was initially added as just BitWidth == ShiftAmt, but was changed shortly after to include > which should have never been possible.

Reviewers: spatel, majnemer, davide

Reviewed By: davide

Subscribers: llvm-commits

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

llvm-svn: 309690

7 years ago[Tooling] Add LLVM_NODISCARD to Replacements::merge
Krasimir Georgiev [Tue, 1 Aug 2017 14:58:14 +0000 (14:58 +0000)]
[Tooling] Add LLVM_NODISCARD to Replacements::merge

Summary:
This patch adds LLVM_NODISCARD to Replacements::merge. I've hit this
several times already.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits

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

llvm-svn: 309689

7 years ago[ELF] - Use multithreading for building .gdb_index.
George Rimar [Tue, 1 Aug 2017 14:57:13 +0000 (14:57 +0000)]
[ELF] - Use multithreading for building .gdb_index.

Enables multithreaded .gdb_index building.

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

llvm-svn: 309688

7 years ago[globalisel][tablegen] Removed unnecessary typedef pointed out in post-commit review...
Daniel Sanders [Tue, 1 Aug 2017 14:55:34 +0000 (14:55 +0000)]
[globalisel][tablegen] Removed unnecessary typedef pointed out in post-commit review for r308599. NFC

llvm-svn: 309687

7 years ago[NFC] Add 'REQUIRES: pollyacc' on 'test/GPGPU/invariant-load-hoisting-of-array.ll'
Siddharth Bhat [Tue, 1 Aug 2017 14:52:18 +0000 (14:52 +0000)]
[NFC] Add 'REQUIRES: pollyacc' on 'test/GPGPU/invariant-load-hoisting-of-array.ll'

- Should fix broken build due to `r309681`.

llvm-svn: 309686

7 years agoDebugInfo: Update flag description that'd been copypasted from another
David Blaikie [Tue, 1 Aug 2017 14:50:50 +0000 (14:50 +0000)]
DebugInfo: Update flag description that'd been copypasted from another

Post-commit review feedback from Paul Robinson on r309630. Thanks Paul!

llvm-svn: 309685

7 years ago[PostDom] document the current handling of infinite loops and unreachables
Tobias Grosser [Tue, 1 Aug 2017 14:40:55 +0000 (14:40 +0000)]
[PostDom] document the current handling of infinite loops and unreachables

Summary:
As we are in the process of changing the behavior of how the post-dominator tree
is computed, make sure we have some more test coverage in this area.

Current inconsistencies:

  - Newly unreachable nodes are not added as new roots, in case the PDT is updated
    but not rebuilt.

  - Newly unreachable loops are not added to the CFG at all (neither when
    building from scratch nor when updating the CFG). This is inconsistent with
    the fact that unreachables are added to the PDT, but unreachable loops not.
    On the other side, PDT relationships are not loosened at the moment in
    cases where new unreachable loops are built.

This commit is providing additional test coverage for
https://reviews.llvm.org/D35851

Reviewers: dberlin, kuhar

Reviewed By: kuhar

Subscribers: llvm-commits

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

llvm-svn: 309684

7 years ago[DebugInfo] Use shrink_to_fit to simplify code. NFCI.
Benjamin Kramer [Tue, 1 Aug 2017 14:38:08 +0000 (14:38 +0000)]
[DebugInfo] Use shrink_to_fit to simplify code. NFCI.

llvm-svn: 309683

7 years ago[GPUJIT] Call `cuProfilerStop` before destroying the context to flush profiler cache.
Siddharth Bhat [Tue, 1 Aug 2017 14:36:24 +0000 (14:36 +0000)]
[GPUJIT] Call `cuProfilerStop` before destroying the context to flush profiler cache.

This is necessary to get accurate traces from `nvprof` / `nvcc`.
Otherwise, we lose some profiling information.

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

llvm-svn: 309682

7 years ago[PPCGCodeGeneration] Correct usage of llvm::Value with getLatestValue.
Siddharth Bhat [Tue, 1 Aug 2017 14:26:39 +0000 (14:26 +0000)]
[PPCGCodeGeneration] Correct usage of llvm::Value with getLatestValue.

It is possible that the `HostPtr` that coresponds to an array could be
invariant load hoisted. Make sure we use the invariant load hoisted
value by using `IslNodeBuilder::getLatestValue`.

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

llvm-svn: 309681

7 years ago[DAG] Extend visitSCALAR_TO_VECTOR optimization to truncated vector.
Nirav Dave [Tue, 1 Aug 2017 13:45:35 +0000 (13:45 +0000)]
[DAG] Extend visitSCALAR_TO_VECTOR optimization to truncated vector.

Summary:
Allow SCALAR_TO_VECTOR of EXTRACT_VECTOR_ELT to reduce to
EXTRACT_SUBVECTOR of vector shuffle when output is smaller. Marginally
improves vector shuffle computations.

Reviewers: efriedma, RKSimon, spatel

Subscribers: javed.absar, llvm-commits

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

llvm-svn: 309680

7 years ago[Mips] Fix for BBIT octeon instruction
Strahinja Petrovic [Tue, 1 Aug 2017 13:42:45 +0000 (13:42 +0000)]
[Mips] Fix for BBIT octeon instruction

This patch enables control flow optimization for
variations of BBIT instruction. In this case
optimization removes unnecessary branch after
BBIT instruction.

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

llvm-svn: 309679

7 years ago[OpenCL] Add missing subgroup builtins
Joey Gouly [Tue, 1 Aug 2017 13:27:09 +0000 (13:27 +0000)]
[OpenCL] Add missing subgroup builtins

This adds get_kernel_max_sub_group_size_for_ndrange and
get_kernel_sub_group_count_for_ndrange.

llvm-svn: 309678

7 years ago[Hexagon] Convert HVX vector constants of i1 to i8
Krzysztof Parzyszek [Tue, 1 Aug 2017 13:12:53 +0000 (13:12 +0000)]
[Hexagon] Convert HVX vector constants of i1 to i8

Certain operations require vector of i1 values. However, for Hexagon
architecture compatibility, they need to be represented as vector of i8.

Patch by Suyog Sarda.

llvm-svn: 309677