platform/upstream/llvm.git
7 years ago[sancov] Implement __sanitizer_cov_reset.
Evgeniy Stepanov [Thu, 27 Jul 2017 23:22:37 +0000 (23:22 +0000)]
[sancov] Implement __sanitizer_cov_reset.

Summary: Clears all collected coverage.

Reviewers: kcc

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 309333

7 years ago[llvm-pdbutil] Clean up ExitOnError usage to add ": " to our errors
Reid Kleckner [Thu, 27 Jul 2017 23:13:18 +0000 (23:13 +0000)]
[llvm-pdbutil] Clean up ExitOnError usage to add ": " to our errors

The banner parameter is supposed to end in a separator, like ": ".
Otherwise, we get ugly errors like:

Error while reading publics streamNative error: blah blah

llvm-svn: 309332

7 years ago[PDB] Initialize the std::array<ulittle32_t> used for the gsi bitmap
Reid Kleckner [Thu, 27 Jul 2017 23:13:05 +0000 (23:13 +0000)]
[PDB] Initialize the std::array<ulittle32_t> used for the gsi bitmap

With ASan, we would write about 512 bytes of malloc fill value to the
PDB, with some random bits ORed in here and there. Dumping the PDB would
always fail reliably.

llvm-svn: 309331

7 years ago[ConstantFolder] Don't try to fold gep when the idx is a vector.
Davide Italiano [Thu, 27 Jul 2017 22:20:44 +0000 (22:20 +0000)]
[ConstantFolder] Don't try to fold gep when the idx is a vector.

The code in ConstantFoldGetElementPtr() assumes integers, and
therefore it crashes trying to get the integer bidwith of a vector
type (in this case <4 x i32>. I just changed the code to prevent
the folding in case of vectors and I didn't bother to generalize
as this doesn't seem to me something that really happens in
practice, but I'm willing to change the patch if you think
it's worth it.
This is hard to trigger from -instsimplify or -instcombine
only as the second instruction is dead, so the test uses loop-unroll.

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

llvm-svn: 309330

7 years agoAdd a test.
Rafael Espindola [Thu, 27 Jul 2017 22:08:11 +0000 (22:08 +0000)]
Add a test.

This would have found the error in r309252.

llvm-svn: 309329

7 years agoHeaders: fix _Unwind_{G,S}etGR for non-EHABI targets
Saleem Abdulrasool [Thu, 27 Jul 2017 21:56:25 +0000 (21:56 +0000)]
Headers: fix _Unwind_{G,S}etGR for non-EHABI targets

The EHABI definition was being inlined into the users even when EHABI
was not in use.  Adjust the condition to ensure that the right version
is defined.

llvm-svn: 309327

7 years agoAvoid warnings when asserts are disabled.
Rafael Espindola [Thu, 27 Jul 2017 21:42:42 +0000 (21:42 +0000)]
Avoid warnings when asserts are disabled.

llvm-svn: 309326

7 years ago[X86] Don't lie about legality to TLI's demanded bits.
Ahmed Bougacha [Thu, 27 Jul 2017 21:28:59 +0000 (21:28 +0000)]
[X86] Don't lie about legality to TLI's demanded bits.

Like r309323, X86 had a typo where it passed the wrong flags to TLO.

Found by inspection; I haven't been able to tickle this into having
observable behavior.  I don't think it does, given that X86 doesn't have
custom demanded bits logic, and the generic logic doesn't have a lot of
exposure to illegal constructs.

llvm-svn: 309325

7 years ago[AArch64] Remove outdated comment. NFC.
Ahmed Bougacha [Thu, 27 Jul 2017 21:27:58 +0000 (21:27 +0000)]
[AArch64] Remove outdated comment. NFC.

There hasn't been a ternary since r231987.

llvm-svn: 309324

7 years ago[AArch64] Fix legality info passed to demanded bits for TBI opt.
Ahmed Bougacha [Thu, 27 Jul 2017 21:27:25 +0000 (21:27 +0000)]
[AArch64] Fix legality info passed to demanded bits for TBI opt.

The (seldom-used) TBI-aware optimization had a typo lying dormant since
it was first introduced, in r252573:  when asking for demanded bits, it
told TLI that it was running after legalize, where the opposite was
true.

This is an important piece of information, that the demanded bits
analysis uses to make assumptions about the node.  r301019 added such an
assumption, which was broken by the TBI combine.

Instead, pass the correct flags to TLO.

llvm-svn: 309323

7 years ago[libcxx] [test] Remove an unused local typedef in enable_shared_from_this.pass.cpp.
Stephan T. Lavavej [Thu, 27 Jul 2017 21:16:37 +0000 (21:16 +0000)]
[libcxx] [test] Remove an unused local typedef in enable_shared_from_this.pass.cpp.

Trivial change, committed without review.

llvm-svn: 309322

7 years ago[OCaml] Fix undefined reference to LLVMDumpType() with NDEBUG
Michal Gorny [Thu, 27 Jul 2017 21:13:25 +0000 (21:13 +0000)]
[OCaml] Fix undefined reference to LLVMDumpType() with NDEBUG

Account for the possibility of LLVMDumpType() not being available with
NDEBUG in the OCaml bindings. If it is not built into LLVM, make
the dump function raise an exception.

Since rL293359, the dump functions are built only if either NDEBUG is
not defined, or LLVM_ENABLE_DUMP is defined. As a result, if the dump
functions are not built in LLVM, the dynamic OCaml libraries fail to
load due to undefined LLVMDumpType symbol.

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

llvm-svn: 309321

7 years ago[OCaml] Respect CMAKE_C_FLAGS for OCaml C files
Michal Gorny [Thu, 27 Jul 2017 21:13:19 +0000 (21:13 +0000)]
[OCaml] Respect CMAKE_C_FLAGS for OCaml C files

Pass the values of CMAKE_C_FLAGS and CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}
as -ccopt to ocamlc. This enforces the specific flags used for the LLVM
build to be used for OCaml bindings as well, notably -O and -march
flags.

This also solves the issue of the user being unable to force specific
flags for OCaml bindings builds. Gentoo needs this to enforce -DNDEBUG
consistently between the LLVM build and the split OCaml bindings build.

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

llvm-svn: 309320

7 years agoFix implementation of OMP_THREAD_LIMIT
Jonathan Peyton [Thu, 27 Jul 2017 20:58:41 +0000 (20:58 +0000)]
Fix implementation of OMP_THREAD_LIMIT

This change fixes the implementation of OMP_THREAD_LIMIT. The implementation of
this previously was not restricted to a contention group (but it should be,
according to the spec), and this is fixed here. A field is added to root thread
to store a counter of the threads in the contention group. An extra check is
added when reserving threads for a parallel region that checks this variable and
compares to threadlimit-var, which is implemented as a new global variable,
kmp_cg_max_nth. Associated settings changes were also made, and clean up of
comments that referred to OMP_THREAD_LIMIT, but should refer to the new
KMP_DEVICE_THREAD_LIMIT (added in an earlier patch).

Patch by Terry Wilmarth

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

llvm-svn: 309319

7 years agoRevert "[sanitizers] Sanitizer tests CMake clean up"
George Karpenkov [Thu, 27 Jul 2017 20:44:33 +0000 (20:44 +0000)]
Revert "[sanitizers] Sanitizer tests CMake clean up"

This reverts commit 0ab44db2aa1cd3710355ad79b04f954ce68c0b3a.

Fails on some bots, reverting until I can fix it.

llvm-svn: 309318

7 years agoAdd test to reject merging of empty manifest.
Eric Beckmann [Thu, 27 Jul 2017 19:58:12 +0000 (19:58 +0000)]
Add test to reject merging of empty manifest.

Reviewers: ruiu, rnk

Subscribers: llvm-commits

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

llvm-svn: 309317

7 years ago[ARM] Add use-misched feature, to enable the MachineScheduler.
Florian Hahn [Thu, 27 Jul 2017 19:56:44 +0000 (19:56 +0000)]
[ARM] Add use-misched feature, to enable the MachineScheduler.

Summary:
This change makes it easier to experiment with the MachineScheduler in
the ARM backend and also makes it very explicit which CPUs use the
MachineScheduler (currently only swift and cyclone).

Reviewers: MatzeB, t.p.northover, javed.absar

Reviewed By: MatzeB

Subscribers: aemerson, kristof.beyls, llvm-commits

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

llvm-svn: 309316

7 years agoChange prefix in vector-shuffle-combining-avx.patch to reduce test size.
Dinar Temirbulatov [Thu, 27 Jul 2017 19:47:35 +0000 (19:47 +0000)]
Change prefix in vector-shuffle-combining-avx.patch to reduce test size.

llvm-svn: 309315

7 years ago[Headers] Add a test for arm64intr.h
Martin Storsjo [Thu, 27 Jul 2017 19:45:13 +0000 (19:45 +0000)]
[Headers] Add a test for arm64intr.h

This tests the ARM64 specific constants added in SVN r309081,
similar to the one added in r277928 for armintr.h.

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

llvm-svn: 309314

7 years ago[MergeFunctions] Remove alias support.
whitequark [Thu, 27 Jul 2017 19:36:13 +0000 (19:36 +0000)]
[MergeFunctions] Remove alias support.

The alias support was dead code since 2011. It was last touched
in r124182, where it was reintroduced after being removed
in r110434, and since then it was gated behind a HasGlobalAliases
flag that was permanently stuck as `false`.

It is also broken. I'm not sure if it bitrotted or was just broken
in the first place because it appears to have never been tested,
but the following IR results in a crash:

    define internal i32 @a(i32 %a, i32 %b) unnamed_addr {
      %c = add i32 %a, %b
      %d = xor i32 %a, %c
      ret i32 %c
    }

    define internal i32 @b(i32 %a, i32 %b) unnamed_addr {
      %c = add i32 %a, %b
      %d = xor i32 %a, %c
      ret i32 %c
    }

It seems safe to remove buggy untested code that no one cared about
for seven years.

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

llvm-svn: 309313

7 years ago[lit] Fix TestRunner unit test on Windows
Brian Gesiak [Thu, 27 Jul 2017 19:27:10 +0000 (19:27 +0000)]
[lit] Fix TestRunner unit test on Windows

Summary:
Normally Python converts all newline characters, Windows or Unix,
to Unix newlines when opening a file. However, lit opens files in
binary mode, which does not perform this conversion. As a result,
trailing Windows newlines are not stripped from test input, which
caused a failure in the TestRunner unit test:

```
FAIL: test_custom (__main__.TestIntegratedTestKeywordParser)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\bgesiak\src\llvm\llvm\utils\lit\tests\unit\TestRunner.py", line 109, in test_custom
    self.assertItemsEqual(value, ['a', 'b', 'c'])
AssertionError: Element counts were not equal:
First has 1, Second has 0: 'c\r'
First has 0, Second has 1:  'c'
```

Fix the discrepancy in behavior across the two platforms by
manually stripping Windows newlines before yielding each line in
the test file.

Reviewers: echristo, beanz, ddunbar, delcypher, rnk

Reviewed By: rnk

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 309312

7 years agoMerge OutputSectionCommand and OutputSection.
Rafael Espindola [Thu, 27 Jul 2017 19:22:43 +0000 (19:22 +0000)]
Merge OutputSectionCommand and OutputSection.

This is a bit of a hack, but it is *so* convenient.

Now that we create synthetic linker scripts when none is provided, we
always have to handle paired OutputSection and OutputsectionCommand and
keep a mapping from one to the other.

This patch simplifies things by merging them and creating what used to
be OutputSectionCommands really early.

llvm-svn: 309311

7 years agoUn-revert "Teach the CMake build system to run lit's test suite. These can be run"
Brian Gesiak [Thu, 27 Jul 2017 19:18:35 +0000 (19:18 +0000)]
Un-revert "Teach the CMake build system to run lit's test suite. These can be run"

Summary:
Depends on https://reviews.llvm.org/D35879.

This reverts rL257268, which in turn was a revert of rL257221.
https://reviews.llvm.org/D35879 marks the tests in the lit test suite
that fail on Windows as XFAIL, which should allow these tests to pass
on Windows-based buildbots.

Reviewers: delcypher, beanz, mgorny, jroelofs, rnk

Reviewed By: mgorny

Subscribers: rnk, ddunbar, george.karpenkov, llvm-commits

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

llvm-svn: 309310

7 years ago[OPENMP] Allow all lvalues in 'depend' clause.
Alexey Bataev [Thu, 27 Jul 2017 19:15:30 +0000 (19:15 +0000)]
[OPENMP] Allow all lvalues in 'depend' clause.

According to upcoming OpenMP 5.0 all addressable lvalue expressions are
allowed in deoend clause.

llvm-svn: 309309

7 years agoRevert r264998 and r265035.
Akira Hatanaka [Thu, 27 Jul 2017 18:52:44 +0000 (18:52 +0000)]
Revert r264998 and r265035.

r303175 made changes to have __cxa_allocate_exception return a 16-byte
aligned pointer, so it's no longer necessary to specify a lower
alignment (8-bytes) for exception objects on Darwin.

rdar://problem/32363695

llvm-svn: 309308

7 years agoDisable the deduction guide test I added in 309296 for the moment, while I figure...
Marshall Clow [Thu, 27 Jul 2017 18:47:35 +0000 (18:47 +0000)]
Disable the deduction guide test I added in 309296 for the moment, while I figure out which compilers don't support deduction guides

llvm-svn: 309307

7 years ago[sanitizers] Sanitizer tests CMake clean up
George Karpenkov [Thu, 27 Jul 2017 18:40:38 +0000 (18:40 +0000)]
[sanitizers] Sanitizer tests CMake clean up

This patch addresses two issues:

Most of the time, hacks with `if/else` in order to get support for
multi-configuration builds are superfluous.
The variable `CMAKE_CFG_INTDIR` was created precisely for this purpose: it
expands to `.`  on all single-configuration builds, and to a configuration
name otherwise.
The `if/else` hacks for the library name generation should also not be
done, as CMake has `TARGET_FILE` generator expression precisely for this
purpose, as it expands to the exact filename of the resulting target.

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

llvm-svn: 309306

7 years ago[FunctionImport] Prefer isa<> to dyn_cast<> as the value is not used.
Davide Italiano [Thu, 27 Jul 2017 18:38:09 +0000 (18:38 +0000)]
[FunctionImport] Prefer isa<> to dyn_cast<> as the value is not used.

This change makes GCC7 happy again.

llvm-svn: 309305

7 years ago[InstCombine] Simplify pointer difference subtractions (GEP-GEP) where GEPs have...
Hiroshi Yamauchi [Thu, 27 Jul 2017 18:27:11 +0000 (18:27 +0000)]
[InstCombine] Simplify pointer difference subtractions (GEP-GEP) where GEPs have other uses and one non-constant index

Summary:
Pointer difference simplifications currently happen only if input GEPs don't have other uses or their indexes are all constants, to avoid duplicating indexing arithmetic.

This patch enables cases with exactly one non-constant index among input GEPs to happen where there is no duplicated arithmetic or code size increase even if input GEPs have other uses.

For example, this patch allows "(&A[42][i]-&A[42][0])" --> "i", which didn't happen previously, if the input GEP(s) have other uses.

Reviewers: sanjoy, bkramer

Reviewed By: sanjoy

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 309304

7 years ago[PDB] Write public symbol records and the publics hash table
Reid Kleckner [Thu, 27 Jul 2017 18:25:59 +0000 (18:25 +0000)]
[PDB] Write public symbol records and the publics hash table

Summary:
MSVC link.exe records all external symbol names in the publics stream.
It provides similar functionality to an ELF .symtab.

Reviewers: zturner, ruiu

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 309303

7 years ago[SelectionDAG] Improve DAGTypeLegalizer::convertMask assertion (PR33960)
Simon Pilgrim [Thu, 27 Jul 2017 18:15:54 +0000 (18:15 +0000)]
[SelectionDAG] Improve DAGTypeLegalizer::convertMask assertion (PR33960)

Improve DAGTypeLegalizer::convertMask's isSETCCorConvertedSETCC assertion to properly check for any mixture of SETCC or BUILD_VECTOR of constants, or a logical mask op of them.

llvm-svn: 309302

7 years agoTiny docs fix
Hans Wennborg [Thu, 27 Jul 2017 18:14:00 +0000 (18:14 +0000)]
Tiny docs fix

llvm-svn: 309300

7 years ago[X86] SET0 to use XMM registers where possible PR26018 PR32862
Dinar Temirbulatov [Thu, 27 Jul 2017 17:47:01 +0000 (17:47 +0000)]
[X86] SET0 to use XMM registers where possible PR26018 PR32862

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

llvm-svn: 309298

7 years agoRelax the matching in these tests
Adam Nemet [Thu, 27 Jul 2017 17:45:02 +0000 (17:45 +0000)]
Relax the matching in these tests

Looks like the template arguments are displayed differently depending on the
host compiler(?).  E.g.:

InnerAnalysisManagerProxy<CGSCCAnalysisManager
InnerAnalysisManagerProxy<llvm::AnalysisManager<llvm::LazyCallGraph::SCC, ...

Fix fallout after r309294

llvm-svn: 309297

7 years agoImplement P0739R0: 'Some improvements to class template argument deduction integratio...
Marshall Clow [Thu, 27 Jul 2017 17:44:03 +0000 (17:44 +0000)]
Implement P0739R0: 'Some improvements to class template argument deduction integration into the standard library' This is an API change (not ABI change) due to a late change in the c++17 standard

llvm-svn: 309296

7 years ago[clangd] Don't reverse priorities of completion items.
Ilya Biryukov [Thu, 27 Jul 2017 17:43:07 +0000 (17:43 +0000)]
[clangd] Don't reverse priorities of completion items.

Summary: Current algorithm incorrectly provides completion results in a reverse order.

Reviewers: krasimir, bkramer

Reviewed By: krasimir

Subscribers: cfe-commits, klimek

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

llvm-svn: 309295

7 years ago[ICP] Migrate to OptimizationRemarkEmitter
Adam Nemet [Thu, 27 Jul 2017 16:54:15 +0000 (16:54 +0000)]
[ICP] Migrate to OptimizationRemarkEmitter

This is a module pass so for the old PM, we can't use ORE, the function
analysis pass.  Instead ORE is created on the fly.

A few notes:

- isPromotionLegal is folded in the caller since we want to emit the Function
in the remark but we can only do that if the symbol table look-up succeeded.

- There was good test coverage for remarks in this pass.

- promoteIndirectCall uses ORE conditionally since it's also used from
SampleProfile which does not use ORE yet.

Fixes PR33792.

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

llvm-svn: 309294

7 years ago[OptRemark] Allow streaming of 64-bit integers
Adam Nemet [Thu, 27 Jul 2017 16:54:13 +0000 (16:54 +0000)]
[OptRemark] Allow streaming of 64-bit integers

llvm-svn: 309293

7 years ago[lit] Fix order of checks in shtest-shell.py test
Brian Gesiak [Thu, 27 Jul 2017 16:50:40 +0000 (16:50 +0000)]
[lit] Fix order of checks in shtest-shell.py test

Summary:
An expectation in `utils/lit/tests/Inputs/shtest-shell/redirects.txt`
expects that first a string printed to stdout is seen, and then a
string printed to stderr. Add `flush()` calls to ensure that stdout is
printed before stderr, as expected.

Reviewers: rnk, mgorny, jroelofs

Reviewed By: rnk

Subscribers: llvm-commits

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

llvm-svn: 309292

7 years agoAll libcalls should be considered to be GC-leaf functions.
Daniel Neilson [Thu, 27 Jul 2017 16:49:39 +0000 (16:49 +0000)]
All libcalls should be considered to be GC-leaf functions.

Summary:
It is possible for some passes to materialize a call to a libcall (ex: ldexp, exp2, etc),
but these passes will not mark the call as a gc-leaf-function. All libcalls are
actually gc-leaf-functions, so we change llvm::callsGCLeafFunction() to tell us that
available libcalls are equivalent to gc-leaf-function calls.

Reviewers: sanjoy, anna, reames

Reviewed By: anna

Subscribers: llvm-commits

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

llvm-svn: 309291

7 years agoUpdate to use enum classes for various ARM *Kind enums
Florian Hahn [Thu, 27 Jul 2017 16:28:39 +0000 (16:28 +0000)]
Update to use enum classes for various ARM *Kind enums

Summary: This updates the relevant Clang parts for the LLVM change D35882.

Reviewers: rengolin, chandlerc, javed.absar, rovka

Reviewed By: rovka

Subscribers: aemerson, cfe-commits, kristof.beyls

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

llvm-svn: 309289

7 years agoFix double destruction of objects when OpenMP construct is canceled
Erich Keane [Thu, 27 Jul 2017 16:28:20 +0000 (16:28 +0000)]
Fix double destruction of objects when OpenMP construct is canceled

When an omp for loop is canceled the constructed objects are being destructed
twice.

It looks like the desired code is:

{

  Obj o;
  If (cancelled) branch-through-cleanups to cancel.exit.

}
[cleanups]
cancel.exit:

__kmpc_for_static_fini
br cancel.cont (*)

cancel.cont:

__kmpc_barrier
return

The problem seems to be the branch to cancel.cont is currently also going
through the cleanups calling them again. This change just does a direct branch
instead.

Patch By: michael.p.rice@intel.com

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

llvm-svn: 309288

7 years ago[TargetParser] Use enum classes for various ARM kind enums.
Florian Hahn [Thu, 27 Jul 2017 16:27:56 +0000 (16:27 +0000)]
[TargetParser] Use enum classes for various ARM kind enums.

Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.

FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.

Reviewers: rengolin, javed.absar, chandlerc, rovka

Reviewed By: rovka

Subscribers: aemerson, kristof.beyls, llvm-commits

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

llvm-svn: 309287

7 years ago[SLP] Outline code for the check that instruction users are part of
Alexey Bataev [Thu, 27 Jul 2017 15:48:44 +0000 (15:48 +0000)]
[SLP] Outline code for the check that instruction users are part of
vectorization tree, NFC.

llvm-svn: 309284

7 years ago[SelectionDAG] Avoid repeated calls to getNumOperands in for loop. NFCI.
Simon Pilgrim [Thu, 27 Jul 2017 15:42:21 +0000 (15:42 +0000)]
[SelectionDAG] Avoid repeated calls to getNumOperands in for loop. NFCI.

llvm-svn: 309283

7 years agoMake new PM honor -fdebug-info-for-profiling (clang side)
Dehao Chen [Thu, 27 Jul 2017 15:29:53 +0000 (15:29 +0000)]
Make new PM honor -fdebug-info-for-profiling (clang side)

Summary: The new PM needs to invoke add-discriminator pass when building with -fdebug-info-for-profiling.

Reviewers: chandlerc, davidxl

Reviewed By: chandlerc

Subscribers: sanjoy, cfe-commits

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

llvm-svn: 309282

7 years agoFix assert from r309278
David Blaikie [Thu, 27 Jul 2017 15:28:10 +0000 (15:28 +0000)]
Fix assert from r309278

llvm-svn: 309281

7 years agoremove redundant check
Adrian Prantl [Thu, 27 Jul 2017 15:24:20 +0000 (15:24 +0000)]
remove redundant check

llvm-svn: 309280

7 years agoThinLTO: Don't import aliases of any kind (even linkonce_odr)
David Blaikie [Thu, 27 Jul 2017 15:09:06 +0000 (15:09 +0000)]
ThinLTO: Don't import aliases of any kind (even linkonce_odr)

Summary:
Until a more advanced version of importing can be implemented for
aliases (one that imports an alias as an available_externally definition
of the aliasee), skip the narrow subset of cases that was possible but
came at a cost: aliases of linkonce_odr functions could be imported
because the linkonce_odr function could be safely duplicated from the
source module. This came/comes at the cost of not being able to 'home'
imported linkonce functions (they had to be emitted linkonce_odr in all
the destination modules (even if they weren't used by an alias) rather
than as available_externally - causing extra object size).

Tangentially, this also was the only reason ThinLTO would emit multiple
CUs in to the resulting DWARF - which happens to be a problem for
Fission (there's a fix for this in GDB but not released yet, etc).
(actually it's not the only reason - but I'm sending a patch to fix the
other reason shortly)

There's no reason to believe this particularly narrow alias importing
was especially/meaningfully important, only that it was /possible/ to
implement in this way. When a more general solution is done, it should
still satisfy the DWARF concerns above, since the import will still be
available_externally, and thus not create extra CUs.

Since now all aliases are treated the same, I removed/simplified some
test cases since they were testing corner cases where there are no
longer any corners.

Reviewers: tejohnson, mehdi_amini

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

llvm-svn: 309278

7 years ago[SelectionDAG] Tidyup mask creation. NFCI.
Simon Pilgrim [Thu, 27 Jul 2017 15:08:53 +0000 (15:08 +0000)]
[SelectionDAG] Tidyup mask creation. NFCI.

Assign all concat elements to UNDEF and then just replace the first element, instead of copying everything individually.

llvm-svn: 309277

7 years ago[clang-diff] Rename, NFC
Johannes Altmanninger [Thu, 27 Jul 2017 15:04:44 +0000 (15:04 +0000)]
[clang-diff] Rename, NFC

llvm-svn: 309276

7 years agoUpdate isl to isl-0.18-800-g4018f45
Tobias Grosser [Thu, 27 Jul 2017 14:48:02 +0000 (14:48 +0000)]
Update isl to isl-0.18-800-g4018f45

This fixes a bug in isl_flow where triggering the compute out could result in
undefined or unexpected behavior. This fixes some recent regressions we saw
in the android buildbots. Thanks Eli Friedman for reducing the corresponding
test cases.

llvm-svn: 309274

7 years ago[ScopBuilder/Simplify] Refactor isEscaping. NFC.
Michael Kruse [Thu, 27 Jul 2017 14:39:52 +0000 (14:39 +0000)]
[ScopBuilder/Simplify] Refactor isEscaping. NFC.

ScopBuilder and Simplify (through VirtualInstruction.cpp) previously
used this functionality in their own implementation. Refactor them
both into a common one into the Scop class.

BlockGenerator also makes use of a similiar functionality, but also
records outside users and takes place after region simplification.
Merging it as well would be more complicated.

llvm-svn: 309273

7 years ago[ARM] Mark labels in skipAlignedDPRCS2Spills as fallthrough (NFC).
Florian Hahn [Thu, 27 Jul 2017 14:37:17 +0000 (14:37 +0000)]
[ARM] Mark labels in skipAlignedDPRCS2Spills as fallthrough (NFC).

The comment at the top of the switch statement indicates that the
fall-through behavior is intentional. By using LLVM_FALLTHROUGH,
-Wimplicit-fallthrough are silenced, which is enabled by default in GCC
7.

llvm-svn: 309272

7 years ago[Simplify] Count PHINodes in simplifiable exit nodes as escaping use.
Michael Kruse [Thu, 27 Jul 2017 14:09:31 +0000 (14:09 +0000)]
[Simplify] Count PHINodes in simplifiable exit nodes as escaping use.

After region exit simplification, the incoming block of a phi node in
the SCoP region's exit block lands outside of the region. Since we
treat SCoPs as if this already happened, we need to account for that
when looking for outside uses of scalars (i.e. escaping scalars).

llvm-svn: 309271

7 years ago[OPENMP] Codegen for 'in_reduction' clause.
Alexey Bataev [Thu, 27 Jul 2017 13:20:36 +0000 (13:20 +0000)]
[OPENMP] Codegen for 'in_reduction' clause.

Added codegen for task-based directive with in_reduction clause.
```
<body>
```
The next code is emitted:
```
void *td;
...
td = call i8* @__kmpc_task_reduction_init();
...
<type> *priv = (<type> *)call i8* @__kmpc_task_reduction_get_th_data(i32
GTID, i8* td, i8* <orig>)
```

llvm-svn: 309270

7 years agoAdded cost of ZEROALL and ZEROUPPER instrs in btver2 cpu.
Andrew V. Tischenko [Thu, 27 Jul 2017 13:12:08 +0000 (13:12 +0000)]
Added cost of ZEROALL and ZEROUPPER instrs in btver2 cpu.
Differential Revision https://reviews.llvm.org/D35834

llvm-svn: 309269

7 years ago[InlineCost, NFC] Change CallAnalyzer::isGEPFree to use TTI::getUserCost instead...
Evgeny Astigeevich [Thu, 27 Jul 2017 12:49:27 +0000 (12:49 +0000)]
[InlineCost, NFC] Change CallAnalyzer::isGEPFree to use TTI::getUserCost instead of TTI::getGEPCost

Currently CallAnalyzer::isGEPFree uses TTI::getGEPCost to check if GEP is free.
TTI::getGEPCost cannot handle cases when GEPs participate in Def-Use dependencies
(see https://reviews.llvm.org/D31186 for example).
There is TTI::getUserCost which can calculate the cost more accurately by
taking dependencies into account.

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

llvm-svn: 309268

7 years ago[globalisel][tablegen] Ensure MatchTable's are compile-time constants with constexpr...
Daniel Sanders [Thu, 27 Jul 2017 12:47:31 +0000 (12:47 +0000)]
[globalisel][tablegen] Ensure MatchTable's are compile-time constants with constexpr. NFC.

This should prevent any re-occurence of the problem where the table was
initialized at run-time.

llvm-svn: 309267

7 years ago[X86][AVX] Regenerate shuffle tests with broadcast comments.
Simon Pilgrim [Thu, 27 Jul 2017 12:32:45 +0000 (12:32 +0000)]
[X86][AVX] Regenerate shuffle tests with broadcast comments.

llvm-svn: 309266

7 years agoXFAIL/XFlakey some tests what become very flakey on the Linux buildbot
Tamas Berghammer [Thu, 27 Jul 2017 12:01:32 +0000 (12:01 +0000)]
XFAIL/XFlakey some tests what become very flakey on the Linux buildbot

llvm-svn: 309265

7 years agoRe-commit: r309094 [globalisel][tablegen] Fuse the generated tables together.
Daniel Sanders [Thu, 27 Jul 2017 11:03:45 +0000 (11:03 +0000)]
Re-commit: r309094 [globalisel][tablegen] Fuse the generated tables together.

Summary:
Now that we have control flow in place, fuse the per-rule tables into a
single table. This is a compile-time saving at this point. However, this will
also enable the optimization of a table so that similar instructions can be
tested together, reducing the time spent on the matching the code.

This is NFC in terms of externally visible behaviour but some internals have
changed slightly. State.MIs is no longer reset between each rule that is
attempted because it's not necessary to do so. As a consequence of this the
restriction on the order that instructions are added to State.MIs has been
relaxed to only affect recorded instructions that require new elements to be
added to the vector. GIM_RecordInsn can now write to any element from 1 to
State.MIs.size() instead of just State.MIs.size().

The compile-time regressions from the last commit were caused by the ARM target
including a non-const variable (zero_reg) in the table and therefore generating
an initializer for it. That variable is now const.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, igorb, llvm-commits

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

llvm-svn: 309264

7 years ago[CodeGen][ARM] ARM runtime helper functions are not always soft-fp
Peter Smith [Thu, 27 Jul 2017 10:43:53 +0000 (10:43 +0000)]
[CodeGen][ARM] ARM runtime helper functions are not always soft-fp

Re-commit r309257 with less precise register checks in arm-float-helpers.c
test.

llvm-svn: 309263

7 years ago[X86] Adding test cases for LEA factorization (PR32755 / D35014)
Simon Pilgrim [Thu, 27 Jul 2017 10:36:09 +0000 (10:36 +0000)]
[X86] Adding test cases for LEA factorization (PR32755 / D35014)

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

llvm-svn: 309262

7 years ago[X86] Tidyup MaskedLoad/Store mask creation. NFCI.
Simon Pilgrim [Thu, 27 Jul 2017 10:29:04 +0000 (10:29 +0000)]
[X86] Tidyup MaskedLoad/Store mask creation. NFCI.

Assign all concat elements to zero and then just replace the first element, instead of setting them all to null and copying everything in.

llvm-svn: 309261

7 years ago[TTI] fixing a bug in the isLegalMaskedScatter API
Mohammed Agabaria [Thu, 27 Jul 2017 10:28:16 +0000 (10:28 +0000)]
[TTI] fixing a bug in the isLegalMaskedScatter API

isLegalMaskedScatter called the Gather version which is a bug.
use test case is provided within the patch of AVX2 gathers at: https://reviews.llvm.org/D35772

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

llvm-svn: 309260

7 years ago[CodeGen][ARM] Revert r309257
Peter Smith [Thu, 27 Jul 2017 09:57:13 +0000 (09:57 +0000)]
[CodeGen][ARM] Revert r309257

The test arm-float-helpers.c appears to be failing on some builders and
needs some work to make it more robust.

llvm-svn: 309259

7 years agoRevert r309252 "[ELF] - Fix missing relocation when linking executable with --unresol...
George Rimar [Thu, 27 Jul 2017 09:25:16 +0000 (09:25 +0000)]
Revert r309252 "[ELF] - Fix missing relocation when linking executable with --unresolved-symbols=ignore-all"

It broke bot:
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/4231

llvm-svn: 309258

7 years ago[CodeGen][ARM] ARM runtime helper functions are not always soft-fp
Peter Smith [Thu, 27 Jul 2017 09:21:41 +0000 (09:21 +0000)]
[CodeGen][ARM] ARM runtime helper functions are not always soft-fp

The ARM Runtime ABI document (IHI0043) defines the AEABI floating point
helper functions in 4.1.2 The floating-point helper functions. These
functions always use the base PCS (soft-fp). However helper functions
defined outside of this document such as the complex-number multiply and
divide helpers are not covered by this requirement and should use
hard-float PCS if the target is hard-float as both compiler-rt and libgcc
for a hard-float sysroot implement these functions with a hard-float PCS.

All of the floating point helper functions that are explicitly soft float
are expanded in the llvm ARM backend. This change makes clang not force the
BuiltinCC to AAPCS for AAPCS_VFP. With this change the ARM compiler-rt
tests involving _Complex pass with both hard-fp and soft-fp targets.

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

llvm-svn: 309257

7 years ago[PowerPC] Pass CPU to assembler with -no-integrated-as
Nemanja Ivanovic [Thu, 27 Jul 2017 08:58:28 +0000 (08:58 +0000)]
[PowerPC] Pass CPU to assembler with -no-integrated-as

This just adds the CPU to a list of commands passed to GAS when not using the
integrated assembler.

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

llvm-svn: 309256

7 years ago[PowerPC] enable optimizeCompareInstr for branch with static branch hint
Hiroshi Inoue [Thu, 27 Jul 2017 08:14:48 +0000 (08:14 +0000)]
[PowerPC] enable optimizeCompareInstr for branch with static branch hint

In optimizeCompareInstr, a compare instruction is eliminated by using a record form instruction if possible.
If the branch instruction that uses the result of the compare has a static branch hint, the optimization does not happen.
This patch makes this optimization happen regardless of the branch hint by splitting branch hint and branch condition before checking the predicate to identify the possible optimizations.

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

llvm-svn: 309255

7 years ago[ELD] - Sorted in ASCIIbetical order. NFC.
George Rimar [Thu, 27 Jul 2017 07:48:36 +0000 (07:48 +0000)]
[ELD] - Sorted in ASCIIbetical order. NFC.

llvm-svn: 309254

7 years ago[ELF] - Store PhdrEntry values by pointers instead of storing by value.
George Rimar [Thu, 27 Jul 2017 07:46:50 +0000 (07:46 +0000)]
[ELF] - Store PhdrEntry values by pointers instead of storing by value.

That is slightly more convinent as allows to store pointer on
program header entry in a more safe way.

Change was used in 2 patches currently on review.

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

llvm-svn: 309253

7 years ago[ELF] - Fix missing relocation when linking executable with --unresolved-symbols...
George Rimar [Thu, 27 Jul 2017 07:31:31 +0000 (07:31 +0000)]
[ELF] - Fix missing relocation when linking executable with --unresolved-symbols=ignore-all

This is PR32112. Previously when we linked executable with
--unresolved-symbols=ignore-all and undefined symbols, like:

_start:
callq und@PLT

we did not create relocations, though it looks in that case
we should delegate handling of such symbols to runtime linker,
hence should emit them. Patch fixes that.

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

llvm-svn: 309252

7 years agoRevert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""
Petr Hosek [Thu, 27 Jul 2017 06:02:05 +0000 (06:02 +0000)]
Revert "Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started""

This change is failing tests on Windows bots due to permissions.

This reverts commit r309249.

llvm-svn: 309251

7 years ago[LLDB][MIPS] Fix emulation of Instruction for MIPS64R6 target.
Nitesh Jain [Thu, 27 Jul 2017 05:34:33 +0000 (05:34 +0000)]
[LLDB][MIPS] Fix emulation of Instruction for MIPS64R6 target.

Subscribers: jaydeep, bhushan, lldb-commits, slthakur
llvm-svn: 309250

7 years agoReland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"
Petr Hosek [Thu, 27 Jul 2017 04:35:30 +0000 (04:35 +0000)]
Reland "[LLVM][llvm-objcopy] Added basic plumbing to get things started"

As discussed on llvm-dev I've implemented the first basic steps towards
llvm-objcopy/llvm-objtool (name pending).

This change adds the ability to copy (without modification) 64-bit
little endian ELF executables that have SHT_PROGBITS, SHT_NOBITS,
SHT_NULL and SHT_STRTAB sections.

Patch by Jake Ehrlich

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

llvm-svn: 309249

7 years ago[X86] Improve the unknown stepping support for Intel CPUs in getHostCPUName
Craig Topper [Thu, 27 Jul 2017 03:26:52 +0000 (03:26 +0000)]
[X86] Improve the unknown stepping support for Intel CPUs in getHostCPUName

This patch improves our guessing of unknown Intel CPUs to support Goldmont and skylake-avx512.

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

llvm-svn: 309246

7 years ago[Coverage] NFC: Simplify sanity checks with a SpellingRange utility
Vedant Kumar [Thu, 27 Jul 2017 02:20:25 +0000 (02:20 +0000)]
[Coverage] NFC: Simplify sanity checks with a SpellingRange utility

This should simplify D35925.

llvm-svn: 309245

7 years ago[Coverage] NFC: Save a pair of calls to get{Start,End}
Vedant Kumar [Thu, 27 Jul 2017 02:20:20 +0000 (02:20 +0000)]
[Coverage] NFC: Save a pair of calls to get{Start,End}

llvm-svn: 309244

7 years ago[GISel]: Missed passing in a parameter to addUsesFromArgs
Aditya Nandakumar [Thu, 27 Jul 2017 02:15:34 +0000 (02:15 +0000)]
[GISel]: Missed passing in a parameter to addUsesFromArgs

llvm-svn: 309243

7 years agoRemove check for i686.
Eric Beckmann [Thu, 27 Jul 2017 01:16:19 +0000 (01:16 +0000)]
Remove check for i686.

libxml2 is supported for 32 bit, so our build system should be checking
the target rather than native os when choosing shared libs.

llvm-svn: 309242

7 years agoRe-enable libxml2 tests.
Eric Beckmann [Thu, 27 Jul 2017 01:11:53 +0000 (01:11 +0000)]
Re-enable libxml2 tests.

llvm-svn: 309241

7 years ago[DWARF] Minor code style modification, no functionality change.
Spyridoula Gravani [Thu, 27 Jul 2017 00:59:33 +0000 (00:59 +0000)]
[DWARF] Minor code style modification, no functionality change.

llvm-svn: 309240

7 years agoAdd {Obj,Import,Bitcode}File::Instances to COFF input files.
Rui Ueyama [Thu, 27 Jul 2017 00:45:26 +0000 (00:45 +0000)]
Add {Obj,Import,Bitcode}File::Instances to COFF input files.

We did the same thing for ELF in r309152, and I want to maintain
COFF and ELF as close as possible.

llvm-svn: 309239

7 years agoFix the formatting for help on option value types.
Jim Ingham [Thu, 27 Jul 2017 00:18:18 +0000 (00:18 +0000)]
Fix the formatting for help on option value types.

Patch by Jessica Han <jessicah@juniper.net>

https://reviews.llvm.org/D35525

llvm-svn: 309238

7 years agoDebugInfo: Ensure imported entities at the top level of an inlined function don't...
David Blaikie [Thu, 27 Jul 2017 00:06:53 +0000 (00:06 +0000)]
DebugInfo: Ensure imported entities at the top level of an inlined function don't cause degenerate concrete definitions

Local imported entities at the top level of a subprogram were being
handled differently from those in nested scopes - that different
handling would cause pseudo concrete out-of-line definitions to be
created (but without any of their attributes, nor an abstract_origin) in
the case where there was no real concrete definition.

These local imported entities also only appeared in the concrete
definition where those imported entities in nested scopes appear in all
cases (abstract, concrete, and inlined). This change at least makes top
level case handle the same as the others - though there's a FIXME to
improve this to /only/ emit them into the abstract origin (though this
requires more plumbing - like the abstract subprogram and variable
handling that must defer population until the end of the unit to
discover if there is an abstract origin, or only a standalone concrete
definition).

llvm-svn: 309237

7 years ago[Hexagon] Fix expensive checks build bot broken in r309230.
Eugene Zelenko [Wed, 26 Jul 2017 23:56:29 +0000 (23:56 +0000)]
[Hexagon] Fix expensive checks build bot broken in r309230.

llvm-svn: 309236

7 years ago[CMake] Disable -Werror for CMake checks
Petr Hosek [Wed, 26 Jul 2017 23:49:18 +0000 (23:49 +0000)]
[CMake] Disable -Werror for CMake checks

-Werror may cause some of the CMake checks to fail, so we disable
it even if it's enabled for the build itself.

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

llvm-svn: 309235

7 years agoAdd --gc-sections to a test.
Rafael Espindola [Wed, 26 Jul 2017 23:47:24 +0000 (23:47 +0000)]
Add --gc-sections to a test.

This shows that the logic in --gc-sections is a bit more precise than
what can be easily done in LTO.

llvm-svn: 309234

7 years ago[Hexagon] Partially revert r309230 which caused some build bots failures.
Eugene Zelenko [Wed, 26 Jul 2017 23:45:28 +0000 (23:45 +0000)]
[Hexagon] Partially revert r309230 which caused some build bots failures.

llvm-svn: 309233

7 years agoMake __start_sec __end_sec handling more precise.
Rafael Espindola [Wed, 26 Jul 2017 23:39:10 +0000 (23:39 +0000)]
Make __start_sec __end_sec handling more precise.

With this we only ask LTO to keep a C named section if there is a
__start_ or __end symbol.

This is not as strict as lld's --gc-sections, but is as good as we can
get without having a far more detailed ir summary.

llvm-svn: 309232

7 years agolld: /manifestuac:no shouldn't disable /manifestdependency:
Nico Weber [Wed, 26 Jul 2017 23:38:10 +0000 (23:38 +0000)]
lld: /manifestuac:no shouldn't disable /manifestdependency:

Matches link.exe
https://reviews.llvm.org/D35872

llvm-svn: 309231

7 years ago[Hexagon] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Wed, 26 Jul 2017 23:20:35 +0000 (23:20 +0000)]
[Hexagon] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 309230

7 years agoSee if disabling libxml tests will pass the i686 bot.
Eric Beckmann [Wed, 26 Jul 2017 23:15:44 +0000 (23:15 +0000)]
See if disabling libxml tests will pass the i686 bot.

llvm-svn: 309229

7 years agoRename ObjectFile ObjFile for COFF as well.
Rui Ueyama [Wed, 26 Jul 2017 23:05:24 +0000 (23:05 +0000)]
Rename ObjectFile ObjFile for COFF as well.

llvm-svn: 309228

7 years ago[lit] Fix race between shtest-shell and max-failures tests
Reid Kleckner [Wed, 26 Jul 2017 22:57:32 +0000 (22:57 +0000)]
[lit] Fix race between shtest-shell and max-failures tests

Previously these tests would use the same Output directory leading to
flaky non-deterministic failures.

llvm-svn: 309227

7 years agoHeaders: improve ARM EHABI coverage of unwind.h
Saleem Abdulrasool [Wed, 26 Jul 2017 22:55:23 +0000 (22:55 +0000)]
Headers: improve ARM EHABI coverage of unwind.h

Ensure that we define the `_Unwind_Control_Block` structure used on ARM
EHABI targets.  This is needed for building libc++abi with the unwind.h
from the resource dir.  A minor fallout of this is that we needed to
create a typedef for _Unwind_Exception to work across ARM EHABI and
non-EHABI targets.  The structure definitions here are based originally
on the documentation from ARM under the "Exception Handling ABI for the
ARMĀ® Architecture" Section 7.2.  They are then adjusted to more closely
reflect the definition in libunwind from LLVM.  Those changes are
compatible in layout but permit easier use in libc++abi and help
maintain compatibility between libunwind and the compiler provided
definition.

llvm-svn: 309226

7 years agoFix the name of the section end symbol.
Rafael Espindola [Wed, 26 Jul 2017 22:52:53 +0000 (22:52 +0000)]
Fix the name of the section end symbol.

It is __stop_<sec>, not __end_<sec>.

llvm-svn: 309225

7 years ago[lit] Fix shtest-shell and max-failures lit tests on Windows
Reid Kleckner [Wed, 26 Jul 2017 22:21:25 +0000 (22:21 +0000)]
[lit] Fix shtest-shell and max-failures lit tests on Windows

Rewrite the write-to-stderr.sh and write-to-stdout-and-stderr.sh shell
scripts as python scripts and call python on them.

Fixes PR33940

llvm-svn: 309200