platform/upstream/llvm.git
6 years ago[RuntimeDyld][PowerPC] Fix a newly added test in r329355
Krasimir Georgiev [Mon, 9 Apr 2018 14:29:23 +0000 (14:29 +0000)]
[RuntimeDyld][PowerPC] Fix a newly added test in r329355

Summary: The bit widths are wrong.

Reviewers: bkramer, lhames, hans

Reviewed By: hans

Subscribers: hans, nemanjai, kbarton, llvm-commits

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

llvm-svn: 329573

6 years ago[MergeICmp] Update debug msg.NFC
Xin Tong [Mon, 9 Apr 2018 14:29:13 +0000 (14:29 +0000)]
[MergeICmp] Update debug msg.NFC

llvm-svn: 329572

6 years ago[clangd] Adapt index interfaces to D45014, and fix the old bugs.
Sam McCall [Mon, 9 Apr 2018 14:28:52 +0000 (14:28 +0000)]
[clangd] Adapt index interfaces to D45014, and fix the old bugs.

Summary:
Fix bugs:
- don't count occurrences of decls where we don't spell the name
- findDefinitions at MACRO(^X) goes to the definition of MACRO

Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, MaskRay, cfe-commits

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

llvm-svn: 329571

6 years ago[Index] Return SourceLocation to consumers, not FileID/Offset pair.
Sam McCall [Mon, 9 Apr 2018 14:12:51 +0000 (14:12 +0000)]
[Index] Return SourceLocation to consumers, not FileID/Offset pair.

Summary:
The FileID/Offset conversion is lossy. The code takes the fileLoc, which loses
e.g. the spelling location in some macro cases.
Instead, pass the original SourceLocation which preserves all information, and
update consumers to match current behavior.

This allows us to fix two bugs in clangd that need the spelling location.

Reviewers: akyrtzi, arphaman

Subscribers: ilya-biryukov, ioeric, cfe-commits

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

llvm-svn: 329570

6 years agoRevert r329403 "[llvm-mca] Do not separate iterations with a newline in the timeline...
Hans Wennborg [Mon, 9 Apr 2018 13:53:41 +0000 (13:53 +0000)]
Revert r329403 "[llvm-mca] Do not separate iterations with a newline in the timeline view."

This made AArch64/CortexA57/direct-branch.s fail on Windows, e.g.
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/11251

> Also, update a few tests to minimize the diff in D45369.
> No functional change intended.

llvm-svn: 329569

6 years ago[X86][MMX] Fix missing itinerary for PALIGNR
Simon Pilgrim [Mon, 9 Apr 2018 13:52:33 +0000 (13:52 +0000)]
[X86][MMX] Fix missing itinerary for PALIGNR

llvm-svn: 329568

6 years ago[X86][MMX] Fix missing itinerary for MOVQ2DQ instruction format
Simon Pilgrim [Mon, 9 Apr 2018 13:42:14 +0000 (13:42 +0000)]
[X86][MMX] Fix missing itinerary for MOVQ2DQ instruction format

llvm-svn: 329567

6 years agoImprove completion experience for headers
Philipp Stephani [Mon, 9 Apr 2018 13:31:44 +0000 (13:31 +0000)]
Improve completion experience for headers

Summary: When calling `completing-read', we should provide a default to prevent the behavior described in https://github.com/DarwinAwardWinner/ido-completing-read-plus#why-does-ret-sometimes-not-select-the-first-completion-on-the-list--why-is-there-an-empty-entry-at-the-beginning-of-the-completion-list--what-happened-to-old-style-default-selection.  Also, don't use an assertion to check whether the user selected a header; raise a proper signal instead.

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

llvm-svn: 329566

6 years ago[X86][MMX] Fix missing itinerary for CVTPI2PS
Simon Pilgrim [Mon, 9 Apr 2018 13:27:47 +0000 (13:27 +0000)]
[X86][MMX] Fix missing itinerary for CVTPI2PS

llvm-svn: 329565

6 years ago[MergeICmp] Split blocks that do other work.
Xin Tong [Mon, 9 Apr 2018 13:14:06 +0000 (13:14 +0000)]
[MergeICmp] Split blocks that do other work.

Summary:
We do not try to move the instructions and split the block till we
know the blocks can be split, i.e. BCE-cmp-insts can be separated from
non-BCE-cmp-insts.

Reviewers: davide, courbet

Subscribers: llvm-commits

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

llvm-svn: 329564

6 years ago[ELF] - Simplify test case. NFC.
George Rimar [Mon, 9 Apr 2018 13:13:36 +0000 (13:13 +0000)]
[ELF] - Simplify test case. NFC.

llvm-svn: 329563

6 years ago[AMDGPU][MC][GFX9] Added instructions s_mul_hi_*32, s_lshl*_add_u32
Dmitry Preobrazhensky [Mon, 9 Apr 2018 13:10:33 +0000 (13:10 +0000)]
[AMDGPU][MC][GFX9] Added instructions s_mul_hi_*32, s_lshl*_add_u32

See bugs
  36841: https://bugs.llvm.org/show_bug.cgi?id=36841
  36842: https://bugs.llvm.org/show_bug.cgi?id=36842

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

Reviewers: artem.tamazov, arsenm, timcorringham
llvm-svn: 329562

6 years ago[X86][MMX] Fix flipped reg/mem typo in MMX_MISC_FUNC_ITINS
Simon Pilgrim [Mon, 9 Apr 2018 13:02:07 +0000 (13:02 +0000)]
[X86][MMX] Fix flipped reg/mem typo in MMX_MISC_FUNC_ITINS

The RR/RM itineraries were the wrong way around

llvm-svn: 329561

6 years ago[ELF] - Stop setting OutSecOff too early.
George Rimar [Mon, 9 Apr 2018 13:01:50 +0000 (13:01 +0000)]
[ELF] - Stop setting OutSecOff too early.

Currently LLD sets OutSecOff in addSection for input sections.
That is a fake offset (just a rude approximation to remember the order),
used for sorting SHF_LINK_ORDER sections
(see resolveShfLinkOrder, compareByFilePosition).

There are 2 problems with such approach:

1. We currently change and reuse Size field as a value assigned. Changing size is
not good because leads to bugs. Currently, SIZEOF(.bss) for empty .bss returns 2
because we add two empty synthetic sections and increase size twice by 1.
(See PR37011: https://bugs.llvm.org/show_bug.cgi?id=37011)

2. Such approach simply does not work when --symbol-ordering-file is involved,
because processing of the ordering file might break the initial section order.

This fixes PR37011.

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

llvm-svn: 329560

6 years ago[ELF] - Fix cref.s test case.
George Rimar [Mon, 9 Apr 2018 12:45:29 +0000 (12:45 +0000)]
[ELF] - Fix cref.s test case.

The intention of -gc-sections flag was to check
that discarded is not in the output. It should be
specified in the executable command line invocation
and also, the symbol must be global as local symbols
are anyways not printed.

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

llvm-svn: 329559

6 years agoTry to fix libclang reproducer tests after r329465
Hans Wennborg [Mon, 9 Apr 2018 12:21:12 +0000 (12:21 +0000)]
Try to fix libclang reproducer tests after r329465

They were failing on Windows because the output YAML didn't parse:

  YAML:1:664: error: Unrecognized escape code!

  {"toolchain":"D:\\buildslave\\clang-x64-ninja-win7\\stage1",
    "libclang.operation":"complete", "libclang.opts":1, "args":["clang",
    "-fno-spell-checking",
    "D:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\test\Index\create-libclang-completion-reproducer.c",
    "-Xclang", "-detailed-preprocessing-record",
    "-fallow-editor-placeholders"],
    "invocation-args":["-code-completion-at=D:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\test\Index\create-libclang-completion-reproducer.c:10:1"],
    "unsaved_file_hashes":[{"name":"D:\\buildslave\\clang-x64-ninja-win7\\llvm\\tools\\clang\\test\\Index\\create-libclang-completion-reproducer.c",
      "md5":"aee23773de90e665992b48209351d70e"}]}

This adds some more escaping to try to make it work.

llvm-svn: 329558

6 years ago[ELF] - Allow LLD to produce file symbols.
George Rimar [Mon, 9 Apr 2018 11:43:52 +0000 (11:43 +0000)]
[ELF] - Allow LLD to produce file symbols.

This is for PR36716 and
this enables emitting STT_FILE symbols.

Output size affect is minor:
lld binary size changes from 52,883,408 to 52,949,400
clang binary size changes from 83,136,456 to 83,219,600

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

llvm-svn: 329557

6 years ago[X86][SSE] Fix f32 mul/div itinerary groups typo
Simon Pilgrim [Mon, 9 Apr 2018 10:45:53 +0000 (10:45 +0000)]
[X86][SSE] Fix f32 mul/div itinerary groups typo

The RM folded itineraries were incorrectly using the f64 version.

llvm-svn: 329556

6 years agoMake the test case from r329552 more portable
Pavel Labath [Mon, 9 Apr 2018 09:11:40 +0000 (09:11 +0000)]
Make the test case from r329552 more portable

- when tuning for SCE debugger (default for ps4 targets), we will not emit
  the DW_AT_linkage_name, which this test needs. I explicitly set the
  debugger tuning parameter to get the attribute always.
- darwin targets did not like the "section .text.startup" fragment of
  the test. This is not actually needed for the test, so I remove it.

llvm-svn: 329555

6 years ago[dsymutil] Remove trailing colon. NFC
Jonas Devlieghere [Mon, 9 Apr 2018 09:10:34 +0000 (09:10 +0000)]
[dsymutil] Remove trailing colon. NFC

llvm-svn: 329554

6 years ago[dsymutil] Don't try to load Swift ASTs as objects.
Jonas Devlieghere [Mon, 9 Apr 2018 09:09:59 +0000 (09:09 +0000)]
[dsymutil] Don't try to load Swift ASTs as objects.

With the threading refactoring, loading of object files happens before
checking whether we're dealing with a swift AST. While that's not an
issue per se, it causes a warning to be printed:

  warning: /path/to/a.swiftmodule: The file was not recognized as a valid object file
  note: while processing /path/to/a.swiftmodule

This suppresses the warning by checking for a Swift AST before
attempting to load is as an object file.

rdar://39240444

llvm-svn: 329553

6 years ago[CodeGen/AccelTable]: Don't emit accelerator entries for functions with no names
Pavel Labath [Mon, 9 Apr 2018 08:41:57 +0000 (08:41 +0000)]
[CodeGen/AccelTable]: Don't emit accelerator entries for functions with no names

Summary:
We were emitting accelerator entries for functions with no name, which
is contrary to the DWARF v5 spec: "All other (i.e., *not*
DW_TAG_namespace) debugging information entries without a DW_AT_name
attribute are excluded." Besides that, a name table entry with an empty
string as a key is fairly useless.

We can sometimes end up with functions which have a DW_AT_linkage_name but no
DW_AT_name. One such example is the global-constructor-initialization functions,
which C++ compilers synthesize for each compilation unit with global
constructors.
A very strict reading of the DWARF v5 spec would suggest that we should not even
emit the accelerator entry for the linkage name in this case, but I don't think
we should go that far.

I found this when running the dwarf verifier over llvm codebase compiled
with DWARF v5 accelerator tables.

Reviewers: JDevlieghere, aprantl, dblaikie

Subscribers: vleschuk, clayborg, echristo, probinson, llvm-commits

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

llvm-svn: 329552

6 years ago[DAGCombine] Improve ReduceLoad for SRL
Sam Parker [Mon, 9 Apr 2018 08:16:11 +0000 (08:16 +0000)]
[DAGCombine] Improve ReduceLoad for SRL

Recommitting r329283, third time lucky...

If the SRL node is only used by an AND, we may be able to set the
ExtVT to the width of the mask, making the AND redundant. To support
this, another check has been added in isLegalNarrowLoad which queries
whether the load is valid.

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

llvm-svn: 329551

6 years agoFix unused variable warning.
Chandler Carruth [Mon, 9 Apr 2018 07:26:42 +0000 (07:26 +0000)]
Fix unused variable warning.

llvm-svn: 329550

6 years ago[X86] Merge some of the autoupgrade handling for masked intrinsics that just need...
Craig Topper [Mon, 9 Apr 2018 06:15:09 +0000 (06:15 +0000)]
[X86] Merge some of the autoupgrade handling for masked intrinsics that just need to upgrade to an unmasked version plus a select. NFCI

These are were previously grouped in small groups of similarish intrinsics. But all the intrinsics have the same number of arguments and the same order. So we can move them all into a larger group for handling.

llvm-svn: 329549

6 years agoRemove immediate dominator heuristic for error block detection.
Michael Kruse [Mon, 9 Apr 2018 06:07:44 +0000 (06:07 +0000)]
Remove immediate dominator heuristic for error block detection.

This patch removes the heuristic in
- Polly :: lib/Support/ScopHelper.cpp

The heuristic forces blocks that directly follow a loop header to not to be considered error blocks.
It was introduced in r249611 with the following commit message:

>   This replaces the support for user defined error functions by a
>   heuristic that tries to determine if a call to a non-pure function
>   should be considered "an error". If so the block is assumed not to be
>   executed at runtime. While treating all non-pure function calls as
>   errors will allow a lot more regions to be analyzed, it will also
>   cause us to dismiss a lot again due to an infeasible runtime context.
>   This patch tries to limit that effect. A non-pure function call is
>   considered an error if it is executed only in conditionally with
>   regards to a cheap but simple heuristic.

In the code below `CCK_Abort2()` would be considered as an error block, but not `CCK_Abort1()` due to this heuristic.
```
for (int i = 0; i < n; i+=1) {
  if (ErrorCondition1)
    CCK_Abort1(); // No __attribute__((noreturn))
  if (ErrorCondition2)
    CCK_Abort2(); // No __attribute__((noreturn))
}
```

This does not seem useful. Checking error conditions in the beginning of some work is quite common. It causes a switch default-case to be not considered an error block in SPEC's cactuBSSN. The comment justifying the heuristic mentions a "load", which does not seem to be applicable here. It has been proposed to remove the heuristic.

In addition, the patch fixes the following test cases:
- Polly :: ScopDetect/mod_ref_read_pointer.ll
- Polly :: ScopInfo/max-loop-depth.ll
- Polly :: ScopInfo/mod_ref_access_pointee_arguments.ll
- Polly :: ScopInfo/mod_ref_read_pointee_arguments.ll
- Polly :: ScopInfo/mod_ref_read_pointer.ll
- Polly :: ScopInfo/mod_ref_read_pointers.ll

The test cases failed after removing the heuristic.

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

Contributed-by: Lorenzo Chelini <l.chelini@icloud.com>
llvm-svn: 329548

6 years ago[IRCE] Relax restriction on collected range checks
Max Kazantsev [Mon, 9 Apr 2018 06:01:22 +0000 (06:01 +0000)]
[IRCE] Relax restriction on collected range checks

In IRCE, we have a very old legacy check that works when we collect comparisons that we
treat as range checks. It ensures that the value against which the indvar is compared is
loop invariant and is also positive.

This latter condition remained there since the times when IRCE was only able to handle
signed latch comparison. As the optimization evolved, it now learned how to intersect
signed or unsigned ranges, and this logic has no reliance on the fact that the right border
of each range should be positive.

The old implementation of this non-negativity check was also naive enough and just looked
into ranges (while most of other IRCE logic tries to use power of SCEV implications), so this
check did not allow to deal with the most simple case that looks like follows:

  int size; // not known non-negative
  int length; //known non-negative;
  i = 0;
  if (size != 0) {
    do {
      range_check(i < size);
      range_check(i < length);
    ++i;
    } while (i < size)
  }

In this case, even if from some dominating conditions IRCE could parse loop
structure, it could only remove the range check against `length` and simply
ignored the check against `size`.

In this patch we remove this obsolete check. It will allow IRCE to pick comparison
against `size` as a potential range check and then let Range Intersection logic
decide whether it is OK to eliminate it or not.

Differential Revision: https://reviews.llvm.org/D45362
Reviewed By: samparker

llvm-svn: 329547

6 years ago[NFC] fix trivial typos in comments and error message
Hiroshi Inoue [Mon, 9 Apr 2018 04:37:53 +0000 (04:37 +0000)]
[NFC] fix trivial typos in comments and error message

"is is" -> "is", "are are" -> "are"

llvm-svn: 329546

6 years agoRevert "[CMake] Use custom command and target to install libc++ headers"
Petr Hosek [Mon, 9 Apr 2018 04:36:04 +0000 (04:36 +0000)]
Revert "[CMake] Use custom command and target to install libc++ headers"

This reverts commit r329544 which is failing on libcxx standalone bots.

llvm-svn: 329545

6 years ago[CMake] Use custom command and target to install libc++ headers
Petr Hosek [Mon, 9 Apr 2018 04:23:04 +0000 (04:23 +0000)]
[CMake] Use custom command and target to install libc++ headers

Using file(COPY FILE...) has several downsides. Since the file command
is only executed at configuration time, any changes to headers made
after the initial CMake execution are ignored. This can lead to subtle
errors since the just built Clang will be using stale libc++ headers.
Furthermore, since the headers are copied prior to executing the build
system, this may hide missing dependencies on libc++ from other LLVM
components.

This changes replaces the use of file(COPY FILE...) command with a
custom command and target which addresses all aforementioned issues and
matches the implementation already used by other LLVM components that
also install headers like Clang builtin headers.

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

llvm-svn: 329544

6 years ago[XRay][llvm+clang] Consolidate attribute list files
Dean Michael Berris [Mon, 9 Apr 2018 04:02:09 +0000 (04:02 +0000)]
[XRay][llvm+clang] Consolidate attribute list files

Summary:
This change consolidates the always/never lists that may be provided to
clang to externally control which functions should be XRay instrumented
by imbuing attributes. The files follow the same format as defined in
https://clang.llvm.org/docs/SanitizerSpecialCaseList.html for the
sanitizer blacklist.

We also deprecate the existing `-fxray-instrument-always=` and
`-fxray-instrument-never=` flags, in favour of `-fxray-attr-list=`.

This fixes http://llvm.org/PR34721.

Reviewers: echristo, vlad.tsyrklevich, eugenis

Reviewed By: vlad.tsyrklevich

Subscribers: llvm-commits, cfe-commits

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

llvm-svn: 329543

6 years agoRemove MachineLoopInfo dependency from AsmPrinter.
Michael Zolotukhin [Mon, 9 Apr 2018 00:54:47 +0000 (00:54 +0000)]
Remove MachineLoopInfo dependency from AsmPrinter.

Summary:
Currently MachineLoopInfo is used in only two places:
1) for computing IsBasicBlockInsideInnermostLoop field of MCCodePaddingContext, and it is never used.
2) in emitBasicBlockLoopComments, which is called only if `isVerbose()` is true.
Despite that, we currently have a dependency on MachineLoopInfo, which makes
pass manager to compute it and MachineDominator Tree. This patch removes the
use (1) and makes the use (2) lazy, thus avoiding some redundant
recomputations.

Reviewers: opaparo, gadi.haber, rafael, craig.topper, zvi

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

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

llvm-svn: 329542

6 years ago[test] Fix Container::insert(value_type const&) tests
Eric Fiselier [Sun, 8 Apr 2018 21:57:35 +0000 (21:57 +0000)]
[test] Fix Container::insert(value_type const&) tests

Patch from Joe Loser.

Several unit tests meaning to test the behavior of lvalue insertion incorrectly
pass rvalues. Fixes bug PR # 27394

Reviewed as https://reviews.llvm.org/D44411

llvm-svn: 329541

6 years ago[TargetSchedule] shrink interface for init(); NFCI
Sanjay Patel [Sun, 8 Apr 2018 19:56:04 +0000 (19:56 +0000)]
[TargetSchedule] shrink interface for init(); NFCI

The TargetSchedModel is always initialized using the TargetSubtargetInfo's
MCSchedModel and TargetInstrInfo, so we don't need to extract those and
pass 3 parameters to init().

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

llvm-svn: 329540

6 years ago[X86] Add SchedWrites for CMOV and SETCC. Use them to remove InstRWs.
Craig Topper [Sun, 8 Apr 2018 17:53:18 +0000 (17:53 +0000)]
[X86] Add SchedWrites for CMOV and SETCC. Use them to remove InstRWs.

Summary:
Cmov and setcc previously used WriteALU, but on Intel processors at least they are more restricted than basic ALU ops.

This patch adds new SchedWrites for them and removes the InstRWs. I had to leave some InstRWs for CMOVA/CMOVBE and SETA/SETBE because those have an extra uop relative to the other condition codes on Intel CPUs.

The test changes are due to fixing a missing ZnAGU dependency on the memory form of setcc.

Reviewers: RKSimon, andreadb, GGanesh

Reviewed By: RKSimon

Subscribers: GGanesh, llvm-commits

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

llvm-svn: 329539

6 years ago[X86][Znver1] Remove InstRWs for BLENDVPS/PD
Craig Topper [Sun, 8 Apr 2018 17:53:15 +0000 (17:53 +0000)]
[X86][Znver1] Remove InstRWs for BLENDVPS/PD

Summary:
This removes the InstRWs for BLENDVPS/PD in favor of WriteFVarBlend. The latency listed was 3 cycles but WriteFVarBlend is defined as 1 cycle latency. The 1 cycle latency matches Agner Fog's data.

The patterns were missing the VEX forms which is why there are no test changes. We don't test "-mcpu=znver1 -mattr=-avx"

Reviewers: RKSimon, GGanesh

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 329538

6 years ago[dsymutil] Don't crash on empty CU
Jonas Devlieghere [Sun, 8 Apr 2018 17:35:17 +0000 (17:35 +0000)]
[dsymutil] Don't crash on empty CU

Add some additional checks so we don't crash on empty compile units.

llvm-svn: 329537

6 years ago[Support] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sun, 8 Apr 2018 16:46:22 +0000 (16:46 +0000)]
[Support] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: chandlerc, jordan_rose, bkramer

Reviewed By: bkramer

Subscribers: llvm-commits

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

llvm-svn: 329536

6 years ago[PowerPC] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sun, 8 Apr 2018 16:45:04 +0000 (16:45 +0000)]
[PowerPC] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: hfinkel, RKSimon

Reviewed By: RKSimon

Subscribers: nemanjai, kbarton, llvm-commits

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

llvm-svn: 329535

6 years ago[X86] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sun, 8 Apr 2018 16:42:52 +0000 (16:42 +0000)]
[X86] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: chandlerc, craig.topper, RKSimon

Reviewed By: chandlerc, craig.topper

Subscribers: llvm-commits

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

llvm-svn: 329534

6 years agoNFC: Update NewGVN invariant.group test
Piotr Padlewski [Sun, 8 Apr 2018 16:04:09 +0000 (16:04 +0000)]
NFC: Update NewGVN invariant.group test

llvm-svn: 329533

6 years ago[llvm-mca] Simplify code. NFC
Andrea Di Biagio [Sun, 8 Apr 2018 15:10:19 +0000 (15:10 +0000)]
[llvm-mca] Simplify code. NFC

llvm-svn: 329532

6 years agoMark invariant.group as experimental
Piotr Padlewski [Sun, 8 Apr 2018 13:53:04 +0000 (13:53 +0000)]
Mark invariant.group as experimental

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

llvm-svn: 329531

6 years ago[LIR] Reorder header. NFC
Xin Tong [Sun, 8 Apr 2018 13:19:53 +0000 (13:19 +0000)]
[LIR] Reorder header. NFC

llvm-svn: 329530

6 years ago[X86] Regenerate and + immediate mask tests
Simon Pilgrim [Sun, 8 Apr 2018 12:31:52 +0000 (12:31 +0000)]
[X86] Regenerate and + immediate mask tests

Added i686 checks

llvm-svn: 329529

6 years ago[X86][PKU] Regenerate rdpkru/wrpkru intrinsic tests
Simon Pilgrim [Sun, 8 Apr 2018 12:30:30 +0000 (12:30 +0000)]
[X86][PKU] Regenerate rdpkru/wrpkru intrinsic tests

Added i686 checks

llvm-svn: 329528

6 years ago[X86][SSE3] Regenerate mwait/monitor intrinsic tests
Simon Pilgrim [Sun, 8 Apr 2018 12:29:11 +0000 (12:29 +0000)]
[X86][SSE3] Regenerate mwait/monitor intrinsic tests

Added i686 checks

llvm-svn: 329527

6 years agoNFC: delete ValueMap move ctor
Piotr Padlewski [Sun, 8 Apr 2018 12:23:58 +0000 (12:23 +0000)]
NFC: delete ValueMap move ctor

llvm-svn: 329526

6 years agoDAGCombiner: Combine SDIV with non-splat vector pow2 divisor
Zvi Rackover [Sun, 8 Apr 2018 11:35:20 +0000 (11:35 +0000)]
DAGCombiner: Combine SDIV with non-splat vector pow2 divisor

Summary:
Extend existing SDIV combine for pow2 constant divider to handle
non-splat vectors of pow2 constants.

Reviewers: RKSimon, craig.topper, spatel, hfinkel, efriedma

Reviewed By: RKSimon

Subscribers: magabari, llvm-commits

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

llvm-svn: 329525

6 years ago[X86][Btver2] Add vector extract costs
Simon Pilgrim [Sun, 8 Apr 2018 11:26:26 +0000 (11:26 +0000)]
[X86][Btver2] Add vector extract costs

llvm-svn: 329524

6 years ago[ADT] Fix MapVector when 'Map::mapped_type != unsigned'.
Eric Fiselier [Sun, 8 Apr 2018 08:48:58 +0000 (08:48 +0000)]
[ADT] Fix MapVector when 'Map::mapped_type != unsigned'.

Previously MapVector assumed `Map::mapped_type` was `unsigned`.
This caused problems when using MapVector with a user-specified
map where this didn't hold (For example StringMap<unsigned>).

This patch adjusts MapVector to use the same type as the underlying
map, avoiding reference binding errors in functions like `insert`.

llvm-svn: 329523

6 years ago[LLVMTestingSupport] Add explicit linkage to LLVMSupport
Michal Gorny [Sun, 8 Apr 2018 06:49:17 +0000 (06:49 +0000)]
[LLVMTestingSupport] Add explicit linkage to LLVMSupport

Explicitly link LLVMTestingSupport library against LLVMSupport. This
is necessary to fix linking errors when LLVMTestingSupport is built
as a shared library (with BUILD_SHARED_LIBS=ON) and -Wl,-z,defs is used.

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

llvm-svn: 329522

6 years ago[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.
Eric Fiselier [Sun, 8 Apr 2018 06:21:33 +0000 (06:21 +0000)]
[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.

Summary:
Currently clang doesn't do qualified lookup when building indirect field decl references. This causes ambiguity when the field is in a base class to which there are multiple valid paths  even though a qualified name is used.

For example:
```
class B {
protected:
 int i;
 union { int j; };
};

class X : public B { };
class Y : public B { };

class Z : public X, public Y {
 int a() { return X::i; } // works
 int b() { return X::j; } // fails
};
```

Reviewers: rsmith, aaron.ballman, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 329521

6 years agoRevert "[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple...
Eric Fiselier [Sun, 8 Apr 2018 06:05:33 +0000 (06:05 +0000)]
Revert "[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases."

This reverts commit r329519. There are some unaddressed test failures.

llvm-svn: 329520

6 years ago[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.
Eric Fiselier [Sun, 8 Apr 2018 05:50:01 +0000 (05:50 +0000)]
[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.

Summary:
Currently clang doesn't do qualified lookup when building indirect field decl references. This causes ambiguity when the field is in a base class to which there are multiple valid paths  even though a qualified name is used.

For example:
```
class B {
protected:
 int i;
 union { int j; };
};

class X : public B { };
class Y : public B { };

class Z : public X, public Y {
 int a() { return X::i; } // works
 int b() { return X::j; } // fails
};
```

Reviewers: rsmith, aaron.ballman, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 329519

6 years ago[Sema] Remove dead code in BuildAnonymousStructUnionMemberReference. NFCI
Eric Fiselier [Sun, 8 Apr 2018 05:12:55 +0000 (05:12 +0000)]
[Sema] Remove dead code in BuildAnonymousStructUnionMemberReference. NFCI

Summary:
This patch cleans up a bunch of dead or unused code in BuildAnonymousStructUnionMemberReference.

The dead code was a branch that built a new CXXThisExpr when we weren't given a base object expression or base variable.
However, BuildAnonymousFoo has only two callers. One of which always builds a base object expression first, the second only calls when the IndirectFieldDecl is not a C++ class member. Even within C this branch seems entirely unused.

I tried diligently to write a test which hit it with no success.

This patch removes the branch and replaces it with an assertion that we were given either a base object expression or a base variable.

Reviewers: rsmith, aaron.ballman, majnemer, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 329518

6 years ago[Sema] Fix PR22637 - IndirectFieldDecl's discard qualifiers during template instantia...
Eric Fiselier [Sun, 8 Apr 2018 05:11:59 +0000 (05:11 +0000)]
[Sema] Fix PR22637 - IndirectFieldDecl's discard qualifiers during template instantiation.

Summary:
Currently Clang fails to propagate qualifiers from the `CXXThisExpr` to the rebuilt `FieldDecl` for IndirectFieldDecls. For example:

```
template <class T> struct Foo {
  struct { int x; };
  int y;
  void foo() const {
      static_assert(__is_same(int const&, decltype((y))));
      static_assert(__is_same(int const&, decltype((x)))); // assertion fails
  }
};
template struct Foo<int>;
```

The fix is to delegate rebuilding of the MemberExpr to `BuildFieldReferenceExpr` which correctly propagates the qualifiers.

Reviewers: rsmith, lebedev.ri, aaron.ballman, bkramer, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 329517

6 years ago[DAGCombiner] Fold (zext (and/or/xor (shl/shr (load x), cst), cst))
Guozhi Wei [Sat, 7 Apr 2018 23:36:10 +0000 (23:36 +0000)]
[DAGCombiner] Fold (zext (and/or/xor (shl/shr (load x), cst), cst))

In our real world application, we found the following optimization is missed in DAGCombiner

(zext (and/or/xor (shl/shr (load x), cst), cst)) -> (and/or/xor (shl/shr (zextload x), (zext cst)), (zext cst))

If the user of original zext is an add, it may enable further lea optimization on x86.

This patch add a new function CombineZExtLogicopShiftLoad to do this optimization.

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

llvm-svn: 329516

6 years ago[libclang] Add clang_File_tryGetRealPathName
Fangrui Song [Sat, 7 Apr 2018 20:50:35 +0000 (20:50 +0000)]
[libclang] Add clang_File_tryGetRealPathName

Summary:
clang_getFileName() may return a path relative to WorkingDir.
On Arch Linux, during clang_indexTranslationUnit(), clang_getFileName() on
CXIdxIncludedIncludedFileInfo::file may return
"/../lib64/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/string",
for `#include <string>`.

I presume WorkingDir is somehow changed to /usr/lib or /usr/include and
clang_getFileName() returns a path relative to WorkingDir.

clang_File_tryGetRealPathName() returns "/usr/include/c++/7.3.0/string"
which is more useful for the indexer in this case.

Subscribers: cfe-commits

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

llvm-svn: 329515

6 years agoRevert "Followup for r329293: Temporarily disable the breaking test on windows."
Philip Pfaffe [Sat, 7 Apr 2018 20:22:38 +0000 (20:22 +0000)]
Revert "Followup for r329293: Temporarily disable the breaking test on windows."

This reverts commit r329393 / b52ba35e7759cd4002221be1dbb63ec80fde21ec.

llvm-svn: 329514

6 years agoGeneralize the swiftcall API since being passed indirectly isn't
John McCall [Sat, 7 Apr 2018 20:16:47 +0000 (20:16 +0000)]
Generalize the swiftcall API since being passed indirectly isn't
C++-specific anymore.

llvm-svn: 329513

6 years ago[Driver] Update GCC libraries detection logic for Gentoo.
Manoj Gupta [Sat, 7 Apr 2018 19:59:58 +0000 (19:59 +0000)]
[Driver] Update GCC libraries detection logic for Gentoo.

Summary:
1. Find GCC's LDPATH from the actual GCC config file.
2. Avoid picking libraries from a similar named tuple if the exact
   tuple is installed.

Reviewers: mgorny, chandlerc, thakis, rnk

Reviewed By: mgorny, rnk

Subscribers: cfe-commits, mgorny

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

llvm-svn: 329512

6 years ago[X86] Regenerate atom pshufb test
Simon Pilgrim [Sat, 7 Apr 2018 19:50:09 +0000 (19:50 +0000)]
[X86] Regenerate atom pshufb test

llvm-svn: 329511

6 years ago[X86] Combine vXi64 multiplies to MULDQ/MULUDQ during DAG combine instead of lowering.
Craig Topper [Sat, 7 Apr 2018 19:09:52 +0000 (19:09 +0000)]
[X86] Combine vXi64 multiplies to MULDQ/MULUDQ during DAG combine instead of lowering.

Previously we used a custom lowering for this because of the AVX1 splitting requirement. But we can do the split during DAG combine if we check the types and subtarget

llvm-svn: 329510

6 years ago[DAGCombiner] Add a combine to turn a build vector of zero extends of extract vector...
Craig Topper [Sat, 7 Apr 2018 19:09:50 +0000 (19:09 +0000)]
[DAGCombiner] Add a combine to turn a build vector of zero extends of extract vector elts into a vector zero extend and possibly an extract subvector.

llvm-svn: 329509

6 years agoAllow equality comparisons between block pointers and
John McCall [Sat, 7 Apr 2018 17:42:06 +0000 (17:42 +0000)]
Allow equality comparisons between block pointers and
block-pointer-compatible ObjC object pointer types.

Patch by Dustin Howett!

llvm-svn: 329508

6 years ago[llgo] Move SetSubprogram
Robert Widmann [Sat, 7 Apr 2018 16:26:59 +0000 (16:26 +0000)]
[llgo] Move SetSubprogram

Summary: Fixes the bots - I moved LLVMSetSubprogram into the DIBuilder bindings, so the Go bindings need to move as well.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 329505

6 years ago[CostModel][X86] Regenerate vector reduction cost tests with update_analyze_test_chec...
Simon Pilgrim [Sat, 7 Apr 2018 14:20:10 +0000 (14:20 +0000)]
[CostModel][X86] Regenerate vector reduction cost tests with update_analyze_test_checks.py

NOTE: We're only really interested in the extractelement cost (which represents the entire reduction).
llvm-svn: 329504

6 years ago[InstCombine] simplify code that propagates FMF; NFC
Sanjay Patel [Sat, 7 Apr 2018 14:14:23 +0000 (14:14 +0000)]
[InstCombine] simplify code that propagates FMF; NFC

llvm-svn: 329503

6 years ago[CostModel][X86] Regenerate vector select cost tests with update_analyze_test_checks.py
Simon Pilgrim [Sat, 7 Apr 2018 14:09:54 +0000 (14:09 +0000)]
[CostModel][X86] Regenerate vector select cost tests with update_analyze_test_checks.py

llvm-svn: 329502

6 years ago[InstCombine] add/move tests for fsub folds; NFC
Sanjay Patel [Sat, 7 Apr 2018 14:07:58 +0000 (14:07 +0000)]
[InstCombine] add/move tests for fsub folds; NFC

There are a pair of folds that try to merge fneg into fsub
with an intervening cast, but as shown in the FIXME tests,
they can create extra instructions.

llvm-svn: 329501

6 years ago[CostModel][X86] Regenerate vector integer truncation cost tests with update_analyze_...
Simon Pilgrim [Sat, 7 Apr 2018 14:05:35 +0000 (14:05 +0000)]
[CostModel][X86] Regenerate vector integer truncation cost tests with update_analyze_test_checks.py

llvm-svn: 329500

6 years ago[CostModel][X86] Regenerate silvermont (and added goldmont) cost tests with update_an...
Simon Pilgrim [Sat, 7 Apr 2018 14:02:14 +0000 (14:02 +0000)]
[CostModel][X86] Regenerate silvermont (and added goldmont) cost tests with update_analyze_test_checks.py

llvm-svn: 329499

6 years ago[CostModel][X86] Fix v32i16/v64i8 SETCC costs on AVX512BW targets
Simon Pilgrim [Sat, 7 Apr 2018 13:24:33 +0000 (13:24 +0000)]
[CostModel][X86] Fix v32i16/v64i8 SETCC costs on AVX512BW targets

llvm-svn: 329498

6 years ago[CostModel][X86] Regenerate vector comparison cost tests with update_analyze_test_che...
Simon Pilgrim [Sat, 7 Apr 2018 12:47:35 +0000 (12:47 +0000)]
[CostModel][X86] Regenerate vector comparison cost tests with update_analyze_test_checks.py

llvm-svn: 329497

6 years ago[llvm-exegesis] Fix unused return value warning and add a useful error message for...
Simon Pilgrim [Sat, 7 Apr 2018 11:37:21 +0000 (11:37 +0000)]
[llvm-exegesis] Fix unused return value warning and add a useful error message for event counter reads.

llvm-svn: 329496

6 years ago[clang-tidy] Fix compilation for MSVS@PSP4 for ParentVirtualCallCheck.cpp
Zinovy Nis [Sat, 7 Apr 2018 11:22:01 +0000 (11:22 +0000)]
[clang-tidy] Fix compilation for MSVS@PSP4 for ParentVirtualCallCheck.cpp

There's an error for PSP4 platform only:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\algorithm(95):
error C2719: '_Pred': formal parameter with requested alignment of 8 won't be aligned

llvm-svn: 329495

6 years agoReapply ARM: Do not spill CSR to stack on entry to noreturn functions
Tim Northover [Sat, 7 Apr 2018 10:57:03 +0000 (10:57 +0000)]
Reapply ARM: Do not spill CSR to stack on entry to noreturn functions

Should fix UBSan bot by also checking there's no "uwtable" attribute
before skipping. Otherwise the unwind table will be useless since its
moves expect CSRs to actually be preserved.

A noreturn nounwind function can be expected to never return in any way, and by
never returning it will also never have to restore any callee-saved registers
for its caller. This makes it possible to skip spills of those registers during
function entry, saving some stack space and time in the process. This is rather
useful for embedded targets with limited stack space.

Should fix PR9970.

Patch mostly by myeisha (pmb).

llvm-svn: 329494

6 years ago[Sema] Extend -Wself-assign and -Wself-assign-field to warn on overloaded self-assign...
Roman Lebedev [Sat, 7 Apr 2018 10:39:21 +0000 (10:39 +0000)]
[Sema] Extend -Wself-assign and -Wself-assign-field to warn on overloaded self-assignment (classes)

Summary:
This has just bit me, so i though it would be nice to avoid that next time :)
Motivational case:
  https://godbolt.org/g/cq9UNk
Basically, it's likely to happen if you don't like shadowing issues,
and use `-Wshadow` and friends. And it won't be diagnosed by clang.

The reason is, these self-assign diagnostics only work for builtin assignment
operators. Which makes sense, one could have a very special operator=,
that does something unusual in case of self-assignment,
so it may make sense to not warn on that.

But while it may be intentional in some cases, it may be a bug in other cases,
so it would be really great to have some diagnostic about it...

Reviewers: aaron.ballman, rsmith, rtrieu, nikola, rjmccall, dblaikie

Reviewed By: rjmccall

Subscribers: EricWF, lebedev.ri, thakis, Quuxplusone, cfe-commits

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

llvm-svn: 329493

6 years ago[InstCombine] Get rid of select of bittest (PR36950 / PR17564)
Roman Lebedev [Sat, 7 Apr 2018 10:37:24 +0000 (10:37 +0000)]
[InstCombine] Get rid of select of bittest (PR36950 / PR17564)

Summary:
See [[ https://bugs.llvm.org/show_bug.cgi?id=36950 | PR36950 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=17564 | PR17564 ]], D45065, D45107
https://godbolt.org/g/iAYRup

Alive proof: https://rise4fun.com/Alive/uiH

Testing: `ninja check-llvm`

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 329492

6 years ago[unittests] ADT: silence -Wself-assign diagnostics
Roman Lebedev [Sat, 7 Apr 2018 10:37:18 +0000 (10:37 +0000)]
[unittests] ADT: silence -Wself-assign diagnostics

Summary:
D44883 extends -Wself-assign to also work on C++ classes.
In it's current state (as suggested by @rjmccall), it is not under it's own sub-group.
Since that diag is enabled by `-Wall`, stage2 testing showed that:
* It does not fire on any llvm code
* It does fire for these 3 unittests
* It does fire for libc++ tests

This diff simply silences those new warnings in llvm's unittests.
A similar diff will be needed for libcxx. (`libcxx/test/std/language.support/support.types/byteops/`, maybe something else)

Since i don't think we want to repeat rL322901, let's talk about it.
I've subscribed everyone who i think might be interested...

There are several ways forward:
* Not extend -Wself-assign, close D44883. Not very productive outcome i'd say.
* Keep D44883 in it's current state.
  Unless your custom overloaded operators do something unusual for when self-assigning,
  the warning is no less of a false-positive than the current -Wself-assign.
  Except for tests of course, there you'd want to silence it. The current suggestion is:
  ```
  S a;
  a = (S &)a;
  ```
* Split the diagnostic in two - `-Wself-assign-builtin` (i.e. what is `-Wself-assign` in trunk),
  and `-Wself-assign-overloaded` - the new part in D44883.
  Since, as i said, i'm not really sure why it would be less of a error than the current `-Wself-assign`,
  both would still be in `-Wall`. That way one could simply pass `-Wno-self-assign-overloaded` for all the tests.
  Pretty simple to do, and will surely work.
* Split the diagnostic in two - `-Wself-assign-trivial`, and `-Wself-assign-nontrivial`.
  The choice of which diag to emit would depend on trivial-ness of that particular operator.
  The current `-Wself-assign` would be `-Wself-assign-trivial`.
  https://godbolt.org/g/gwDASe - `A`, `B` and `C` case would be treated as trivial, and `D`, `E` and `F` as non-trivial.
  Will be the most complicated to implement.

Thoughts?

Reviewers: aaron.ballman, rsmith, rtrieu, rjmccall, dblaikie, atrick, gottesmm

Reviewed By: dblaikie

Subscribers: lebedev.ri, phosek, vsk, rnk, thakis, sammccall, mclow.lists, llvm-commits, rjmccall

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

llvm-svn: 329491

6 years ago[libcxx][test] Silence -Wself-assign diagnostics
Roman Lebedev [Sat, 7 Apr 2018 10:36:03 +0000 (10:36 +0000)]
[libcxx][test] Silence -Wself-assign diagnostics

Summary:
D44883 extends -Wself-assign to also work on C++ classes.
These new warnings pop up in the test suite, so they have to be silenced.

Please refer to the D45082 for disscussion on whether this is the right way to solve this.

Testing: `ninja check-libcxx check-libcxxabi` in stage-2 build.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: Quuxplusone, cfe-commits

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

llvm-svn: 329490

6 years agoFix stack-use-after-scope in test previously hidden by -fmerge-all-constants
Vitaly Buka [Sat, 7 Apr 2018 09:46:00 +0000 (09:46 +0000)]
Fix stack-use-after-scope in test previously hidden by -fmerge-all-constants

llvm-svn: 329489

6 years ago[LLVM-C] Move DIBuilder Bindings For Block Scopes
Robert Widmann [Sat, 7 Apr 2018 06:07:55 +0000 (06:07 +0000)]
[LLVM-C] Move DIBuilder Bindings For Block Scopes

Summary: Move LLVMDIBuilderCreateFunction , LLVMDIBuilderCreateLexicalBlock, and LLVMDIBuilderCreateLexicalBlockFile from Go to LLVM-C.

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark, harlanhaskins

Subscribers: llvm-commits

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

llvm-svn: 329488

6 years agoRevert "ARM: Do not spill CSR to stack on entry to noreturn functions"
Vitaly Buka [Sat, 7 Apr 2018 05:36:44 +0000 (05:36 +0000)]
Revert "ARM: Do not spill CSR to stack on entry to noreturn functions"

Breaks ubsan test TestCases/Misc/missing_return.cpp on ARM

This reverts commit r329287

llvm-svn: 329486

6 years agoUse void() to create a void expression type
Eric Fiselier [Sat, 7 Apr 2018 04:28:11 +0000 (04:28 +0000)]
Use void() to create a void expression type

llvm-svn: 329484

6 years agoConvert line endings of lib/WindowsManifest/CMakeLists.txt to unix.
Nico Weber [Sat, 7 Apr 2018 04:28:08 +0000 (04:28 +0000)]
Convert line endings of lib/WindowsManifest/CMakeLists.txt to unix.

llvm-svn: 329483

6 years agoSort source lists in lib/StaticAnalyzer.
Nico Weber [Sat, 7 Apr 2018 04:25:01 +0000 (04:25 +0000)]
Sort source lists in lib/StaticAnalyzer.

llvm-svn: 329481

6 years agoRemove trailing space in build file.
Nico Weber [Sat, 7 Apr 2018 03:30:28 +0000 (03:30 +0000)]
Remove trailing space in build file.

llvm-svn: 329479

6 years agoMake CodeGen depend just once on clangAnalysis.
Nico Weber [Sat, 7 Apr 2018 03:29:47 +0000 (03:29 +0000)]
Make CodeGen depend just once on clangAnalysis.

llvm-svn: 329477

6 years agoRemove another unnecessary -I flag passed to clang-tblgen.
Nico Weber [Sat, 7 Apr 2018 01:34:36 +0000 (01:34 +0000)]
Remove another unnecessary -I flag passed to clang-tblgen.

llvm-svn: 329476

6 years ago[unittests] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sat, 7 Apr 2018 01:29:45 +0000 (01:29 +0000)]
[unittests] Change std::sort to llvm::sort in response to r327219

r327219 added wrappers to std::sort which randomly shuffle the container before
sorting.  This will help in uncovering non-determinism caused due to undefined
sorting order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of
std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to
llvm::sort.  Refer the comments section in D44363 for a list of all the
required patches.

llvm-svn: 329475

6 years agoWork around missing braces in init warning
Eric Fiselier [Sat, 7 Apr 2018 01:28:54 +0000 (01:28 +0000)]
Work around missing braces in init warning

llvm-svn: 329474

6 years ago[tests] Fix format-binary-non-ascii.s to work with Python 3 on Windows
Aaron Smith [Sat, 7 Apr 2018 00:55:26 +0000 (00:55 +0000)]
[tests] Fix format-binary-non-ascii.s to work with Python 3 on Windows

Some platforms interpret the pound sign as one character. Platforms that use
Python 2.x actually interpret it as two characters because in the Python 2.x
version of lit, the string used for the file name is a byte string and the pound
sign is two bytes.

Patch by Stella Stamenova!

llvm-svn: 329472

6 years agoCOFF: Process /merge flag as we create output sections.
Peter Collingbourne [Sat, 7 Apr 2018 00:46:55 +0000 (00:46 +0000)]
COFF: Process /merge flag as we create output sections.

With this we can merge builtin sections.

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

llvm-svn: 329471

6 years ago[Support] Make line-number cache robust against access patterns.
Graydon Hoare [Sat, 7 Apr 2018 00:44:02 +0000 (00:44 +0000)]
[Support] Make line-number cache robust against access patterns.

Summary:
The LLVM SourceMgr class (which is used indirectly by Swift, though not Clang)
has a routine for looking up line numbers of SMLocs. This routine uses a
shared, special-purpose cache that handles exactly one access pattern
efficiently: looking up the line number of an SMLoc that points into the same
buffer as the last query made to the SourceMgr, at a location in the buffer at
or ahead of the last query.

When this works it's fine, but when it fails it's catastrophic for performancer:
one recent out-of-order access from a Swift utility routine ran for tens of
seconds, spending 99% of its time repeatedly scanning buffers for '\n'.

This change removes the shared cache from the SourceMgr and installs a new
cache in each SrcBuffer. The per-SrcBuffer caches are also "full", in the sense
that rather than caching a single last-query pointer, they cache _all_ the
line-ending offsets, in a binary-searchable array, such that once it's
populated (on first access), all subsequent access patterns run at the same
speed.

Performance measurements I've done show this is actually a little bit faster on
real codebases (though only a couple fractions of a percent). Memory usage is
up by a few tens to hundreds of bytes per SrcBuffer that has a line lookup done
on it; I've attempted to minimize this by using dynamic selection of integer
sized when storing offset arrays. But the main motive here is to
make-impossible the cases we don't always see, that show up by surprise when
there is an out-of-order access pattern.

Reviewers: jordan_rose

Reviewed By: jordan_rose

Subscribers: probinson, llvm-commits

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

llvm-svn: 329470

6 years agoWindows needs the current codepage instead of utf8 sometimes
Aaron Smith [Sat, 7 Apr 2018 00:32:59 +0000 (00:32 +0000)]
Windows needs the current codepage instead of utf8 sometimes

Llvm-mc (and tools that use Path.inc on Windows) assume that strings are utf-8
encoded, however, this is not always the case. On Windows the default codepage
is not utf-8, so most of the time the strings are not utf-8 encoded.

The lld test 'format-binary-non-ascii' uses llvm-mc with a file with non-ascii
characters in the name which is how this bug was found. The test fails when run
using Python 3 because it uses properly encoded unicode strings (Python 2 actually
ends up using a byte string which is not utf-8 encoded, so the test passes, but
that's separate issue).

Patch by Stella Stamenova!

llvm-svn: 329468

6 years agoGeneralize test for 32-bit targets.
Richard Smith [Sat, 7 Apr 2018 00:28:32 +0000 (00:28 +0000)]
Generalize test for 32-bit targets.

llvm-svn: 329467

6 years ago[lit] Fix several Python 2/3 compatibility issues and tests
Aaron Smith [Sat, 7 Apr 2018 00:21:28 +0000 (00:21 +0000)]
[lit] Fix several Python 2/3 compatibility issues and tests

- In Python 2.x, basestring is the base string type, but in
  Python 3.x basestring is not defined and instead str includes
  unicode strings.

- When Python is in a path that includes spaces, it needs to
  be specified with quotes in the test files for it to run.

- The cache.ll test relies on files of a specific size being
  created by Python, but on some versions of Windows the
  files that are created by the current code are one byte
  larger than expected. To fix the test, update file creation
  to always make files of the expected size.

Patch by Stella Stamenova!

llvm-svn: 329466

6 years agoRecommit r329442: Generate Libclang invocation reproducers using a new
Alex Lorenz [Sat, 7 Apr 2018 00:03:27 +0000 (00:03 +0000)]
Recommit r329442: Generate Libclang invocation reproducers using a new
-cc1gen-reproducer driver option

The recommit fixes:
- An MSAN failure (CCPrintOptions wasn't initialized in the Driver)
- Ensures that the strings in the libclang invocation files are escaped

Original message:

This commit is a follow up to the previous work that recorded Libclang invocations
into temporary files: r319702.

It adds a new -cc1 mode to clang: -cc1gen-reproducer. The goal of this mode is to generate
Clang reproducer files for Libclang tool invocation. The JSON format in the invocation
files is not really intended to be stable, so Libclang and Clang should be of the same version
when generating reproducers.
The new mode emits the information about the temporary files and Libclang-specific information
to stdout using JSON.

rdar://35322614

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

llvm-svn: 329465