platform/upstream/llvm.git
6 years ago[X86] Fix (completely overridden) WriteFHAdd/WritePHAdd classes to allow us to remove...
Simon Pilgrim [Sun, 22 Apr 2018 15:25:59 +0000 (15:25 +0000)]
[X86] Fix (completely overridden) WriteFHAdd/WritePHAdd classes to allow us to remove unnecessary instrw overrides.

llvm-svn: 330546

6 years ago[X86][MMX][SSE] Tag missed PHADD/PHSUB instructions with WritePHAdd
Simon Pilgrim [Sun, 22 Apr 2018 15:02:23 +0000 (15:02 +0000)]
[X86][MMX][SSE] Tag missed PHADD/PHSUB instructions with WritePHAdd

llvm-svn: 330545

6 years ago[X86] Remove unnecessary WriteFVarBlend/WriteVarBlend InstRW overrides.
Simon Pilgrim [Sun, 22 Apr 2018 14:43:12 +0000 (14:43 +0000)]
[X86] Remove unnecessary WriteFVarBlend/WriteVarBlend InstRW overrides.

This also fixes some of the ReadAfterLd issues due to InstRW.

llvm-svn: 330544

6 years ago[InstSimplify, InstCombine] add vector tests with undef elts; NFC
Sanjay Patel [Sun, 22 Apr 2018 14:19:37 +0000 (14:19 +0000)]
[InstSimplify, InstCombine] add vector tests with undef elts; NFC

llvm-svn: 330543

6 years ago[X86] Fix WriteMPSAD/WritePSADBW values to allow us to remove unnecessary instrw...
Simon Pilgrim [Sun, 22 Apr 2018 10:39:16 +0000 (10:39 +0000)]
[X86] Fix WriteMPSAD/WritePSADBW values to allow us to remove unnecessary instrw overrides.

llvm-svn: 330542

6 years ago[X86][SandyBridge] Remove unnecessary WritePOPCNTLd overrides by fixing load latency.
Simon Pilgrim [Sun, 22 Apr 2018 10:03:52 +0000 (10:03 +0000)]
[X86][SandyBridge] Remove unnecessary WritePOPCNTLd overrides by fixing load latency.

llvm-svn: 330541

6 years ago[llvm-mca][X86] Add POPCNT resource test
Simon Pilgrim [Sun, 22 Apr 2018 09:58:00 +0000 (09:58 +0000)]
[llvm-mca][X86] Add POPCNT resource test

llvm-svn: 330540

6 years ago[test] Fix MC/ELF/nocompression.s
Jonas Devlieghere [Sun, 22 Apr 2018 08:46:27 +0000 (08:46 +0000)]
[test] Fix MC/ELF/nocompression.s

Unbreak the linux build bots:
  http://lab.llvm.org:8011/builders/clang-lld-x86_64-2stage/builds/5165/
  http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/28775
  http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/8227

llvm-svn: 330539

6 years ago[lli] Fix syntax error: missing ';'
Jonas Devlieghere [Sun, 22 Apr 2018 08:35:00 +0000 (08:35 +0000)]
[lli] Fix syntax error: missing ';'

Fixes build issue on the windows bots:
  error C2143: syntax error: missing ';'

llvm-svn: 330538

6 years ago[lli] Make error handling more consistent.
Jonas Devlieghere [Sun, 22 Apr 2018 08:02:11 +0000 (08:02 +0000)]
[lli] Make error handling more consistent.

Makes error handling more consistent by using the helpers in support.

llvm-svn: 330537

6 years ago[llvm-mc] Make error handling more consistent.
Jonas Devlieghere [Sun, 22 Apr 2018 08:01:35 +0000 (08:01 +0000)]
[llvm-mc] Make error handling more consistent.

Makes error handling more consistent by using the helpers in support.

llvm-svn: 330536

6 years ago[Support] Fix prefix logic in WithColor.
Jonas Devlieghere [Sun, 22 Apr 2018 08:01:01 +0000 (08:01 +0000)]
[Support] Fix prefix logic in WithColor.

When a prefix is passed, we need to print a colon a space after it, not
just the prefix.

llvm-svn: 330535

6 years ago[X86] Remove an unnecessary HANDLE_OPTIONAL line from the disassembler operand proces...
Craig Topper [Sun, 22 Apr 2018 06:40:37 +0000 (06:40 +0000)]
[X86] Remove an unnecessary HANDLE_OPTIONAL line from the disassembler operand processing.

llvm-svn: 330534

6 years ago[X86] Change TB to PS on LFENCE instruction.
Craig Topper [Sun, 22 Apr 2018 03:15:02 +0000 (03:15 +0000)]
[X86] Change TB to PS on LFENCE instruction.

This matches the other FENCE instructions.

llvm-svn: 330533

6 years ago[X86] Remove OpSizeIgnore, it's not implemented any differently than OpSizeFixed.
Craig Topper [Sun, 22 Apr 2018 01:24:58 +0000 (01:24 +0000)]
[X86] Remove OpSizeIgnore, it's not implemented any differently than OpSizeFixed.

llvm-svn: 330532

6 years ago[X86] Remove DATA32_PREFIX. Hack the printing for DATA16_PREFIX to print 'data32...
Craig Topper [Sun, 22 Apr 2018 00:52:02 +0000 (00:52 +0000)]
[X86] Remove DATA32_PREFIX. Hack the printing for DATA16_PREFIX to print 'data32' in 16-bit mode. Hack the asm parser to convert 'data32' to 'data16' in 16-bit mode.

Improve the error messages to match GNU assembler.

This also allows us to remove the hack from the disassembler table building.

llvm-svn: 330531

6 years agoAdd tests for llvm-bcanalyzer stream types
Brian Gesiak [Sun, 22 Apr 2018 00:04:35 +0000 (00:04 +0000)]
Add tests for llvm-bcanalyzer stream types

Summary:
Add tests for the improved stream type detection added to
`llvm-bcanalyzer` in https://reviews.llvm.org/D41979.

Test Plan: `check-clang`

Reviewers: pcc, aprantl, mehdi_amini, george.karpenkov

Reviewed By: aprantl

Subscribers: cfe-commits, a.sidorin

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

llvm-svn: 330530

6 years ago[bcanalyzer] Recognize more stream types
Brian Gesiak [Sat, 21 Apr 2018 23:52:04 +0000 (23:52 +0000)]
[bcanalyzer] Recognize more stream types

Summary:
`llvm-bcanalyzer` prints out the stream type of the file it is
analyzing. If the file begins with the LLVM IR magic number, it reports
a stream type of "LLVM IR". However, any other bitstream format is
reported as "unknown".

Add some checks for two other common bitstream formats: Clang AST
files, which begin with 'CPCH', and Clang serialized diagnostics, which
begin with 'DIAG'.

Test Plan: `check-llvm`

Reviewers: pcc, aprantl, mehdi_amini, davide, george.karpenkov, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, bruno, davide, llvm-commits

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

llvm-svn: 330529

6 years agoRevert r330492: [clang-tidy] add new check to find out objc ivars which do not have...
Chandler Carruth [Sat, 21 Apr 2018 23:27:34 +0000 (23:27 +0000)]
Revert r330492: [clang-tidy] add new check to find out objc ivars which do not have prefix '_'

This commit has been breaking most bots for a day now. There is a fix
proposed in https://reviews.llvm.org/D45912 but when I applied that
I just got different errors. Reverting to get our bots back to green.

llvm-svn: 330528

6 years ago[X86] Strip unnecessary prefetch + vector move/load instrw overrides from scheduler...
Simon Pilgrim [Sat, 21 Apr 2018 21:59:36 +0000 (21:59 +0000)]
[X86] Strip unnecessary prefetch + vector move/load instrw overrides from scheduler models.

llvm-svn: 330527

6 years ago[Support] Add optional prefix to convenience helpers in WithColor.
Jonas Devlieghere [Sat, 21 Apr 2018 21:36:11 +0000 (21:36 +0000)]
[Support] Add optional prefix to convenience helpers in WithColor.

Several tools prefix the error/warning/note output with the name of the
tool. One such tool is LLD for example. This commit adds as an optional
'Prefix' argument to the convenience helpers.

llvm-svn: 330526

6 years ago[X86] Strip unnecessary WriteCvtF2I instrw overrides from scheduler models.
Simon Pilgrim [Sat, 21 Apr 2018 21:16:44 +0000 (21:16 +0000)]
[X86] Strip unnecessary WriteCvtF2I instrw overrides from scheduler models.

llvm-svn: 330525

6 years ago[tools] Use WithColor for printing errors.
Jonas Devlieghere [Sat, 21 Apr 2018 21:11:59 +0000 (21:11 +0000)]
[tools] Use WithColor for printing errors.

Use convenience helpers in WithColor to print errors, warnings and notes
in a few more tools.

llvm-svn: 330524

6 years ago[X86] Strip unnecessary broadcast/shuffle256 instrw overrides from scheduler models.
Simon Pilgrim [Sat, 21 Apr 2018 20:45:12 +0000 (20:45 +0000)]
[X86] Strip unnecessary broadcast/shuffle256 instrw overrides from scheduler models.

llvm-svn: 330523

6 years ago[X86][AVX] VPERM2F128/VINSERTF128 should be a shuffle256 schedule like VPERM2I128...
Simon Pilgrim [Sat, 21 Apr 2018 20:04:24 +0000 (20:04 +0000)]
[X86][AVX] VPERM2F128/VINSERTF128 should be a shuffle256 schedule like VPERM2I128/VINSERTI128

llvm-svn: 330522

6 years ago[X86] Strip unnecessary vector integer math, shift-imm, extend, shuffle, pack/unpack...
Simon Pilgrim [Sat, 21 Apr 2018 19:11:55 +0000 (19:11 +0000)]
[X86] Strip unnecessary vector integer math, shift-imm, extend, shuffle, pack/unpack instruction instrw overrides from scheduler models.

llvm-svn: 330521

6 years ago[X86] Add DAG combine to turn (trunc (srl (mul ext, ext), 16) into PMULHW/PMULHUW.
Craig Topper [Sat, 21 Apr 2018 18:39:21 +0000 (18:39 +0000)]
[X86] Add DAG combine to turn (trunc (srl (mul ext, ext), 16) into PMULHW/PMULHUW.

Ultimately I want to use this to remove the intrinsics for these instructions.

llvm-svn: 330520

6 years ago[X86] Add test cases that show the current codegen for (trunc (srl (mul ext, ext...
Craig Topper [Sat, 21 Apr 2018 18:39:20 +0000 (18:39 +0000)]
[X86] Add test cases that show the current codegen for (trunc (srl (mul ext, ext), 16)). NFC

A future patch will turn this into MULHU/MULHS.

llvm-svn: 330519

6 years ago[lit] Generate a single lit cfg file for tests that require dotest.py
Jonas Devlieghere [Sat, 21 Apr 2018 18:23:04 +0000 (18:23 +0000)]
[lit] Generate a single lit cfg file for tests that require dotest.py

The current way that the lit configuration is generated for the LLDB
tests that run using dotest causes cmake to fail when using a generator
which supports multiple configurations (such as Visual Studio). The
failure is because file GENERATE will create a file *per possible
configuration* resulting in the same lit configuration file being
overwritten multiple times.

To fix the issue, we need to create a single lit file that is agnostic
of the configurations and can be used for any configuration.

Patch by: Stella Stamenova

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

llvm-svn: 330518

6 years ago[X86] Add SchedWrites for LDMXCSR/STMXCSR.
Craig Topper [Sat, 21 Apr 2018 18:07:36 +0000 (18:07 +0000)]
[X86] Add SchedWrites for LDMXCSR/STMXCSR.

llvm-svn: 330517

6 years ago[InstSimplify] move tests for shifts; NFC
Sanjay Patel [Sat, 21 Apr 2018 16:58:00 +0000 (16:58 +0000)]
[InstSimplify] move tests for shifts; NFC

llvm-svn: 330516

6 years ago[InstSimplify] move/add/regenerate checks for tests; NFC
Sanjay Patel [Sat, 21 Apr 2018 16:23:47 +0000 (16:23 +0000)]
[InstSimplify] move/add/regenerate checks for tests; NFC

llvm-svn: 330515

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