platform/upstream/llvm.git
6 years ago[X86][Haswell] Strip unnecessary WriteFAdd/WriteFHAdd instruction instrw overrides.
Simon Pilgrim [Sat, 21 Apr 2018 16:20:28 +0000 (16:20 +0000)]
[X86][Haswell] Strip unnecessary WriteFAdd/WriteFHAdd instruction instrw overrides.

llvm-svn: 330514

6 years ago[X86][Broadwell] Remove unnecessary VORPD/VORPS instrw override - missed in D45629
Simon Pilgrim [Sat, 21 Apr 2018 16:17:47 +0000 (16:17 +0000)]
[X86][Broadwell] Remove unnecessary VORPD/VORPS instrw override - missed in D45629

llvm-svn: 330513

6 years ago[llvm-mca][X86] Add AVX2 resource tests
Simon Pilgrim [Sat, 21 Apr 2018 16:12:42 +0000 (16:12 +0000)]
[llvm-mca][X86] Add AVX2 resource tests

llvm-svn: 330512

6 years ago[clang-tidy] Customize FileCheck prefix in check_clang-tidy.py
Zinovy Nis [Sat, 21 Apr 2018 15:23:56 +0000 (15:23 +0000)]
[clang-tidy] Customize FileCheck prefix in check_clang-tidy.py

The patch introduces a new command line option '-check-suffix' for check_clang_tidy.py
to allow multiple %check_clang_tidy% in a single test file.

Sample:

// RUN: %check_clang_tidy -check-suffix=FLAG-1 %s misc-unused-using-decls %t -- -- <options-set-1>
// RUN: %check_clang_tidy -check-suffix=FLAG-2 %s misc-unused-using-decls %t -- -- <options-set-2>
...
+// CHECK-MESSAGES-FLAG-1: :[[@LINE-4]]:10: warning: using decl 'B' is unused [misc-unused-using-decls]
+// CHECK-MESSAGES-FLAG-2: :[[@LINE-7]]:10: warning: using decl 'A' is unused [misc-unused-using-decls]
+// CHECK-FIXES-FLAG-1-NOT: using a::A;$
+// CHECK-FIXES-FLAG-2-NOT: using a::B;$

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

llvm-svn: 330511

6 years ago[X86] Strip unnecessary WriteFRcp/WriteFRsqrt instruction instrw overrides from sched...
Simon Pilgrim [Sat, 21 Apr 2018 15:16:59 +0000 (15:16 +0000)]
[X86] Strip unnecessary WriteFRcp/WriteFRsqrt instruction instrw overrides from scheduler models.

The required the default skylake schedules to be updated - these were being completely overriden by the InstRW and the existing values not used at all.

llvm-svn: 330510

6 years ago[clang-apply-replacements] Make clang-apply-replacements installable
Zinovy Nis [Sat, 21 Apr 2018 15:01:33 +0000 (15:01 +0000)]
[clang-apply-replacements] Make clang-apply-replacements installable

Add a new target for install: install-clang-apply-replacements.
So if you need clang-tidy and clang-apply-replacements tools only,
you may build and install only these tools:

    make install-clang-tidy install-clang-apply-replacements

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

llvm-svn: 330509

6 years ago[X86] Strip unnecessary WriteFShuffle instruction instrw overrides from scheduler...
Simon Pilgrim [Sat, 21 Apr 2018 14:56:56 +0000 (14:56 +0000)]
[X86] Strip unnecessary WriteFShuffle instruction instrw overrides from scheduler models.

llvm-svn: 330508

6 years ago[libclang] Fix LibclangReparseTest.FileName when TMPDIR is set to a symlink
Petr Pavlu [Sat, 21 Apr 2018 14:35:18 +0000 (14:35 +0000)]
[libclang] Fix LibclangReparseTest.FileName when TMPDIR is set to a symlink

Fix testing of clang_File_tryGetRealPathName() in
LibclangReparseTest.FileName when executing in an environment which has
TMPDIR set to a symbolic link that points to an actual directory. The
test would fail because the name returned by
clang_File_tryGetRealPathName() has the symlink resolved but the test
compared it to the original filename of a temporary file.

The patch addresses the problem by checking only that the value returned
by clang_File_tryGetRealPathName() ends with "main.cpp".

Additionally, the patch makes the previous assertion in the test that
checks result of clang_getFileName() stricter. It newly verifies that
the name returned by the function is exactly same as what was given to
clang_parseTranslationUnit()/clang_getFile().

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

llvm-svn: 330507

6 years ago[llvm-mca][X86] Add SSE resource tests to all models
Simon Pilgrim [Sat, 21 Apr 2018 14:16:57 +0000 (14:16 +0000)]
[llvm-mca][X86] Add SSE resource tests to all models

llvm-svn: 330506

6 years ago[X86][SandyBridge] Strip unnecessary MOVQ/CVT instruction instrw overrides.
Simon Pilgrim [Sat, 21 Apr 2018 14:03:40 +0000 (14:03 +0000)]
[X86][SandyBridge] Strip unnecessary MOVQ/CVT instruction instrw overrides.

llvm-svn: 330505

6 years agoTemporarily skip Go TestExpressions on FreeBSD as it hangs
Ed Maste [Sat, 21 Apr 2018 13:59:07 +0000 (13:59 +0000)]
Temporarily skip Go TestExpressions on FreeBSD as it hangs

llvm.org/pr37194

llvm-svn: 330504

6 years ago[X86] Strip unnecessary MMX instruction instrw overrides from scheduler models.
Simon Pilgrim [Sat, 21 Apr 2018 12:15:42 +0000 (12:15 +0000)]
[X86] Strip unnecessary MMX instruction instrw overrides from scheduler models.

llvm-svn: 330503

6 years ago[llvm-mca][X86] Add MMX resource tests
Simon Pilgrim [Sat, 21 Apr 2018 11:28:59 +0000 (11:28 +0000)]
[llvm-mca][X86] Add MMX resource tests

llvm-svn: 330502

6 years ago[X86] Strip unnecessary x87 instruction instrw overrides from scheduler models.
Simon Pilgrim [Sat, 21 Apr 2018 11:25:02 +0000 (11:25 +0000)]
[X86] Strip unnecessary x87 instruction instrw overrides from scheduler models.

llvm-svn: 330501

6 years agoFreeBSD: propagate error to user if memory access fails
Ed Maste [Sat, 21 Apr 2018 11:23:56 +0000 (11:23 +0000)]
FreeBSD: propagate error to user if memory access fails

Previously, an attempt to read an unreadable address reported zeros.
Now, if DoReadMemory or DoWriteMemory encounters error then return 0
(bytes read or written) so that the error is reported to the user.

llvm.org/pr37190

llvm-svn: 330500

6 years ago[llvm-mca][X86] Add X87 resource tests
Simon Pilgrim [Sat, 21 Apr 2018 10:36:19 +0000 (10:36 +0000)]
[llvm-mca][X86] Add X87 resource tests

llvm-svn: 330499

6 years ago[X86][X87] Add missing fldlg2 schedule test
Simon Pilgrim [Sat, 21 Apr 2018 10:35:04 +0000 (10:35 +0000)]
[X86][X87] Add missing fldlg2 schedule test

llvm-svn: 330498

6 years ago[PowerPC] fix incorrect vectorization of abs() on POWER9
Hiroshi Inoue [Sat, 21 Apr 2018 09:32:17 +0000 (09:32 +0000)]
[PowerPC] fix incorrect vectorization of abs() on POWER9

Vectorized loops with abs() returns incorrect results on POWER9. This patch fixes it.
For example the following code returns negative result if input values are negative though it sums up the absolute value of the inputs.

int vpx_satd_c(const int16_t *coeff, int length) {
  int satd = 0;
  for (int i = 0; i < length; ++i) satd += abs(coeff[i]);
  return satd;
}

This problem causes test failures for libvpx.
For vector absolute and vector absolute difference on POWER9, LLVM generates VABSDUW (Vector Absolute Difference Unsigned Word) instruction or variants.
Since these instructions are for unsigned integers, we need adjustment for signed integers.
For abs(sub(a, b)), we generate VABSDUW(a+0x80000000, b+0x80000000). Otherwise, abs(sub(-1, 0)) returns 0xFFFFFFFF(=-1) instead of 1. For abs(a), we generate VABSDUW(a+0x80000000, 0x80000000).

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

llvm-svn: 330497

6 years agoUpdate isl to isl-0.19-107-gc4fe33d8
Tobias Grosser [Sat, 21 Apr 2018 08:34:22 +0000 (08:34 +0000)]
Update isl to isl-0.19-107-gc4fe33d8

This is a regular maintenance update.

llvm-svn: 330496

6 years ago[AArch64] Don't crash trying to resolve __stack_chk_guard.
Eli Friedman [Sat, 21 Apr 2018 00:07:46 +0000 (00:07 +0000)]
[AArch64] Don't crash trying to resolve __stack_chk_guard.

In certain cases, the compiler might try to merge __stack_chk_guard with
another global variable.  (Or someone could theoretically define
__stack_chk_guard as an alias.)  In that case, make sure we don't crash.

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

llvm-svn: 330495

6 years agoFix typo in test (verify-machine-instrs -> verify-machineinstrs)
Jessica Paquette [Fri, 20 Apr 2018 23:37:48 +0000 (23:37 +0000)]
Fix typo in test (verify-machine-instrs -> verify-machineinstrs)

llvm-svn: 330494

6 years ago[MachineOutliner] XFAIL machine-outliner-noredzone.ll
Jessica Paquette [Fri, 20 Apr 2018 23:35:54 +0000 (23:35 +0000)]
[MachineOutliner] XFAIL machine-outliner-noredzone.ll

The verifier began complaining about an undefined physical register in this
test. XFAILing for the purposes of getting a bot up while I look into it.

Failure:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/11385/

llvm-svn: 330493

6 years ago[clang-tidy] add new check to find out objc ivars which do not have prefix '_'
Yan Zhang [Fri, 20 Apr 2018 23:18:09 +0000 (23:18 +0000)]
[clang-tidy] add new check to find out objc ivars which do not have prefix '_'

Summary:
For code of ivar declaration:

   int barWithoutPrefix;

The fix will be:

   int _barWithoutPrefix;

Reviewers: benhamilton, hokein, alexfh, aaron.ballman, ilya-biryukov

Reviewed By: alexfh

Subscribers: Eugene.Zelenko, xazax.hun, klimek, mgorny, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 330492

6 years ago[ELF] Swap argument names: use Old to refer to original symbol and New for incoming one
Fangrui Song [Fri, 20 Apr 2018 22:50:15 +0000 (22:50 +0000)]
[ELF] Swap argument names: use Old to refer to original symbol and New for incoming one

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 330491

6 years agoFix nullptr passed to memcpy in lld/COFF/Chunks.cpp
Bob Haarman [Fri, 20 Apr 2018 22:16:09 +0000 (22:16 +0000)]
Fix nullptr passed to memcpy in lld/COFF/Chunks.cpp

Summary:
ubsan found that we sometimes pass nullptr to memcpy in
SectionChunk::writeTo(). This change adds a check that avoids that.

Reviewers: ruiu

Reviewed By: ruiu

Subscribers: llvm-commits

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

llvm-svn: 330490

6 years ago[ObjCARC] Take BlockColors by const reference. NFC
Shoaib Meenai [Fri, 20 Apr 2018 22:14:45 +0000 (22:14 +0000)]
[ObjCARC] Take BlockColors by const reference. NFC

llvm-svn: 330489

6 years agoCOFF: Document /pdbaltpath.
Peter Collingbourne [Fri, 20 Apr 2018 22:11:28 +0000 (22:11 +0000)]
COFF: Document /pdbaltpath.

llvm-svn: 330488

6 years ago[ObjCARC] Account for funclet token in storeStrong transform
Shoaib Meenai [Fri, 20 Apr 2018 22:11:03 +0000 (22:11 +0000)]
[ObjCARC] Account for funclet token in storeStrong transform

When creating a call to storeStrong in ObjCARCContract, ensure the call
gets the correct funclet token, otherwise WinEHPrepare will turn the
call (and all subsequent instructions) into unreachable.

We already have logic to do this for the ARC autorelease elision marker;
factor that out into a common function that's used for both. These are
the only two places in this transform that create call instructions.

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

llvm-svn: 330487

6 years ago[llvm-mca][X86] Add MMX/SSE/AES/CLMUL resource SandyBridge tests
Simon Pilgrim [Fri, 20 Apr 2018 22:04:11 +0000 (22:04 +0000)]
[llvm-mca][X86] Add MMX/SSE/AES/CLMUL resource SandyBridge tests

llvm-svn: 330486

6 years agoUse /pdbaltpath to avoid a path length dependency.
Peter Collingbourne [Fri, 20 Apr 2018 21:54:55 +0000 (21:54 +0000)]
Use /pdbaltpath to avoid a path length dependency.

llvm-svn: 330485

6 years agoCOFF: Merge .xdata into .rdata by default.
Peter Collingbourne [Fri, 20 Apr 2018 21:32:37 +0000 (21:32 +0000)]
COFF: Merge .xdata into .rdata by default.

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

llvm-svn: 330484

6 years agoCOFF: Merge .bss into .data by default.
Peter Collingbourne [Fri, 20 Apr 2018 21:30:36 +0000 (21:30 +0000)]
COFF: Merge .bss into .data by default.

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

llvm-svn: 330483

6 years agoAdd -z {combreloc,copyreloc,noexecstack,lazy,relro,text}.
Rui Ueyama [Fri, 20 Apr 2018 21:24:08 +0000 (21:24 +0000)]
Add -z {combreloc,copyreloc,noexecstack,lazy,relro,text}.

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

llvm-svn: 330482

6 years agoCOFF: Preserve section type when processing /section flag.
Peter Collingbourne [Fri, 20 Apr 2018 21:23:16 +0000 (21:23 +0000)]
COFF: Preserve section type when processing /section flag.

It turns out that we were dropping this before.

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

llvm-svn: 330481

6 years ago[X86] Add WriteFSign/WriteFLogic scheduler classes
Simon Pilgrim [Fri, 20 Apr 2018 21:16:05 +0000 (21:16 +0000)]
[X86] Add WriteFSign/WriteFLogic scheduler classes

Split the fp and integer vector logical instruction scheduler classes - older CPUs especially often handled these on different pipes.

This unearthed a couple of things that are also handled in this patch:

(1) We were tagging avx512 fp logic ops as WriteFAdd, probably because of the lack of WriteFLogic
(2) SandyBridge had integer logic ops only using Port5, when afaict they can use Ports015.
(3) Cleaned up x86 FCHS/FABS scheduling as they are typically treated as fp logic ops.

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

llvm-svn: 330480

6 years agoCOFF: Use (name, output characteristics) as a key when grouping input sections into...
Peter Collingbourne [Fri, 20 Apr 2018 21:10:33 +0000 (21:10 +0000)]
COFF: Use (name, output characteristics) as a key when grouping input sections into output sections.

This is what link.exe does and lets us avoid needing to worry about
merging output characteristics while adding input sections to output
sections.

With this change we can't process /merge in the same way as before
because sections with different output characteristics can still
be merged into one another. So this change moves the processing of
/merge to just before we assign addresses. In the case where there
are multiple output sections with the same name, link.exe only merges
the first section with the source name into the first section with
the target name, and we do the same.

At the same time I also implemented transitive merging (which means
that /merge:.c=.b /merge:.b=.a merges both .c and .b into .a).

This isn't quite enough though because link.exe has a special case for
.CRT in 32-bit mode: it processes sections whose output characteristics
are DATA | R | W as though the output characteristics were DATA | R
(so that they get merged into things like constructor lists in the
expected way). Chromium has a few such sections, and it turns out
that those sections were causing the problem that resulted in r318699
(merge .xdata into .rdata) being reverted: because of the previous
permission merging semantics, the .CRT sections were causing the entire
.rdata section to become writable, which caused the SEH runtime to
crash because it apparently requires .xdata to be read-only. This
change also implements the same special case.

This should unblock being able to merge .xdata into .rdata by default,
as well as .bss into .data, both of which will be done in followups.

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

llvm-svn: 330479

6 years ago[llvm-objcopy] Fix sh_link
Alexander Shaposhnikov [Fri, 20 Apr 2018 20:46:04 +0000 (20:46 +0000)]
[llvm-objcopy] Fix sh_link

This diff fixes sh_link for various types of sections
(i.e. for SHT_ARM_EXIDX, SHT_HASH). In particular, this change enables us
to use llvm-objcopy with clang -gsplit-dwarf for the target android-arm.

Test plan: make check-all

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

llvm-svn: 330478

6 years ago[OpenMP] Make bc file compilation sensitive to LIBOMPTARGET_NVPTX_DEBUG flag
Guansong Zhang [Fri, 20 Apr 2018 20:41:00 +0000 (20:41 +0000)]
[OpenMP] Make bc file compilation sensitive to LIBOMPTARGET_NVPTX_DEBUG flag

Summary: The LIBOMPTARGET_NVPTX_DEBUG flag is inconsistent between using nvcc to generate .a file and clang to generate .bc file. Sync the two setting so we can get debug messages from the bc file path as well.

Reviewers: grokos

Subscribers: Hahnfeld, openmp-commits, mgorny

Tags: #openmp

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

llvm-svn: 330477

6 years agoRevert "[Sanitizer] Internal Printf string precision argument + padding."
Alex Shlyapnikov [Fri, 20 Apr 2018 20:24:02 +0000 (20:24 +0000)]
Revert "[Sanitizer] Internal Printf string precision argument + padding."

This reverts commit r330458.

There are existing code using string precision as 'max len', need more
work.

llvm-svn: 330476

6 years ago[HWASan] Introduce non-zero based and dynamic shadow memory (LLVM).
Alex Shlyapnikov [Fri, 20 Apr 2018 20:04:04 +0000 (20:04 +0000)]
[HWASan] Introduce non-zero based and dynamic shadow memory (LLVM).

Summary:
Support the dynamic shadow memory offset (the default case for user
space now) and static non-zero shadow memory offset
(-hwasan-mapping-offset option). Keeping the the latter case around
for functionality and performance comparison tests (and mostly for
-hwasan-mapping-offset=0 case).

The implementation is stripped down ASan one, picking only the relevant
parts in the following assumptions: shadow scale is fixed, the shadow
memory is dynamic, it is accessed via ifunc global, shadow memory address
rematerialization is suppressed.

Keep zero-based shadow memory for kernel (-hwasan-kernel option) and
calls instreumented case (-hwasan-instrument-with-calls option), which
essentially means that the generated code is not changed in these cases.

Reviewers: eugenis

Subscribers: srhines, llvm-commits

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

llvm-svn: 330475

6 years ago[HWASan] Introduce non-zero based and dynamic shadow memory (compiler-rt).
Alex Shlyapnikov [Fri, 20 Apr 2018 20:03:57 +0000 (20:03 +0000)]
[HWASan] Introduce non-zero based and dynamic shadow memory (compiler-rt).

Summary:
Retire the fixed shadow memory mapping to avoid conflicts with default
process memory mapping (currently manifests on Android).

Tests on AArch64 show <1% performance loss and code size increase,
making it possible to use dynamic shadow memory by default.

For the simplicity and unifirmity sake, use dynamic shadow memory mapping
with base address accessed via ifunc resolver on all supported platforms.

Keep the fixed shadow memory mapping around to be able to run
performance comparison tests later.

Complementing D45840.

Reviewers: eugenis

Subscribers: srhines, kubamracek, dberris, mgorny, kristof.beyls, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 330474

6 years ago[PartialInlining] Fix Crash from holding a reference to a destructed ORE.
Sean Fertile [Fri, 20 Apr 2018 19:56:26 +0000 (19:56 +0000)]
[PartialInlining] Fix Crash from holding a reference to a destructed ORE.

The callback used to create an ORE for the legacy PI pass caches the allocated
object in a unique_ptr in the runOnModule function, and returns a reference to
that object. Under certian circumstances we can end up holding onto that
reference after the OREs destruction. Rather then allowing the new and legacy
passes to create ORE object in diffrent ways, create the ORE at the point of
use.

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

llvm-svn: 330473

6 years ago[Hexagon] hexagon-autohvx was left on again
Krzysztof Parzyszek [Fri, 20 Apr 2018 19:45:49 +0000 (19:45 +0000)]
[Hexagon] hexagon-autohvx was left on again

llvm-svn: 330472

6 years ago[Hexagon] Improve HVX instruction selection (bitcast, vsplat)
Krzysztof Parzyszek [Fri, 20 Apr 2018 19:38:37 +0000 (19:38 +0000)]
[Hexagon] Improve HVX instruction selection (bitcast, vsplat)

There was some unfortunate interaction between VSPLAT and BITCAST
related to the selection of constant vectors (coming from selecting
shuffles). Introduce VSPLATW that always splats a 32-bit word, and
can have arbitrary result type (to avoid BITCASTs of VSPLAT).
Clean up the previous selection of BITCAST/VSPLAT.

llvm-svn: 330471

6 years agoRemove unused argument from emitModuleMetadata.
Eric Christopher [Fri, 20 Apr 2018 19:07:57 +0000 (19:07 +0000)]
Remove unused argument from emitModuleMetadata.

NFCI.

llvm-svn: 330470

6 years agoasan: Mark printf-4.c as unsupported on Windows.
Peter Collingbourne [Fri, 20 Apr 2018 19:07:35 +0000 (19:07 +0000)]
asan: Mark printf-4.c as unsupported on Windows.

Although sprintf is not intercepted on Windows, this test can pass
if sprintf calls memmove, which is intercepted, so we can't XFAIL it.

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

llvm-svn: 330469

6 years ago[Hexagon] Skip fixed-stack indexes in HexagonConstExtenders
Krzysztof Parzyszek [Fri, 20 Apr 2018 19:06:46 +0000 (19:06 +0000)]
[Hexagon] Skip fixed-stack indexes in HexagonConstExtenders

Fixed slots have negative values, and TRI::stackSlot2Index and
TRI::index2StackSlot do not handle negative numbers.

llvm-svn: 330468

6 years ago[isl++] abort() on assertion violation.
Michael Kruse [Fri, 20 Apr 2018 18:59:13 +0000 (18:59 +0000)]
[isl++] abort() on assertion violation.

Before this patch, ISL_ASSERT only printed an error message to stderr.
This can be easily missed if the program continues or just fails later.
To fail-early and help error diagnostics (e.g. using bugpoint), call
abort() when an assertion does not hold.

I seem to just have forgotten to add this abort() when I originally
proposed the ISL_ASSERT macro.

Suggested-By: Eli Friedman <efriedma@codeaurora.org>
Differential Revision: https://reviews.llvm.org/D45171

llvm-svn: 330467

6 years agoAllow arbitrary function calls for debugging purposes.
Michael Kruse [Fri, 20 Apr 2018 18:55:44 +0000 (18:55 +0000)]
Allow arbitrary function calls for debugging purposes.

Add the switch -polly-debug-func to define the name of a debug
function. This function is ignored for any validity check.

Its purpose is to allow to observe a value after transformation by a
SCoP, and to follow which statements are executed in which order. For
instance, consider the following code:

    static void dbg_printf(int sum, int i) {
      fprintf(stderr, "The value of sum is %d, i=%d\n", sum, i);
      fflush(stderr);
    }

    void func(int n) {
      int sum = 0;
      for (int i = 0; i < 16; i+=1) {
        sum += i;
        dbg_printf(sum, i);
      }
    }

Executing this after Polly's codegen with -polly-debug-func=dbg_printf
reveals the new execution order and the assumed values at that point of
execution.

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

llvm-svn: 330466

6 years ago[X86][SandyBridge] Remove duplciate InstRWs from Sandy Brige scheduler model.
Craig Topper [Fri, 20 Apr 2018 18:55:40 +0000 (18:55 +0000)]
[X86][SandyBridge] Remove duplciate InstRWs from Sandy Brige scheduler model.

llvm-svn: 330465

6 years agoUnder some scenarios, the current directory isn't writable
Sterling Augustine [Fri, 20 Apr 2018 18:45:24 +0000 (18:45 +0000)]
Under some scenarios, the current directory isn't writable
during a test. Set the output path to avoid that problem.

llvm-svn: 330464

6 years ago[X86] WaitPKG intrinsics
Gabor Buella [Fri, 20 Apr 2018 18:44:33 +0000 (18:44 +0000)]
[X86] WaitPKG intrinsics

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

llvm-svn: 330463

6 years ago[X86] WaitPKG instructions
Gabor Buella [Fri, 20 Apr 2018 18:42:47 +0000 (18:42 +0000)]
[X86] WaitPKG instructions

Three new instructions:

umonitor - Sets up a linear address range to be
monitored by hardware and activates the monitor.
The address range should be a writeback memory
caching type.

umwait - A hint that allows the processor to
stop instruction execution and enter an
implementation-dependent optimized state
until occurrence of a class of events.

tpause - Directs the processor to enter an
implementation-dependent optimized state
until the TSC reaches the value in EDX:EAX.

Also modifying the description of the mfence
instruction, as the rep prefix (0xF3) was allowed
before, which would conflict with umonitor during
disassembly.

Before:
$ echo 0xf3,0x0f,0xae,0xf0 | llvm-mc -disassemble
.text
mfence

After:
$ echo 0xf3,0x0f,0xae,0xf0 | llvm-mc -disassemble
.text
umonitor        %rax

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

llvm-svn: 330462

6 years ago[LLD/PDB] Remove improper assert.
Zachary Turner [Fri, 20 Apr 2018 18:36:51 +0000 (18:36 +0000)]
[LLD/PDB] Remove improper assert.

It's possible to have an empty object file, for example if you
just compile an empty .c file.  This file won't have any sections
so asserting that a file has chunks is definitely wrong.

llvm-svn: 330461

6 years agoFix the Xcode gtest target for the move of FileSpecTest.cpp.
Jim Ingham [Fri, 20 Apr 2018 18:30:31 +0000 (18:30 +0000)]
Fix the Xcode gtest target for the move of FileSpecTest.cpp.

llvm-svn: 330460

6 years ago[MachineOutliner] Change B instruction for tail calls to TCRETURNdi
Jessica Paquette [Fri, 20 Apr 2018 18:03:21 +0000 (18:03 +0000)]
[MachineOutliner] Change B instruction for tail calls to TCRETURNdi

First off, this is more correct than having the B. Second off, this was making
a bot upset. This fixes that.

Update the test to include -verify-machineinstrs as well to prevent stuff like
this slipping by non debug/assert builds in the future.

llvm-svn: 330459

6 years ago[Sanitizer] Internal Printf string precision argument + padding.
Alex Shlyapnikov [Fri, 20 Apr 2018 18:03:10 +0000 (18:03 +0000)]
[Sanitizer] Internal Printf string precision argument + padding.

Summary:
Example:
  Printf("%.*s", 5, "123");
should yield:
  '123  '

In case Printf's requested string precision is larger than the string
argument, the resulting string should be padded up to the requested
precision.

For the simplicity sake, implementing right padding only.

Reviewers: eugenis

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 330458

6 years ago[LLD/PDB] Emit first section contribution for DBI Module Descriptor.
Zachary Turner [Fri, 20 Apr 2018 18:00:46 +0000 (18:00 +0000)]
[LLD/PDB] Emit first section contribution for DBI Module Descriptor.

Part of the DBI stream is a list of variable length structures
describing each module that contributes to the final executable.

One member of this structure is a section contribution entry that
describes the first section contribution in the output file for
the given module.

We have been leaving this structure unpopulated until now, so with
this patch it is now filled out correctly.

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

llvm-svn: 330457

6 years ago[WebAssembly] Implement -print-gc-sections, to better test GC of globals
Nicholas Wilson [Fri, 20 Apr 2018 17:28:12 +0000 (17:28 +0000)]
[WebAssembly] Implement -print-gc-sections, to better test GC of globals

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

llvm-svn: 330456

6 years agoRemove llvm-build's --configure-target-def-file.
Nico Weber [Fri, 20 Apr 2018 17:21:10 +0000 (17:21 +0000)]
Remove llvm-build's --configure-target-def-file.

It was added 6.5 years ago in r144345, but was never hooked up and has been
unused since.  If _you_ do use this, feel free to revert, but add a comment
on where it's used.

https://reviews.llvm.org/D45262

llvm-svn: 330455

6 years ago[WebAssembly] Implement GC for imports
Nicholas Wilson [Fri, 20 Apr 2018 17:18:06 +0000 (17:18 +0000)]
[WebAssembly] Implement GC for imports

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

llvm-svn: 330454

6 years ago[utils] improve AArch64 asm parser
Sanjay Patel [Fri, 20 Apr 2018 17:16:23 +0000 (17:16 +0000)]
[utils] improve AArch64 asm parser

If we don't mark the cfi line as optional, the script won't
work with 'nounwind' code. Without that attr, there may be
extra noise in the asm body that we don't want to see.

llvm-svn: 330453

6 years agoRecord whether a module came from a private module map
Jordan Rose [Fri, 20 Apr 2018 17:16:04 +0000 (17:16 +0000)]
Record whether a module came from a private module map

Right now we only use this information in one place, immediately after
we calculate it, but it's still nice information to have. The Swift
project is going to use this to tidy up its "API notes" feature (see
past discussion on cfe-dev that never quite converged).

Reviewed by Bruno Cardoso Lopes.

llvm-svn: 330452

6 years agoRevert r330442, CodeGen/no-ident-version.c is failing on PPC
Mikhail Maltsev [Fri, 20 Apr 2018 17:14:39 +0000 (17:14 +0000)]
Revert r330442, CodeGen/no-ident-version.c is failing on PPC

llvm-svn: 330451

6 years agoFix a crash when resolving overloads of C++ virtual methods.
Adrian Prantl [Fri, 20 Apr 2018 17:14:05 +0000 (17:14 +0000)]
Fix a crash when resolving overloads of C++ virtual methods.

The isOverload() method needs to account for situations where the two
methods being compared don't have the same number of arguments.

rdar://problem/39542960

llvm-svn: 330450

6 years ago[WebAssembly] Implement --print-gc-sections for synthetic functions
Nicholas Wilson [Fri, 20 Apr 2018 17:09:18 +0000 (17:09 +0000)]
[WebAssembly] Implement --print-gc-sections for synthetic functions

Enables cleaning up confusion between which name variables are mangled
and which are unmangled, and --print-gc-sections then excersises and
tests that.

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

llvm-svn: 330449

6 years ago[WebAssembly] Distinguish debug/symbol names in the Wasm structs. NFC
Nicholas Wilson [Fri, 20 Apr 2018 17:07:24 +0000 (17:07 +0000)]
[WebAssembly] Distinguish debug/symbol names in the Wasm structs.  NFC

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

llvm-svn: 330448

6 years ago[CUDA] Set LLVM calling convention for CUDA kernel
Yaxun Liu [Fri, 20 Apr 2018 17:01:03 +0000 (17:01 +0000)]
[CUDA] Set LLVM calling convention for CUDA kernel

Some targets need special LLVM calling convention for CUDA kernel.
This patch does that through a TargetCodeGenInfo hook.

It only affects amdgcn target.

Patch by Greg Rodgers.
Revised and lit tests added by Yaxun Liu.

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

llvm-svn: 330447

6 years agoRevert r330431.
Michael Zolotukhin [Fri, 20 Apr 2018 16:57:10 +0000 (16:57 +0000)]
Revert r330431.

There are still stage3/stage4 miscompares :(

llvm-svn: 330446

6 years ago[x86] auto-generate checks; NFC
Sanjay Patel [Fri, 20 Apr 2018 16:46:58 +0000 (16:46 +0000)]
[x86] auto-generate checks; NFC

There's a proposal to change/add to this file in D45653,
so we should know exactly what those differences would be.

llvm-svn: 330445

6 years ago[NewGVN] Split OpPHI detection and creation.
Florian Hahn [Fri, 20 Apr 2018 16:37:13 +0000 (16:37 +0000)]
[NewGVN] Split OpPHI detection and creation.

It also adds a check making sure PHIs for operands are all in the same
block.

Patch by Daniel Berlin <dberlin@dberlin.org>

Reviewers: dberlin, davide

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

llvm-svn: 330444

6 years ago[ELF] --warn-backrefs: use the same GroupId for object files in the same --{start...
Fangrui Song [Fri, 20 Apr 2018 16:33:01 +0000 (16:33 +0000)]
[ELF] --warn-backrefs: use the same GroupId for object files in the same --{start,end}-lib

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 330443

6 years ago[CodeGen] Add an option to suppress output of llvm.ident
Mikhail Maltsev [Fri, 20 Apr 2018 16:29:03 +0000 (16:29 +0000)]
[CodeGen] Add an option to suppress output of llvm.ident

Summary:
By default Clang outputs its version (including git commit hash, in
case of trunk builds) into object and assembly files. It might be
useful to have an option to disable this, especially for debugging
purposes.
This patch implements new command line flags -Qn and -Qy (the names
are chosen for compatibility with GCC). -Qn disables output of
the 'llvm.ident' metadata string and the 'producer' debug info. -Qy
(enabled by default) does the opposite.

Reviewers: faisalv, echristo, aprantl

Reviewed By: aprantl

Subscribers: aprantl, cfe-commits, JDevlieghere, rogfer01

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

llvm-svn: 330442

6 years agoFix some tests that were failing on Windows
Hans Wennborg [Fri, 20 Apr 2018 15:33:44 +0000 (15:33 +0000)]
Fix some tests that were failing on Windows

llvm-svn: 330441

6 years ago[DebugInfo] Use WithColor for more debug line warnings
Andrew Ng [Fri, 20 Apr 2018 15:29:47 +0000 (15:29 +0000)]
[DebugInfo] Use WithColor for more debug line warnings

Updated two more debug line related warnings to use WithColor. This was
necessary to ensure consistent output order of the warnings on Windows
for debug line tests.

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

llvm-svn: 330440

6 years ago[CostModel][X86] Add vector element insert/extract cost tests
Simon Pilgrim [Fri, 20 Apr 2018 15:26:59 +0000 (15:26 +0000)]
[CostModel][X86] Add vector element insert/extract cost tests

llvm-svn: 330439

6 years agoFix test by allowing it to accept an upper or lower case letter as the first character.
Douglas Yung [Fri, 20 Apr 2018 15:23:57 +0000 (15:23 +0000)]
Fix test by allowing it to accept an upper or lower case letter as the first character.

Windows for some reason uses a lower case letter, while linux uses upper case.

llvm-svn: 330438

6 years ago[DAGCombine] (float)((int) f) --> ftrunc (PR36617)
Sanjay Patel [Fri, 20 Apr 2018 15:07:55 +0000 (15:07 +0000)]
[DAGCombine] (float)((int) f) --> ftrunc (PR36617)

This was originally committed at rL328921 and reverted at rL329920 to
investigate failures in Chrome. This time I've added to the ReleaseNotes
to warn users of the potential of exposing UB and let me repeat that
here for more exposure:

  Optimization of floating-point casts is improved. This may cause surprising
  results for code that is relying on undefined behavior. Code sanitizers can
  be used to detect affected patterns such as this:

    int main() {
      float x = 4294967296.0f;
      x = (float)((int)x);
      printf("junk in the ftrunc: %f\n", x);
      return 0;
    }

    $ clang -O1 ftrunc.c -fsanitize=undefined ; ./a.out
    ftrunc.c:5:15: runtime error: 4.29497e+09 is outside the range of
                   representable values of type 'int'
    junk in the ftrunc: 0.000000

Original commit message:

fptosi / fptoui round towards zero, and that's the same behavior as ISD::FTRUNC,
so replace a pair of casts with the equivalent node. We don't have to account for
special cases (NaN, INF) because out-of-range casts are undefined.

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

llvm-svn: 330437

6 years ago[CostModel][X86] Add srem/urem constant cost tests
Simon Pilgrim [Fri, 20 Apr 2018 15:01:03 +0000 (15:01 +0000)]
[CostModel][X86] Add srem/urem constant cost tests

llvm-svn: 330436

6 years ago[CostModel][X86] Add SLM/GLM/BtVer2 compare + division/remainder cost tests
Simon Pilgrim [Fri, 20 Apr 2018 14:50:34 +0000 (14:50 +0000)]
[CostModel][X86] Add SLM/GLM/BtVer2 compare + division/remainder cost tests

llvm-svn: 330435

6 years agoFix typo in a test.
Michael Zolotukhin [Fri, 20 Apr 2018 13:51:36 +0000 (13:51 +0000)]
Fix typo in a test.

llvm-svn: 330434

6 years ago[CostModel][X86] Split off BtVer2 cost checks
Simon Pilgrim [Fri, 20 Apr 2018 13:50:33 +0000 (13:50 +0000)]
[CostModel][X86] Split off BtVer2 cost checks

llvm-svn: 330433

6 years ago[CostModel][X86] Add GoldmontPlus cost tests
Simon Pilgrim [Fri, 20 Apr 2018 13:42:53 +0000 (13:42 +0000)]
[CostModel][X86] Add GoldmontPlus cost tests

Just reuses goldmont costs atm

llvm-svn: 330432

6 years agoRevert "Revert r330403 and r330413."
Michael Zolotukhin [Fri, 20 Apr 2018 13:34:32 +0000 (13:34 +0000)]
Revert "Revert r330403 and r330413."

Reapply the patches with a fix. Thanks Ilya and Hans for the reproducer!
This reverts commit r330416.

The issue was that removing predecessors invalidated uses that we stored
for rewrite. The fix is to finish manipulating with CFG before we select
uses for rewrite.

llvm-svn: 330431

6 years ago[docs] Regenerate command line reference
Jonas Hahnfeld [Fri, 20 Apr 2018 13:26:03 +0000 (13:26 +0000)]
[docs] Regenerate command line reference

This will correctly sort some manually added entries which should
generally be avoided!

llvm-svn: 330430

6 years ago[OpenMP] Hide -fopenmp-cuda-mode
Jonas Hahnfeld [Fri, 20 Apr 2018 13:25:59 +0000 (13:25 +0000)]
[OpenMP] Hide -fopenmp-cuda-mode

This is an advanced flag that should show up neither in clang --help
nor in the ClangCommandLineReference.

llvm-svn: 330429

6 years ago[X86][BtVer2] Cleanup some old FIXMEs from the model. NFCI.
Simon Pilgrim [Fri, 20 Apr 2018 13:12:04 +0000 (13:12 +0000)]
[X86][BtVer2] Cleanup some old FIXMEs from the model. NFCI.

llvm-svn: 330428

6 years agoclang-cl: Accept (and ignore) /Zc:__cplusplus.
Nico Weber [Fri, 20 Apr 2018 13:10:44 +0000 (13:10 +0000)]
clang-cl: Accept (and ignore) /Zc:__cplusplus.

See https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
clang-cl already sets __cplusplus to the correct value, so we can just ignore this flag.

Also add test coverage for a few more accepted-but-ignored flags.

https://reviews.llvm.org/D45877

llvm-svn: 330427

6 years ago[CUDA] Document recent changes
Jonas Hahnfeld [Fri, 20 Apr 2018 13:04:54 +0000 (13:04 +0000)]
[CUDA] Document recent changes

 * Finding installations via ptxas binary
 * Relocatable device code

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

llvm-svn: 330426

6 years ago[CUDA] Register relocatable GPU binaries
Jonas Hahnfeld [Fri, 20 Apr 2018 13:04:45 +0000 (13:04 +0000)]
[CUDA] Register relocatable GPU binaries

nvcc generates a unique registration function for each object file
that contains relocatable device code. Unique names are achieved
with a module id that is also reflected in the function's name.

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

llvm-svn: 330425

6 years ago[X86] Tag CLDEMOTE instruction with WriteLoad scheduling class
Simon Pilgrim [Fri, 20 Apr 2018 12:54:53 +0000 (12:54 +0000)]
[X86] Tag CLDEMOTE instruction with WriteLoad scheduling class

Same as other cacheline instructions

llvm-svn: 330424

6 years ago[AArch64][SVE] Asm: Support for contiguous LD1 (scalar+scalar) load instructions.
Sander de Smalen [Fri, 20 Apr 2018 12:52:01 +0000 (12:52 +0000)]
[AArch64][SVE] Asm: Support for contiguous  LD1 (scalar+scalar) load instructions.

This is patch [4/4] in a series to add assembler/disassembler support for
SVE's contiguous LD1 (scalar+scalar) instructions:
- Patch [1/4]: https://reviews.llvm.org/D45687
- Patch [2/4]: https://reviews.llvm.org/D45688
- Patch [3/4]: https://reviews.llvm.org/D45689
- Patch [4/4]: https://reviews.llvm.org/D45690

Reviewers: fhahn, rengolin, javed.absar, huntergr, SjoerdMeijer, t.p.northover, echristo, evandro

Reviewed By: fhahn

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

llvm-svn: 330423

6 years ago[Driver] Support for -save-stats in AddGoldPlugin.
Florian Hahn [Fri, 20 Apr 2018 12:50:10 +0000 (12:50 +0000)]
[Driver] Support for -save-stats in AddGoldPlugin.

This patch updates AddGoldPlugin to pass stats-file to the Gold plugin,
if -save-stats is passed. It also moves the save-stats option handling
to a helper function tools::getStatsFileName.

Reviewers: tejohnson, mehdi_amini, compnerd

Reviewed By: tejohnson, compnerd

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

llvm-svn: 330422

6 years ago[ObjectYAML] Add ability for DWARFYAML to calculate DIE lengths
Jonas Devlieghere [Fri, 20 Apr 2018 12:33:49 +0000 (12:33 +0000)]
[ObjectYAML] Add ability for DWARFYAML to calculate DIE lengths

This patch adds the ability for the ObjectYAML DWARFEmitter to calculate
the lengths of DIEs. This is accomplished by creating a DIEFixupVisitor
class which traverses the DWARF DIEs to calculate and fix up the lengths
in the Compile Unit header.

The DIEFixupVisitor can be extended in the future to enable more complex
fix ups which will enable simplified YAML string representations.

This is also very useful when using the YAML format in unit tests
because you no longer need to know the length of the compile unit when
writing the YAML string.

Differential commandeered from Chris Bieneman (beanz)

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

llvm-svn: 330421

6 years ago[NEON] Add a comment explaining the situation with vget_high_f16() and vget_low_f16...
Ivan A. Kosarev [Fri, 20 Apr 2018 12:09:25 +0000 (12:09 +0000)]
[NEON] Add a comment explaining the situation with vget_high_f16() and vget_low_f16() intrinsics

Related differential revision: https://reviews.llvm.org/D45668

llvm-svn: 330420

6 years ago[UpdateTestChecks] Fix update_mca_test_checks.py slowness issue
Greg Bedwell [Fri, 20 Apr 2018 11:38:11 +0000 (11:38 +0000)]
[UpdateTestChecks] Fix update_mca_test_checks.py slowness issue

The script was using Python's difflib module to calculate the number of
lines changed so that it could report it in its status output.  It turns
out this can be very very slow on large sets of lines (Python bug 6931).
It's not worth the cost, so just remove the usage of difflib entirely.

llvm-svn: 330419

6 years agoParse .h files as objective-c++ if we don't have a compile command.
Sam McCall [Fri, 20 Apr 2018 11:35:17 +0000 (11:35 +0000)]
Parse .h files as objective-c++ if we don't have a compile command.

Summary: This makes C++/objC not totally broken, without hurting C files too much.

Reviewers: ilya-biryukov

Subscribers: klimek, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 330418

6 years agoRequire asserts for stats-file-option tests.
Florian Hahn [Fri, 20 Apr 2018 11:21:13 +0000 (11:21 +0000)]
Require asserts for stats-file-option tests.

llvm-svn: 330417

6 years agoRevert r330403 and r330413.
Ilya Biryukov [Fri, 20 Apr 2018 10:52:54 +0000 (10:52 +0000)]
Revert r330403 and r330413.

Revert r330413: "[SSAUpdaterBulk] Use SmallVector instead of DenseMap for storing rewrites."
Revert r330403 "Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time."

r330403 commit seems to crash clang during our integrate while doing PGO build with the following stacktrace:
      #2 llvm::SSAUpdaterBulk::RewriteAllUses(llvm::DominatorTree*, llvm::SmallVectorImpl<llvm::PHINode*>*)
      #3 llvm::JumpThreadingPass::ThreadEdge(llvm::BasicBlock*, llvm::SmallVectorImpl<llvm::BasicBlock*> const&, llvm::BasicBlock*)
      #4 llvm::JumpThreadingPass::ProcessThreadableEdges(llvm::Value*, llvm::BasicBlock*, llvm::jumpthreading::ConstantPreference, llvm::Instruction*)
      #5 llvm::JumpThreadingPass::ProcessBlock(llvm::BasicBlock*)
The crash happens while compiling 'lib/Analysis/CallGraph.cpp'.

r3340413 is reverted due to conflicting changes.

llvm-svn: 330416

6 years ago[NFC][InstCombine] Regenerate two tests that are affected by folding masked merge
Roman Lebedev [Fri, 20 Apr 2018 10:49:19 +0000 (10:49 +0000)]
[NFC][InstCombine] Regenerate two tests that are affected by folding masked merge

llvm-svn: 330415