platform/upstream/llvm.git
5 years agoUse a data structure better suited for large sets in SimplificationTracker.
Ali Tamur [Mon, 12 Nov 2018 21:43:43 +0000 (21:43 +0000)]
Use a data structure better suited for large sets in SimplificationTracker.

Summary:
D44571 changed SimplificationTracker to use SmallSetVector to keep phi nodes. As a result, when the number of phi nodes is large, the build time performance suffers badly. When building for power pc, we have a case where there are more than 600.000 nodes, and it takes too long to compile.

In this change, I partially revert D44571 to use SmallPtrSet, which does an acceptable job with any number of elements. In the original patch, having a deterministic iteration order was mentioned as a motivation, however I think it only applies to the nodes already matched in MatchPhiSet method, which I did not touch.

Reviewers: bjope, skatkov

Reviewed By: bjope, skatkov

Subscribers: llvm-commits

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

llvm-svn: 346710

5 years ago[Sema] Make sure we substitute an instantiation-dependent default template argument
Erik Pilkington [Mon, 12 Nov 2018 21:31:06 +0000 (21:31 +0000)]
[Sema] Make sure we substitute an instantiation-dependent default template argument

Fixes llvm.org/PR39623

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

llvm-svn: 346709

5 years ago[lldb] Add synthetic frontend for _NSCallStackArray
Kuba Mracek [Mon, 12 Nov 2018 21:26:03 +0000 (21:26 +0000)]
[lldb] Add synthetic frontend for _NSCallStackArray

An Obj-C array type _NSCallStackArray is used in NSException backtraces. This patch adds a synthetic frontend for _NSCallStackArray, which now correctly returns frame PCs.

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

llvm-svn: 346708

5 years agoRe-land "Extract construction of DataBufferLLVM into FileSystem"
Jonas Devlieghere [Mon, 12 Nov 2018 21:24:50 +0000 (21:24 +0000)]
Re-land "Extract construction of DataBufferLLVM into FileSystem"

This fixes some UB in isLocal detected by the sanitized bot.

llvm-svn: 346707

5 years ago[X86][SSE] Add lowerVectorShuffleAsByteRotateAndPermute (PR39387)
Simon Pilgrim [Mon, 12 Nov 2018 21:12:38 +0000 (21:12 +0000)]
[X86][SSE] Add lowerVectorShuffleAsByteRotateAndPermute (PR39387)

This patch adds the ability to use a PALIGNR to rotate a pair of inputs to select a range containing all the referenced elements, followed by a single input permute to put them in the right location.

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

llvm-svn: 346706

5 years agoFix the 'fixit' for inline namespace replacement.
Erich Keane [Mon, 12 Nov 2018 21:08:41 +0000 (21:08 +0000)]
Fix the 'fixit' for inline namespace replacement.

I'd neglected to add to the fixit for r346677.  Richard Smith mentioned
this in a review-after-commit, so fixing it here.

Change-Id: I77e612be978d4eedda8d5bbd60b812b88f875cda
llvm-svn: 346705

5 years agoAMDGPU: Adding more median3 patterns
Aakanksha Patil [Mon, 12 Nov 2018 21:04:06 +0000 (21:04 +0000)]
AMDGPU: Adding more median3 patterns

min(max(a, b), max(min(a, b), c)) -> med3 a, b, c

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

llvm-svn: 346704

5 years ago[InstCombine] add more tests for rotate narrowing; NFC
Sanjay Patel [Mon, 12 Nov 2018 20:32:59 +0000 (20:32 +0000)]
[InstCombine] add more tests for rotate narrowing; NFC

llvm-svn: 346703

5 years ago[GC docs] Update the gcroot documentation to reflect recent simplifcations to GCStrat...
Philip Reames [Mon, 12 Nov 2018 20:30:50 +0000 (20:30 +0000)]
[GC docs] Update the gcroot documentation to reflect recent simplifcations to GCStrategy configurability

llvm-svn: 346702

5 years ago[GC] Remove so called PreCall safepoints
Philip Reames [Mon, 12 Nov 2018 20:15:34 +0000 (20:15 +0000)]
[GC] Remove so called PreCall safepoints

Remove another bit of unused configuration potential from GCStrategy.  It's not entirely clear what the intention here was, but from the docs, it sounds like this may have been subsumed by patchable call support.

Note: This change is deliberately small to make it clear that while implemented, there's nothing using the option.  A following NFC will do most of the simplifications.
llvm-svn: 346701

5 years ago[WebAssembly] Added WasmAsmParser.
Wouter van Oortmerssen [Mon, 12 Nov 2018 20:15:01 +0000 (20:15 +0000)]
[WebAssembly] Added WasmAsmParser.

Summary:
This is to replace the ELFAsmParser that WebAssembly was using, which
so far was a stub that didn't do anything, and couldn't work correctly
with wasm.

This new class is there to implement generic directives related to
wasm as a binary format. Wasm target specific directives are still
parsed in WebAssemblyAsmParser as before. The two classes now
cooperate more correctly too.

Also implemented .result which was missing. Any unknown directives
will now result in errors.

Reviewers: dschuff, sbc100

Subscribers: mgorny, jgravelle-google, eraman, aheejin, sunfish, llvm-commits

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

llvm-svn: 346700

5 years agoPR39628 Treat all non-zero values as 'true' in bool compound-assignment
Richard Smith [Mon, 12 Nov 2018 20:11:57 +0000 (20:11 +0000)]
PR39628 Treat all non-zero values as 'true' in bool compound-assignment
in constant evaluation, not just odd values.

llvm-svn: 346699

5 years ago[GC][InstCombine] Fix a potential iteration issue
Philip Reames [Mon, 12 Nov 2018 20:00:53 +0000 (20:00 +0000)]
[GC][InstCombine] Fix a potential iteration issue

Noticed via inspection.  Appears to be largely innocious in practice, but slight code change could have resulted in either visit order dependent missed optimizations or infinite loops.  May be a minor compile time problem today.

llvm-svn: 346698

5 years ago[X86] In LowerMULH, use generic truncate and vector shuffle nodes instead of directly...
Craig Topper [Mon, 12 Nov 2018 19:37:29 +0000 (19:37 +0000)]
[X86] In LowerMULH, use generic truncate and vector shuffle nodes instead of directly emitting PACKUS.

Truncate and shuffle lowering are already capable of matching to PACKUS using known bits analysis.

This features one test change where we now prefer to extend v16i16->v16i32 then trunc v16i32->v16i8 over extract_subvector+packus when avx512f is available, but avx512bw is not.

llvm-svn: 346697

5 years ago[NFC] Fix formatting in inline nested namespace definition.
Erich Keane [Mon, 12 Nov 2018 19:29:26 +0000 (19:29 +0000)]
[NFC] Fix formatting in inline nested namespace definition.

Apparently my invocation of clang-format in VIM didn't get this right,
but the patch-version DID. This patch just runs CF on this file.

Change-Id: Ied462a2d921cbb813fa427740d3ef6e97959b56d
llvm-svn: 346696

5 years ago[lldb] Extract more fields from NSException values
Kuba Mracek [Mon, 12 Nov 2018 19:12:31 +0000 (19:12 +0000)]
[lldb] Extract more fields from NSException values

This patch teaches LLDB about more fields on NSException Obj-C objects, specifically we can now retrieve the "name" and "reason" of an NSException. The goal is to eventually be able to have SB API that can provide details about the currently thrown/caught/processed exception.

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

llvm-svn: 346695

5 years agoRevert "Extract construction of DataBufferLLVM into FileSystem"
Davide Italiano [Mon, 12 Nov 2018 19:08:19 +0000 (19:08 +0000)]
Revert "Extract construction of DataBufferLLVM into FileSystem"

It broke the lldb sanitizer bots.

llvm-svn: 346694

5 years ago[lldb] Add "ninja" to svn:ignore
Kuba Mracek [Mon, 12 Nov 2018 19:06:15 +0000 (19:06 +0000)]
[lldb] Add "ninja" to svn:ignore

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

llvm-svn: 346693

5 years ago[lldb] Fix the typo (replace underscore with dash) in svn:ignore on test/ and add...
Kuba Mracek [Mon, 12 Nov 2018 19:05:16 +0000 (19:05 +0000)]
[lldb] Fix the typo (replace underscore with dash) in svn:ignore on test/ and add "lldb-test-build.noindex" to ignored files

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

llvm-svn: 346692

5 years agoNFC: DebugInfo: Reduce scope of DebugOffset to simplify code
David Blaikie [Mon, 12 Nov 2018 18:53:28 +0000 (18:53 +0000)]
NFC: DebugInfo: Reduce scope of DebugOffset to simplify code

This was being used as a sort of indirect out parameter from shouldDump
- seems simpler to use it as the actual result of the call. (this does
mean using a pointer to an Optional & actually using all 3 states (null,
None, and present) which is, admittedly, a tad subtle - but given the
limited scope, seems OK to me - open to discussion though, if others
feel strongly about it)

llvm-svn: 346691

5 years ago[AMDGPU] Optimize S_CBRANCH_VCC[N]Z -> S_CBRANCH_EXEC[N]Z
Stanislav Mekhanoshin [Mon, 12 Nov 2018 18:48:17 +0000 (18:48 +0000)]
[AMDGPU] Optimize S_CBRANCH_VCC[N]Z -> S_CBRANCH_EXEC[N]Z

Sometimes after basic block placement we end up with a code like:

  sreg = s_mov_b64 -1
  vcc = s_and_b64 exec, sreg
  s_cbranch_vccz

This happens as a join of a block assigning -1 to a saved mask and
another block which consumes that saved mask with s_and_b64 and a
branch.

This is essentially a single s_cbranch_execz instruction when moved
into a single new basic block.

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

llvm-svn: 346690

5 years ago[InstCombine] regenerate checks; NFC
Sanjay Patel [Mon, 12 Nov 2018 18:41:08 +0000 (18:41 +0000)]
[InstCombine] regenerate checks; NFC

llvm-svn: 346689

5 years ago[CostModel][X86] Add funnel shift rotation special case costs
Simon Pilgrim [Mon, 12 Nov 2018 18:27:54 +0000 (18:27 +0000)]
[CostModel][X86] Add funnel shift rotation special case costs

When we repeat the 2 shifting operands then this is a bit rotation - annoyingly this has to be done in the other getIntrinsicInstrCost than most intrinsics as we need to check the operands are the same.

llvm-svn: 346688

5 years ago[clang-format] Support breaking consecutive string literals for TableGen
Jordan Rupprecht [Mon, 12 Nov 2018 18:15:04 +0000 (18:15 +0000)]
[clang-format] Support breaking consecutive string literals for TableGen

Summary:
clang-format can get confused by string literals in TableGen: it knows that strings can be broken up, but doesn't seem to understand how that can be indented across line breaks, and arranges them in a weird triangular pattern. Take this output example from `clang-format tools/llvm-objcopy/ObjcopyOpts.td` (which has now been formatted in rL345896 with this patch applied):

```
defm keep_global_symbols
: Eq<
      "keep-global-symbols", "Reads a list of symbols from <filename> and "
                             "runs as if " "--keep-global-symbol=<symbol> "
                                           "is set for each one. "
                                           "<filename> " "contains one "
                                                         "symbol per line "
                                                         "and may contain "
                                                         "comments "
                                                         "beginning " "with"
                                                                      " '#'"
                                                                      ". "
                                                                      "Lead"
                                                                      "ing "
```

Reviewers: alexshap, MaskRay, djasper

Reviewed By: MaskRay

Subscribers: krasimir, mgorny, cfe-commits

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

llvm-svn: 346687

5 years agoFix MachineInstr::findRegisterUseOperandIdx subreg checks
Stanislav Mekhanoshin [Mon, 12 Nov 2018 18:12:28 +0000 (18:12 +0000)]
Fix MachineInstr::findRegisterUseOperandIdx subreg checks

The function only checks that instruction reads a super-register
containing requested physical register. In case if a sub-register
if being read that is also a use of a super-reg, so added the check.
In particular MI->readsRegister() is broken because of the missing
check. The resulting check is essentially regsOverlap().

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

llvm-svn: 346686

5 years ago[llvm-readelf] Make llvm-readelf more compatible with GNU readelf.
Jordan Rupprecht [Mon, 12 Nov 2018 18:02:38 +0000 (18:02 +0000)]
[llvm-readelf] Make llvm-readelf more compatible with GNU readelf.

Summary:
This change adds a bunch of options that GNU readelf supports. There is one breaking change when invoked as `llvm-readobj`, and three breaking changes when invoked as `llvm-readelf`:
 - Add --all (implies --file-header, --program-headers, etc.)
 - [Breaking] -a is --all instead of --arm-attributes
 - Add --file-header as an alias for --file-headers
 - Replace --sections with --sections-headers, keeping --sections as an alias for it
 - Add --relocs as an alias for --relocations
 - Add --dynamic as an alias for --dynamic-table
 - Add --segments as an alias for --program-headers
 - Add --section-groups as an alias for --elf-section-groups
 - Add --dyn-syms as an alias for --dyn-symbols
 - Add --syms as an alias for --symbols
 - Add --histogram as an alias for --elf-hash-histogram
 - [Breaking] When invoked as `llvm-readelf`, -s is --symbols instead of --sections
 - [Breaking] When invoked as `llvm-readelf`, -t is no longer an alias for --symbols

Reviewers: MaskRay, phosek, mcgrathr, jhenderson

Reviewed By: MaskRay, jhenderson

Subscribers: sbc100, aheejin, edd, jhenderson, silvas, echristo, compnerd, kristina, javed.absar, kristof.beyls, llvm-commits, Bigcheese

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

llvm-svn: 346685

5 years agoRemove the last CURRENT_ARCH reference in Xcode's build scripts.
Frederic Riss [Mon, 12 Nov 2018 17:59:30 +0000 (17:59 +0000)]
Remove the last CURRENT_ARCH reference in Xcode's build scripts.

In the same spirit as r346443.

llvm-svn: 346684

5 years ago[CostModel][X86] Add SHLD/SHRD scalar funnel shift costs
Simon Pilgrim [Mon, 12 Nov 2018 17:56:59 +0000 (17:56 +0000)]
[CostModel][X86] Add SHLD/SHRD scalar funnel shift costs

The costs match the typical reg-reg cases - the RMW case can be a lot slower but we don't model that at this level

llvm-svn: 346683

5 years ago[MachineOutliner][NFC] Early exit pruning when candidates don't share an MBB
Jessica Paquette [Mon, 12 Nov 2018 17:50:56 +0000 (17:50 +0000)]
[MachineOutliner][NFC] Early exit pruning when candidates don't share an MBB

There's no way they can overlap in this case.

This can save a few iterations when the candidate is close to the beginning
of a MachineBasicBlock. It's particularly useful when the average length of
a MachineBasicBlock in the program is small.

llvm-svn: 346682

5 years ago[MachineOutliner][NFC] Put suffix tree in buildCandidateList
Jessica Paquette [Mon, 12 Nov 2018 17:50:55 +0000 (17:50 +0000)]
[MachineOutliner][NFC] Put suffix tree in buildCandidateList

It's only used there, so it doesn't make much sense to have it in runOnModule.

llvm-svn: 346681

5 years ago[analyzer] Drastically simplify the tblgen files used for checkers
Kristof Umann [Mon, 12 Nov 2018 17:49:51 +0000 (17:49 +0000)]
[analyzer] Drastically simplify the tblgen files used for checkers

Interestingly, only about the quarter of the emitter file is used, the DescFile
entry hasn't ever been touched [1], and the entire concept of groups is a
mystery, so I removed them.

[1] http://lists.llvm.org/pipermail/cfe-dev/2018-October/059664.html

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

llvm-svn: 346680

5 years ago[lldb] Refactor ObjC/NSException.cpp (cleanup, avoid code duplication). NFC.
Kuba Mracek [Mon, 12 Nov 2018 17:25:23 +0000 (17:25 +0000)]
[lldb] Refactor ObjC/NSException.cpp (cleanup, avoid code duplication). NFC.

- Refactor reading of NSException fields into ExtractFields method to avoid code duplication.
- Remove "m_child_ptr" field, as it's not used anywhere.
- Clang-format.

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

llvm-svn: 346679

5 years agoRevert "Add a test checking clang-tidy can find libc++ on Mac"
Jonas Toth [Mon, 12 Nov 2018 17:22:36 +0000 (17:22 +0000)]
Revert "Add a test checking clang-tidy can find libc++ on Mac"

This reverts commit r346653.

llvm-svn: 346678

5 years agoImplement P1094R2 (nested inline namespaces)
Erich Keane [Mon, 12 Nov 2018 17:19:48 +0000 (17:19 +0000)]
Implement P1094R2 (nested inline namespaces)

As approved for the Working Paper in San Diego, support annotating
inline namespaces with 'inline'.

Change-Id: I51a654e11ffb475bf27cccb2458768151619e384
llvm-svn: 346677

5 years ago[clang-tidy] fix ARM tests, because int and long have same width
Jonas Toth [Mon, 12 Nov 2018 17:02:05 +0000 (17:02 +0000)]
[clang-tidy] fix ARM tests, because int and long have same width

llvm-svn: 346676

5 years agoRevert "Make clang-based tools find libc++ on MacOS"
Jonas Devlieghere [Mon, 12 Nov 2018 16:59:50 +0000 (16:59 +0000)]
Revert "Make clang-based tools find libc++ on MacOS"

This breaks the LLDB bots.

llvm-svn: 346675

5 years ago[DWARFv5] Emit split type units in .debug_info.dwo.
Paul Robinson [Mon, 12 Nov 2018 16:55:11 +0000 (16:55 +0000)]
[DWARFv5] Emit split type units in .debug_info.dwo.

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

llvm-svn: 346674

5 years ago[lldb] Fix "code requires global destructor" warning in g_architecture_mutex
Kuba Mracek [Mon, 12 Nov 2018 16:52:58 +0000 (16:52 +0000)]
[lldb] Fix "code requires global destructor" warning in g_architecture_mutex

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

llvm-svn: 346673

5 years ago[PDB] Fix `vbases.test` requirement
Aleksandr Urakov [Mon, 12 Nov 2018 16:45:55 +0000 (16:45 +0000)]
[PDB] Fix `vbases.test` requirement

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

llvm-svn: 346672

5 years ago[clangd] Don't show all refs results if -name is ambiguous in dexp.
Haojian Wu [Mon, 12 Nov 2018 16:41:15 +0000 (16:41 +0000)]
[clangd] Don't show all refs results if -name is ambiguous in dexp.

Reviewers: ioeric

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 346671

5 years ago[CostModel][X86] Add some initial cost tests for funnel shifts
Simon Pilgrim [Mon, 12 Nov 2018 16:39:41 +0000 (16:39 +0000)]
[CostModel][X86] Add some initial cost tests for funnel shifts

Still need to add full uniform/constant coverage but this is enough to check basic fshl/fshr cost handling

llvm-svn: 346670

5 years ago[ClangASTContext] Extract VTable pointers from C++ objects
Aleksandr Urakov [Mon, 12 Nov 2018 16:23:50 +0000 (16:23 +0000)]
[ClangASTContext] Extract VTable pointers from C++ objects

This patch processes the case of retrieving a virtual base when the object is
already read from the debuggee memory.

To achieve that ValueObject::GetCPPVTableAddress was removed and was
reimplemented in ClangASTContext (because access to the process is needed to
retrieve the VTable pointer in general, and because this is the only place that
used old version of ValueObject::GetCPPVTableAddress).

This patch allows to use real object's VTable instead of searching virtual bases
by offsets restored by MicrosoftRecordLayoutBuilder. PDB has no enough info to
restore VBase offsets properly, so we have to read real VTable instead.

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

llvm-svn: 346669

5 years ago[CMake] Allow version overrides with -DLLDB_VERSION_MAJOR/MINOR/PATCH/SUFFIX
Stefan Granitz [Mon, 12 Nov 2018 16:22:28 +0000 (16:22 +0000)]
[CMake] Allow version overrides with -DLLDB_VERSION_MAJOR/MINOR/PATCH/SUFFIX

Summary:
This follows the approach in Clang. If no overrides are given, LLDB_VERSION_* is inferred from LLVM_VERSION_*. This mimics the current behaviour (PACKAGE_VERSION itself is generated from LLVM_VERSION_*).
For in-tree builds LLVM_VERSION_* will be defined at this point already. For standalone builds, LLDBConfig.cmake is included after LLDBStandalone.cmake which includes LLVMConfig.cmake.

Reviewers: labath, xiaobai

Subscribers: mgorny, friss, aprantl, lldb-commits

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

llvm-svn: 346668

5 years ago[CMake] Fix: add_host_subdirectory source/Host/macosx
Stefan Granitz [Mon, 12 Nov 2018 16:22:24 +0000 (16:22 +0000)]
[CMake] Fix: add_host_subdirectory source/Host/macosx

Summary: Typo introduced with https://reviews.llvm.org/D47929

Reviewers: teemperor

Subscribers: mgorny, friss, lldb-commits

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

llvm-svn: 346667

5 years ago[clangd] Allow symbols from AnyScope in dexp.
Haojian Wu [Mon, 12 Nov 2018 16:03:59 +0000 (16:03 +0000)]
[clangd] Allow symbols from AnyScope in dexp.

Summary:
We should allow symbols from any scope in dexp results, othewise
`find StringRef` doesn't return any results (llvm::StringRef).

Reviewers: ioeric

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 346666

5 years ago[clang-tidy] new check: bugprone-too-small-loop-variable
Jonas Toth [Mon, 12 Nov 2018 16:01:39 +0000 (16:01 +0000)]
[clang-tidy] new check: bugprone-too-small-loop-variable

The new checker searches for those for loops which has a loop variable with a "too small" type which means this type can't represent all values which are part of the iteration range.

For example:

```
int main() {
  long size = 300000;
  for( short int i = 0; i < size; ++i) {}
}
```

The short type leads to infinite loop here because it can't store all values in the `[0..size]` interval. In a real use case, size means a container's size which depends on the user input. Which means for small amount of objects the algorithm works, but with a larger user input the software will freeze.

The idea of the checker comes from the LibreOffice project, where the same check was implemented as a clang compiler plugin, called `LoopVarTooSmall` (LLVM licensed).
The idea is the same behind this check, but the code is different because of the different framework.

Patch by ztamas.

Reviewers: alexfh, hokein, aaron.ballman, JonasToth, xazax.hun, whisperity

Reviewed By: JonasToth, whisperity

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

llvm-svn: 346665

5 years ago[CostModel][X86] SK_ExtractSubvector is cheap if the (legal) subvector is aligned...
Simon Pilgrim [Mon, 12 Nov 2018 15:48:06 +0000 (15:48 +0000)]
[CostModel][X86] SK_ExtractSubvector is cheap if the (legal) subvector is aligned within the source vector

llvm-svn: 346664

5 years ago[SystemZ::TTI] Improve accuracy of costs for vector fp <-> int conversions
Jonas Paulsson [Mon, 12 Nov 2018 15:32:27 +0000 (15:32 +0000)]
[SystemZ::TTI]  Improve accuracy of costs for vector fp <-> int conversions

Improve getCastInstrCost() by respecting the different types of Src and Dst
for vector integer <-> fp conversions.

This means that extracting from integer becomes more expensive (by the
extraction penalty), and the extraction from fp becomes cheaper (no longer
has a false extraction penalty).

Review: Ulrich Weigand
https://reviews.llvm.org/D54423

llvm-svn: 346663

5 years ago[CostModel] Add more realistic SK_InsertSubvector generic costs.
Simon Pilgrim [Mon, 12 Nov 2018 15:20:24 +0000 (15:20 +0000)]
[CostModel] Add more realistic SK_InsertSubvector generic costs.

Instead of defaulting to a cost = 1, expand to element extract/insert like we do for other shuffles.

llvm-svn: 346662

5 years ago[VectorUtils] add funnel-shifts to the list of vectorizable intrinsics
Sanjay Patel [Mon, 12 Nov 2018 15:20:14 +0000 (15:20 +0000)]
[VectorUtils] add funnel-shifts to the list of vectorizable intrinsics

This just identifies the intrinsics as candidates for vectorization.
It does not mean we will attempt to vectorize under normal conditions
(the test file is forcing vectorization).

The cost model must be fixed to show that the transform is profitable
in general.

Allowing vectorization with these intrinsics is required to avoid
potential regressions from canonicalizing to the intrinsics from
generic IR:
https://bugs.llvm.org/show_bug.cgi?id=37417

llvm-svn: 346661

5 years ago[VectorUtils] reorder list of vectorizable intrinsics; NFC
Sanjay Patel [Mon, 12 Nov 2018 15:10:30 +0000 (15:10 +0000)]
[VectorUtils] reorder list of vectorizable intrinsics; NFC

We need to add funnel-shifts to this list, so clean up
the random order before it gets worse.

llvm-svn: 346660

5 years agoRevert rL346644, rL346642: the added test test/CodeGen/code-coverage-filter.c is...
Calixte Denizet [Mon, 12 Nov 2018 14:57:17 +0000 (14:57 +0000)]
Revert rL346644, rL346642: the added test test/CodeGen/code-coverage-filter.c is failing under windows

llvm-svn: 346659

5 years ago[LoopVectorize] add tests for funnel shifts; NFC
Sanjay Patel [Mon, 12 Nov 2018 14:52:01 +0000 (14:52 +0000)]
[LoopVectorize] add tests for funnel shifts; NFC

llvm-svn: 346658

5 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Mon, 12 Nov 2018 14:48:39 +0000 (14:48 +0000)]
Fix unused variable warning. NFCI.

llvm-svn: 346657

5 years ago[CostModel] Add more realistic SK_ExtractSubvector generic costs.
Simon Pilgrim [Mon, 12 Nov 2018 14:25:23 +0000 (14:25 +0000)]
[CostModel] Add more realistic SK_ExtractSubvector generic costs.

Instead of defaulting to a cost = 1, expand to element extract/insert like we do for other shuffles.

This exposes an issue in LoopVectorize which could call SK_ExtractSubvector with a scalar subvector type.

llvm-svn: 346656

5 years ago[RISCV] Support .option relax and .option norelax
Alex Bradbury [Mon, 12 Nov 2018 14:25:07 +0000 (14:25 +0000)]
[RISCV] Support .option relax and .option norelax

This extends the .option support from D45864 to enable/disable the relax
feature flag from D44886

During parsing of the relax/norelax directives, the RISCV::FeatureRelax
feature bits of the SubtargetInfo stored in the AsmParser are updated
appropriately to reflect whether relaxation is currently enabled in the
parser. When an instruction is parsed, the parser checks if relaxation is
currently enabled and if so, gets a handle to the AsmBackend and sets the
ForceRelocs flag. The AsmBackend uses a combination of the original
RISCV::FeatureRelax feature bits set by e.g -mattr=+/-relax and the
ForceRelocs flag to determine whether to emit relocations for symbol and
branch diffs. Diff relocations should therefore only not be emitted if the
relax flag was not set on the command line and no instruction was ever parsed
in a section with relaxation enabled to ensure correct diffs are emitted.

Differential Revision: https://reviews.llvm.org/D46423
Patch by Lewis Revill.

llvm-svn: 346655

5 years ago[DAGCombiner] Fix load-store forwarding of indexed loads.
Nirav Dave [Mon, 12 Nov 2018 14:05:40 +0000 (14:05 +0000)]
[DAGCombiner] Fix load-store forwarding of indexed loads.

Summary:
Handle extra output from index loads in cases where we wish to
forward a load value directly from a preceeding store.

Fixes PR39571.

Reviewers: peter.smith, rengolin

Subscribers: javed.absar, hiraditya, arphaman, llvm-commits

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

llvm-svn: 346654

5 years agoAdd a test checking clang-tidy can find libc++ on Mac
Ilya Biryukov [Mon, 12 Nov 2018 13:56:09 +0000 (13:56 +0000)]
Add a test checking clang-tidy can find libc++ on Mac

Reviewers: sammccall, arphaman, EricWF

Reviewed By: sammccall

Subscribers: christof, cfe-commits

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

llvm-svn: 346653

5 years agoMake clang-based tools find libc++ on MacOS
Ilya Biryukov [Mon, 12 Nov 2018 13:55:55 +0000 (13:55 +0000)]
Make clang-based tools find libc++ on MacOS

Summary:
When they read compiler args from compile_commands.json.
This change allows to run clang-based tools, like clang-tidy or clangd,
built from head using the compile_commands.json file produced for XCode
toolchains.

On MacOS clang can find the C++ standard library relative to the
compiler installation dir.

The logic to do this was based on resource dir as an approximation of
where the compiler is installed. This broke the tools that read
'compile_commands.json' and don't ship with the compiler, as they
typically change resource dir.

To workaround this, we now use compiler install dir detected by the driver
to better mimic the behavior of the original compiler when replaying the
compilations using other tools.

Reviewers: sammccall, arphaman, EricWF

Reviewed By: sammccall

Subscribers: ioeric, christof, kadircet, cfe-commits

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

llvm-svn: 346652

5 years agoFix an unused variable warning. NFC
Alexander Kornienko [Mon, 12 Nov 2018 13:41:42 +0000 (13:41 +0000)]
Fix an unused variable warning. NFC

llvm-svn: 346651

5 years ago[llvm-mca] Correctly update the resource strategy for processor resources with multip...
Andrea Di Biagio [Mon, 12 Nov 2018 13:09:39 +0000 (13:09 +0000)]
[llvm-mca] Correctly update the resource strategy for processor resources with multiple units.

When looking at the tests committed by Roman at r346587, I noticed that numbers
reported by the resource pressure for PdAGU01 were wrong.

In particular, according to the aut-generated CHECK lines in tests
memcpy-like-test.s and store-throughput.s, resource pressure for PdAGU01
was not uniformly distributed among the two AGEN pipes.

It turns out that the reason why pressure was not correctly distributed, was
because the "resource selection strategy" object associated with PdAGU01 was not
correctly updated on the event of AGEN pipe used.
As a result, llvm-mca was not simulating a round-robin pipeline allocation for
PdAGU01. Instead, PdAGU1 was always prioritized over PdAGU0.

This patch fixes the issue; now processor resource strategy objects for
resources declaring multiple units, are correctly notified in the event of
"resource used".

llvm-svn: 346650

5 years ago[newpm] Fix r346645: Missing consume of the Error return by the pipeline parser
Philip Pfaffe [Mon, 12 Nov 2018 12:27:58 +0000 (12:27 +0000)]
[newpm] Fix r346645: Missing consume of the Error return by the pipeline parser

llvm-svn: 346649

5 years ago[clangd] Remember to serialize AnyScope in FuzzyFindRequest json.
Eric Liu [Mon, 12 Nov 2018 12:24:08 +0000 (12:24 +0000)]
[clangd] Remember to serialize AnyScope in FuzzyFindRequest json.

llvm-svn: 346648

5 years agoAdd an OptimizerLast EP
Philip Pfaffe [Mon, 12 Nov 2018 11:17:07 +0000 (11:17 +0000)]
Add an OptimizerLast EP

Summary:
It turns out that we need an OptimizerLast PassBuilder extension point
after all. I missed the relevance of this EP the first time. By legacy PM magic,
function passes added at this EP get added to the last _Function_ PM, which is a
feature we lost when dropping this EP for the new PM.

A key difference between this and the legacy PassManager's OptimizerLast
callback is that this extension point is not triggered at O0. Extensions
to the O0 pipeline should append their passes to the end of the overall
pipeline.

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

llvm-svn: 346645

5 years ago[GCOV] fix test after patch rL346642
Calixte Denizet [Mon, 12 Nov 2018 09:52:14 +0000 (09:52 +0000)]
[GCOV] fix test after patch rL346642

Summary:
Test is failing under windows, so fix it.
Should fix:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/1390/steps/stage%201%20check/logs/stdio

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: cfe-commits, sylvestre.ledru, marco-c

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

llvm-svn: 346644

5 years ago[LICM] Hoist guards from non-header blocks
Max Kazantsev [Mon, 12 Nov 2018 09:29:58 +0000 (09:29 +0000)]
[LICM] Hoist guards from non-header blocks

This patch relaxes overconservative checks on whether or not we could write
memory before we execute an instruction. This allows us to hoist guards out of
loops even if they are not in the header block.

Differential Revision: https://reviews.llvm.org/D50891
Reviewed By: fedor.sergeev

llvm-svn: 346643

5 years ago[Clang] Add options -fprofile-filter-files and -fprofile-exclude-files to filter...
Calixte Denizet [Mon, 12 Nov 2018 09:12:27 +0000 (09:12 +0000)]
[Clang] Add options -fprofile-filter-files and -fprofile-exclude-files to filter the files to instrument with gcov

Summary:
These options are taking regex separated by colons to filter files.
- if both are empty then all files are instrumented
- if -fprofile-filter-files is empty then all the filenames matching any of the regex from exclude are not instrumented
- if -fprofile-exclude-files is empty then all the filenames matching any of the regex from filter are instrumented
- if both aren't empty then all the filenames which match any of the regex in filter and which don't match all the regex in filter are instrumented
- this patch is a follow-up of https://reviews.llvm.org/D52033

Reviewers: marco-c, vsk

Reviewed By: marco-c, vsk

Subscribers: cfe-commits, sylvestre.ledru

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

llvm-svn: 346642

5 years ago[GCOV] Add options to filter files which must be instrumented.
Calixte Denizet [Mon, 12 Nov 2018 09:01:43 +0000 (09:01 +0000)]
[GCOV] Add options to filter files which must be instrumented.

Summary:
When making code coverage, a lot of files (like the ones coming from /usr/include) are removed when post-processing gcno/gcda so finally they doen't need to be instrumented nor to appear in gcno/gcda.
The goal of the patch is to be able to filter the files we want to instrument, there are several advantages to do that:
- improve speed (no overhead due to instrumentation on files we don't care)
- reduce gcno/gcda size
- it gives the possibility to easily instrument only few files (e.g. ones modified in a patch) without changing the build system
- need to accept this patch to be enabled in clang: https://reviews.llvm.org/D52034

Reviewers: marco-c, vsk

Reviewed By: marco-c

Subscribers: llvm-commits, sylvestre.ledru

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

llvm-svn: 346641

5 years agoRelease notes: Mention clang-cl's /Zc:dllexportInlines- flag
Hans Wennborg [Mon, 12 Nov 2018 08:42:21 +0000 (08:42 +0000)]
Release notes: Mention clang-cl's /Zc:dllexportInlines- flag

llvm-svn: 346640

5 years agoclang-cl: Add documentation for /Zc:dllexportInlines-
Hans Wennborg [Mon, 12 Nov 2018 08:38:10 +0000 (08:38 +0000)]
clang-cl: Add documentation for /Zc:dllexportInlines-

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

llvm-svn: 346639

5 years ago[clangd] Fix compile on very old glibc
Sam McCall [Mon, 12 Nov 2018 08:17:49 +0000 (08:17 +0000)]
[clangd] Fix compile on very old glibc

llvm-svn: 346638

5 years ago[SystemZ] Replicate the load with most uses in buildVector()
Jonas Paulsson [Mon, 12 Nov 2018 08:12:20 +0000 (08:12 +0000)]
[SystemZ] Replicate the load with most uses in buildVector()

Iterate over all elements and count the number of uses among them for each
used load. Then make sure to REPLICATE the load which has the most uses in
order to minimize the number of needed element insertions.

Review: Ulrich Weigand
https://reviews.llvm.org/D54322

llvm-svn: 346637

5 years ago[llvm-objdump] add more constraints for tests
Fangrui Song [Mon, 12 Nov 2018 08:10:14 +0000 (08:10 +0000)]
[llvm-objdump] add more constraints for tests

Patch by Higuoxing (Xing)

Reviewers: jhenderson

Reviewed By: jhenderson

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

llvm-svn: 346636

5 years agoFix compatibility with z3-4.8.1
Jan Kratochvil [Mon, 12 Nov 2018 06:48:02 +0000 (06:48 +0000)]
Fix compatibility with z3-4.8.1

With z3-4.8.1:
../tools/clang/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp:49:40: error:
'Z3_get_error_msg_ex' was not declared in this scope
../tools/clang/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp:49:40: note:
suggested alternative: 'Z3_get_error_msg'

Formerly used Z3_get_error_msg_ex() as one could find in z3-4.7.1 states:
"Retained function name for backwards compatibility within v4.1"
And it is implemented only as a forwarding call:
return Z3_get_error_msg(c, err);

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

llvm-svn: 346635

5 years agoUpdate to-do list with new work from WG21 meeting in San Diego
Marshall Clow [Mon, 12 Nov 2018 04:58:00 +0000 (04:58 +0000)]
Update to-do list with new work from WG21 meeting in San Diego

llvm-svn: 346634

5 years agoSupport Swift in platform availability attribute
Michael Wu [Mon, 12 Nov 2018 02:44:33 +0000 (02:44 +0000)]
Support Swift in platform availability attribute

Summary: This adds support for Swift platform availability attributes. It's largely a port of the changes made to https://github.com/apple/swift-clang/ for Swift availability attributes. Specifically, https://github.com/apple/swift-clang/commit/84b5a21c31cb5b0d7d958a478bc01964939b6952 and https://github.com/apple/swift-clang/commit/e5b87f265aede41c8381094bbf54e2715c8293b0 . The implementation of attribute_availability_swift is a little different and additional tests in test/Index/availability.c were added.

Reviewers: manmanren, friss, doug.gregor, arphaman, jfb, erik.pilkington, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: aaron.ballman, ColinKinloch, jrmuizel, cfe-commits

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

llvm-svn: 346633

5 years ago[GC] Remove unused configuration variable
Philip Reames [Mon, 12 Nov 2018 02:34:54 +0000 (02:34 +0000)]
[GC] Remove unused configuration variable

The custom root mechanism didn't actually do anything.  ShadowStackGC, the only one which used it, just removed the gcroots before they reached the normal lowering in SelectionDAG.  As a result, the state flag had no value.

llvm-svn: 346632

5 years ago[GC] Minor style modernization
Philip Reames [Mon, 12 Nov 2018 02:26:26 +0000 (02:26 +0000)]
[GC] Minor style modernization

llvm-svn: 346631

5 years ago[NFC] Reformat std::optional tests
Louis Dionne [Mon, 12 Nov 2018 01:38:30 +0000 (01:38 +0000)]
[NFC] Reformat std::optional tests

llvm-svn: 346630

5 years ago[NFC] Fix typo in <tuple>
Louis Dionne [Mon, 12 Nov 2018 01:28:07 +0000 (01:28 +0000)]
[NFC] Fix typo in <tuple>

llvm-svn: 346629

5 years ago[CodeGen][CXX]: Fix no_destroy CG bug under specific circumstances
Kristina Brooks [Mon, 12 Nov 2018 01:19:16 +0000 (01:19 +0000)]
[CodeGen][CXX]: Fix no_destroy CG bug under specific circumstances

Summary:

Class with no user-defined destructor that has an inherited member that has a
non-trivial destructor and a non-default constructor will attempt to emit a
destructor despite being marked as __attribute((no_destroy)) in which case it
would trigger an assertion due to an incorrect assumption.

In addition this adds missing test coverage for IR generation for no_destroy.

(Note that here use of no_destroy is synonymous with its global flag
counterpart `-fno-c++-static-destructors` being enabled)

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

llvm-svn: 346628

5 years ago[IPSCCP] Delete two forward declarations
Fangrui Song [Sun, 11 Nov 2018 23:17:46 +0000 (23:17 +0000)]
[IPSCCP] Delete two forward declarations

Summary: Use forward declaration as the reviewer is in favor of #include and delete a redundant declaration of Function.

Reviewers: fhahn

Reviewed By: fhahn

Subscribers: llvm-commits

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

llvm-svn: 346627

5 years agoRemove header grouping comments.
Jonas Devlieghere [Sun, 11 Nov 2018 23:17:06 +0000 (23:17 +0000)]
Remove header grouping comments.

This patch removes the comments grouping header includes. They were
added after running IWYU over the LLDB codebase. However they add little
value, are often outdates and burdensome to maintain.

llvm-svn: 346626

5 years agoRemove comments after header includes.
Jonas Devlieghere [Sun, 11 Nov 2018 23:16:43 +0000 (23:16 +0000)]
Remove comments after header includes.

This patch removes the comments following the header includes. They were
added after running IWYU over the LLDB codebase. However they add little
value, are often outdates and burdensome to maintain.

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

llvm-svn: 346625

5 years ago[llvm-nm] Use WithColor for error reporting
Jonas Devlieghere [Sun, 11 Nov 2018 22:12:21 +0000 (22:12 +0000)]
[llvm-nm] Use WithColor for error reporting

Use helpers from Support/WithError.h to print errors.

llvm-svn: 346624

5 years ago[llvm-objdump] Use WithColor for error reporting
Jonas Devlieghere [Sun, 11 Nov 2018 22:12:04 +0000 (22:12 +0000)]
[llvm-objdump] Use WithColor for error reporting

Use helpers from Support/WithError.h to print errors.

llvm-svn: 346623

5 years ago[llvm-undname] Use WithColor for error reporting
Jonas Devlieghere [Sun, 11 Nov 2018 22:11:47 +0000 (22:11 +0000)]
[llvm-undname] Use WithColor for error reporting

Use helpers from Support/WithError.h to print errors.

llvm-svn: 346622

5 years ago[GCRoot] Remove some unneccessary complexity
Philip Reames [Sun, 11 Nov 2018 21:13:09 +0000 (21:13 +0000)]
[GCRoot] Remove some unneccessary complexity

The GCStrategy provides three configuration options were are largely redundant.

1) Support for conditionally lowering gcread and gcwrite to loads and stores.  This is redundant since any GC which wished to use these abstractions would lower them out of existance before the built in lowering anyways.  As such, there's no need to have the lowering being conditional.
2) Conditional initialization for allocas marked via gcroot.  Semantically, roots have to be initialized before first potential use.  Arguably, the frontend really should have responsibility for that, but the old API allowed the frontend to ignore this detail.  Only one builtin GC used the non-initializing mode.  Since no one to my knowledge actually uses the ErlangGC strategy, I decide the slight pessimization was worth the simplicity.  If that turns out to be problematic, we can always improve the insertion algorithm to detect more existing initializing stores.

llvm-svn: 346621

5 years ago[IPSCCP] Use forward declaration.
Florian Hahn [Sun, 11 Nov 2018 20:57:04 +0000 (20:57 +0000)]
[IPSCCP] Use forward declaration.

llvm-svn: 346620

5 years ago[IPSCCP,PM] Add missing #include in rL346618
Fangrui Song [Sun, 11 Nov 2018 20:44:13 +0000 (20:44 +0000)]
[IPSCCP,PM] Add missing #include in rL346618

llvm-svn: 346619

5 years ago[IPSCCP,PM] Preserve PDT in the new pass manager.
Florian Hahn [Sun, 11 Nov 2018 20:22:45 +0000 (20:22 +0000)]
[IPSCCP,PM] Preserve PDT in the new pass manager.

Reviewers: kuhar, chandlerc, NutshellySima, brzycki

Reviewed By: NutshellySima, brzycki

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

llvm-svn: 346618

5 years ago[MC] Fix 3 objdump tests after rL346610
Fangrui Song [Sun, 11 Nov 2018 19:15:27 +0000 (19:15 +0000)]
[MC] Fix 3 objdump tests after rL346610

llvm-svn: 346617

5 years ago[ELF] Change GnuPub{Names,Types}Section from StringRef to LLDDWARFSection
Fangrui Song [Sun, 11 Nov 2018 18:57:35 +0000 (18:57 +0000)]
[ELF] Change GnuPub{Names,Types}Section from StringRef to LLDDWARFSection

Summary:
The debug_info_offset value may be relocated.

This is lld side change of D54375.

Reviewers: ruiu, dblaikie, grimar, espindola

Subscribers: emaste, arichardson, JDevlieghere, llvm-commits

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

llvm-svn: 346616

5 years ago[DWARF] Change pubnames to use DWARFSection instead of StringRef
Fangrui Song [Sun, 11 Nov 2018 18:57:28 +0000 (18:57 +0000)]
[DWARF] Change pubnames to use DWARFSection instead of StringRef

Summary: The debug_info_offset values in .debug_{,gnu_}pub{name,types} may be relocated. Change it to DWARFSection so that we can get relocated values.

Reviewers: ruiu, dblaikie, grimar, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: aprantl, JDevlieghere, llvm-commits

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

llvm-svn: 346615

5 years ago[ELF] Fix relocation-common.s after rL346610
Fangrui Song [Sun, 11 Nov 2018 18:54:58 +0000 (18:54 +0000)]
[ELF] Fix relocation-common.s after rL346610

llvm-svn: 346614

5 years ago[ELF] Fix objdump tests after rL346610
Fangrui Song [Sun, 11 Nov 2018 18:49:05 +0000 (18:49 +0000)]
[ELF] Fix objdump tests after rL346610

llvm-svn: 346613

5 years ago[lld][test] Update tests using objdump
Kristina Brooks [Sun, 11 Nov 2018 18:42:59 +0000 (18:42 +0000)]
[lld][test] Update tests using objdump

Followup fix for LLD test for new format in rL346610.

llvm-svn: 346612

5 years ago[llvm][test] Update tests using objdump
Kristina Brooks [Sun, 11 Nov 2018 18:40:33 +0000 (18:40 +0000)]
[llvm][test] Update tests using objdump

Update tests using llvm-objdump since check strings don't
match anymore due to the extra `O` in place. This is a
followup for rL346610.

llvm-svn: 346611

5 years ago[llvm-objdump] Add symbol 'O' for object data
Kristina Brooks [Sun, 11 Nov 2018 17:47:13 +0000 (17:47 +0000)]
[llvm-objdump] Add symbol 'O' for object data

Improve compatibility with GNU objdump by showing `O` next to
global symbol names, instead of a blank space.

Patch by Higuoxing (Xing).

Reviewers: MaskRay

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

llvm-svn: 346610

5 years ago[x86] auto-generate complete checks; NFC
Sanjay Patel [Sun, 11 Nov 2018 14:57:26 +0000 (14:57 +0000)]
[x86] auto-generate complete checks; NFC

llvm-svn: 346609