platform/upstream/llvm.git
6 years agoAMDGPU: Fix S_BUFFER_LOAD_DWORD_SGPR moveToVALU
Marek Olsak [Tue, 6 Feb 2018 15:17:55 +0000 (15:17 +0000)]
AMDGPU: Fix S_BUFFER_LOAD_DWORD_SGPR moveToVALU

Author: Bas Nieuwenhuizen

https://reviews.llvm.org/D42881

llvm-svn: 324353

6 years ago[Hexagon] Remove leftover assert
Krzysztof Parzyszek [Tue, 6 Feb 2018 15:15:13 +0000 (15:15 +0000)]
[Hexagon] Remove leftover assert

llvm-svn: 324352

6 years ago[clangd] Don't try pthread, just use thread_local. Reverts r323949.
Sam McCall [Tue, 6 Feb 2018 14:25:02 +0000 (14:25 +0000)]
[clangd] Don't try pthread, just use thread_local. Reverts r323949.

The pthread solution here breaks standalone builds, which don't have the
relevant cmake magic for feature-detection.

The original reason for trying pthread was fear of libgcc without
support for thread_local (e.g. on the clang-x86_64-linux-selfhost-modules bot).
However the earliest supported GCC is 4.8, and this has __cxa_thread_atexit.

This will probably break that bot, it's not running a supported GCC and needs
to be upgraded. I'll try to find out how to do this.

llvm-svn: 324351

6 years ago[Hexagon] Split HVX operations on vector pairs
Krzysztof Parzyszek [Tue, 6 Feb 2018 14:24:57 +0000 (14:24 +0000)]
[Hexagon] Split HVX operations on vector pairs

Vector pairs are legal types, but not every operation can work on pairs.
For those operations that are legal for single vectors, generate a concat
of their results on pair halves.

llvm-svn: 324350

6 years ago[Hexagon] Add helper functions to identify single/pair vector types, NFC
Krzysztof Parzyszek [Tue, 6 Feb 2018 14:21:31 +0000 (14:21 +0000)]
[Hexagon] Add helper functions to identify single/pair vector types, NFC

llvm-svn: 324349

6 years ago[Hexagon] Handle lowering of SETCC via setCondCodeAction
Krzysztof Parzyszek [Tue, 6 Feb 2018 14:16:52 +0000 (14:16 +0000)]
[Hexagon] Handle lowering of SETCC via setCondCodeAction

It was expanded directly into instructions earlier. That was to avoid
loads from a constant pool for a vector negation: "xor x, splat(i1 -1)".
Implement ISD opcodes QTRUE and QFALSE to denote logical vectors of
all true and all false values, and handle setcc with negations through
selection patterns.

llvm-svn: 324348

6 years ago[X86][SSE] Add PACKUS support for truncation of clamped values
Simon Pilgrim [Tue, 6 Feb 2018 14:07:46 +0000 (14:07 +0000)]
[X86][SSE] Add PACKUS support for truncation of clamped values

Followup to D42544 that matches PACKUSWB cases for non-AVX512, SSE and PACKUSDW cases will have to wait until we can add support for general SMIN/SMAX matching.

llvm-svn: 324347

6 years ago[AMDGPU] do not generate .AMDGPU.config for amdpal os type
Tim Renouf [Tue, 6 Feb 2018 13:39:38 +0000 (13:39 +0000)]
[AMDGPU] do not generate .AMDGPU.config for amdpal os type

Summary:
Now we generate PAL metadata for the amdpal os type, there is no need to
generate the .AMDGPU.config section.

Reviewers: arsenm, nhaehnle, dstuttard

Subscribers: kzhuravl, wdng, yaxunl, t-tye, llvm-commits

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

Change-Id: I303c5fad66656ce97293da60621afac6595b4c18
llvm-svn: 324346

6 years ago[Solaris] Silence -pthread warning on Solaris
Fedor Sergeev [Tue, 6 Feb 2018 13:21:12 +0000 (13:21 +0000)]
[Solaris] Silence -pthread warning on Solaris

Summary:
During make check-all on Solaris, I see several instances of this warning:

clang-6.0: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]

Since Solaris 10, libpthread has been folded into libc, so there's nothing to do.  gcc
just ignores -pthread here.  Darwin claims the option to silence the warning, and
this patch follows that lead.

Reviewers: rsmith, fedor.sergeev

Reviewed By: fedor.sergeev

Subscribers: cfe-commits, fedor.sergeev

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

llvm-svn: 324344

6 years ago[AArch64][SVE] Asm: Add AND_ZI instructions and aliases
Sander de Smalen [Tue, 6 Feb 2018 13:13:21 +0000 (13:13 +0000)]
[AArch64][SVE] Asm: Add AND_ZI instructions and aliases

Summary: Adds support for the SVE AND instruction with vector and logical-immediate operands, and their corresponding aliases.

Reviewers: fhahn, rengolin, samparker, echristo, aadg, kristof.beyls

Reviewed By: fhahn

Subscribers: aemerson, javed.absar, tschuett, llvm-commits

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

llvm-svn: 324343

6 years agoUnittests misc. typos
Sylvestre Ledru [Tue, 6 Feb 2018 13:12:29 +0000 (13:12 +0000)]
Unittests misc. typos

By luz.paz

llvm-svn: 324342

6 years ago[MergeICmps] Handle chains with several complex BCE basic blocks.
Clement Courbet [Tue, 6 Feb 2018 12:25:33 +0000 (12:25 +0000)]
[MergeICmps] Handle chains with several complex BCE basic blocks.

 - Fix condition for detecting that a complex basic block was the first in
   the chain.
 - Add tests.

This was caught by buildbots when submitting rL324319.

llvm-svn: 324341

6 years ago[ELF] - Re-commit r324322 "Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOpti...
George Rimar [Tue, 6 Feb 2018 12:20:05 +0000 (12:20 +0000)]
[ELF] - Re-commit r324322 "Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for parsing LTO options.".

With fix:
Keep logic that ignores -plugin-opt=mcpu=x86-64 -plugin-opt=thinlto,
add checks for those to testcases.

Original commit message:

[ELF] - Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for parsing LTO options.

gold plugin uses InitTargetOptionsFromCodeGenFlags +
ParseCommandLineOptions for parsing LTO options.
Patch do the same change for LLD.

Such change helps to avoid parsing/whitelisting LTO
plugin options again on linker side, what can help LLD
to automatically support new -plugin-opt=xxx options
passed.

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

llvm-svn: 324340

6 years ago[X86][SSE] Add PACKSS support for truncation of clamped values
Simon Pilgrim [Tue, 6 Feb 2018 12:16:10 +0000 (12:16 +0000)]
[X86][SSE] Add PACKSS support for truncation of clamped values

Followup to D42544 that matches PACKSSWB cases for non-AVX512, SSE and PACKSSDW cases will have to wait until we can add support for general SMIN/SMAX matching.

llvm-svn: 324339

6 years agoTest commit - fixing a comment.
Jacek Olesiak [Tue, 6 Feb 2018 12:12:00 +0000 (12:12 +0000)]
Test commit - fixing a comment.

Summary: A test commit.

Reviewers: krasimir, benhamilton

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

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

llvm-svn: 324338

6 years ago[clang-format] Adds space around angle brackets in text protos
Krasimir Georgiev [Tue, 6 Feb 2018 11:34:34 +0000 (11:34 +0000)]
[clang-format] Adds space around angle brackets in text protos

Summary:
This patch adds spaces around angle brackets in text proto Google style.
Previously these were detected as template openers and closers, which happened
to have the expected effect. Now we detect them as scope openers and closers
similarly to the way braces are handled in this context.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 324337

6 years ago[PowerPC] fix up in rL324229, NFC
Hiroshi Inoue [Tue, 6 Feb 2018 11:34:16 +0000 (11:34 +0000)]
[PowerPC] fix up in rL324229, NFC

This patch fixes up my previous commit (add initialization of local variables).

llvm-svn: 324336

6 years ago[DeadArgumentElim] Set pointer to DISubprogram before calling RAUW. NFC
Petar Jovanovic [Tue, 6 Feb 2018 11:11:28 +0000 (11:11 +0000)]
[DeadArgumentElim] Set pointer to DISubprogram before calling RAUW. NFC

It is better to update pointer of the DISuprogram before we call RAUW for
still live arguments of the function, because with the change reviewed in
D42541 in RAUW we compare DISubprograms rather than functions itself.

Patch by Djordje Todorovic.

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

llvm-svn: 324335

6 years ago[clangd] Cut input-mirror.test down to size. NFC
Sam McCall [Tue, 6 Feb 2018 10:51:22 +0000 (10:51 +0000)]
[clangd] Cut input-mirror.test down to size. NFC

llvm-svn: 324334

6 years ago[clangd] Support simpler JSON-RPC stream parsing for lit tests.
Sam McCall [Tue, 6 Feb 2018 10:47:30 +0000 (10:47 +0000)]
[clangd] Support simpler JSON-RPC stream parsing for lit tests.

Summary:
Instead of content-length, we delimit messages with ---.
This also removes the need for (most) dos-formatted test files.

Reviewers: ioeric

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

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

llvm-svn: 324333

6 years agoRevert r324322 "[ELF] - Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions...
George Rimar [Tue, 6 Feb 2018 10:31:01 +0000 (10:31 +0000)]
Revert r324322 "[ELF] - Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for parsing LTO options."

It broke BB:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/8162

llvm-svn: 324332

6 years agoFix unused variable warning in release mode. NFC.
Alexander Ivchenko [Tue, 6 Feb 2018 09:53:02 +0000 (09:53 +0000)]
Fix unused variable warning in release mode. NFC.

llvm-svn: 324330

6 years ago[clangd] Fix incorrect file path for symbols defined by the compile command-line...
Haojian Wu [Tue, 6 Feb 2018 09:50:35 +0000 (09:50 +0000)]
[clangd] Fix incorrect file path for symbols defined by the compile command-line option.

Summary:

Reviewers: ioeric

Reviewed By: ioeric

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

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

llvm-svn: 324328

6 years ago[AArch64] Fix spelling of ICH_ELRSR_EL2 system register
Oliver Stannard [Tue, 6 Feb 2018 09:39:04 +0000 (09:39 +0000)]
[AArch64] Fix spelling of ICH_ELRSR_EL2 system register

This register was mis-spelled as ICH_ELSR_EL2, but has the correct encoding for
ICH_ELRSR_EL2.

llvm-svn: 324325

6 years ago[ARM][AArch64] Add CSDB speculation barrier instruction
Oliver Stannard [Tue, 6 Feb 2018 09:24:47 +0000 (09:24 +0000)]
[ARM][AArch64] Add CSDB speculation barrier instruction

This adds the CSDB instruction, which is a new barrier instruction
described by the whitepaper at [1].

This is in encoding space which was previously executed as a NOP, so it is
available for all targets that have the relevant NOP encoding space. This
matches the binutils behaviour for these instructions [2][3].

[1] https://developer.arm.com/support/security-update
[2] https://sourceware.org/ml/binutils/2018-01/msg00116.html
[3] https://sourceware.org/ml/binutils/2018-01/msg00120.html

llvm-svn: 324324

6 years ago[MergeICmps][NFC] Add more assertions.
Clement Courbet [Tue, 6 Feb 2018 09:14:00 +0000 (09:14 +0000)]
[MergeICmps][NFC] Add more assertions.

llvm-svn: 324323

6 years ago[ELF] - Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for parsing...
George Rimar [Tue, 6 Feb 2018 09:05:56 +0000 (09:05 +0000)]
[ELF] - Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for parsing LTO options.

gold plugin uses InitTargetOptionsFromCodeGenFlags +
ParseCommandLineOptions for parsing LTO options.
Patch do the same change for LLD.

Such change helps to avoid parsing/whitelisting LTO
plugin options again on linker side, what can help LLD
to automatically support new -plugin-opt=xxx options
passed.

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

llvm-svn: 324322

6 years ago[ARM] Armv8.2-A FP16 code generation (part 3/3)
Sjoerd Meijer [Tue, 6 Feb 2018 08:43:56 +0000 (08:43 +0000)]
[ARM] Armv8.2-A FP16 code generation (part 3/3)

This adds most of the FP16 codegen support, but these areas need further work:

- FP16 literals and immediates are not properly supported yet (e.g. literal
  pool needs work),
- Instructions that are generated from intrinsics (e.g. vabs) haven't been
  added.

This will be addressed in follow-up patches.

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

llvm-svn: 324321

6 years ago[OMPT] Fix tool initialization returning 0
Joachim Protze [Tue, 6 Feb 2018 08:41:27 +0000 (08:41 +0000)]
[OMPT] Fix tool initialization returning 0

If tool initialization returns 0, OMPT should not be active. The current
implementation provided some callback invocations in this case.

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

llvm-svn: 324320

6 years agoRevert "[MergeICmps] Enable the MergeICmps Pass by default."
Clement Courbet [Tue, 6 Feb 2018 08:40:18 +0000 (08:40 +0000)]
Revert "[MergeICmps] Enable the MergeICmps Pass by default."

Breaks clang-ppc64be-linux-multistage buildbot.

This reverts commit 515bab711f308c2e8299c49dd8c84ea6a2e0b60e.

llvm-svn: 324319

6 years ago[MergeICmps] Enable the MergeICmps Pass by default.
Clement Courbet [Tue, 6 Feb 2018 07:20:33 +0000 (07:20 +0000)]
[MergeICmps] Enable the MergeICmps Pass by default.

Summary: Now that PR33325 is fixed, this should always improve the generated code.

Reviewers: spatel

Subscribers: llvm-commits

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

llvm-svn: 324317

6 years ago[ThinLTO] fix test failure without x86 backend
Hiroshi Inoue [Tue, 6 Feb 2018 07:03:09 +0000 (07:03 +0000)]
[ThinLTO] fix test failure without x86 backend

This patch moves ThinLTOBitcodeWriter/module-asm.ll test case into x86 directory to avoid a test failure when x86 backend is not enabled.

llvm-svn: 324316

6 years ago[X86] Modify a few tests to not use icmps that are provably false.
Craig Topper [Tue, 6 Feb 2018 06:44:05 +0000 (06:44 +0000)]
[X86] Modify a few tests to not use icmps that are provably false.

These used things like unsigned less than zero, which is always false because there is no unsigned number less than zero.

I plan to teach DAG combine to optimize these so need to stop using them.

llvm-svn: 324315

6 years agoAMDGPU/MemoryModel: Fix monotonic atomic loads
Konstantin Zhuravlyov [Tue, 6 Feb 2018 04:06:04 +0000 (04:06 +0000)]
AMDGPU/MemoryModel: Fix monotonic atomic loads

Those should have glc bit set for system and agent synchronization scopes

llvm-svn: 324314

6 years agoThinLTOBitcodeWriter: Do not include module-level inline asm in the merged module.
Peter Collingbourne [Tue, 6 Feb 2018 03:29:18 +0000 (03:29 +0000)]
ThinLTOBitcodeWriter: Do not include module-level inline asm in the merged module.

If the inline asm provides the definition of a symbol, this can result
in duplicate symbol errors.

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

llvm-svn: 324313

6 years agoNo, really this time mark 3034 as 'Patch Ready'
Marshall Clow [Tue, 6 Feb 2018 03:24:21 +0000 (03:24 +0000)]
No, really this time mark 3034 as 'Patch Ready'

llvm-svn: 324312

6 years ago[DAGCombiner] Pass the original load to ExtendSetCCUses not the turncate.
Craig Topper [Tue, 6 Feb 2018 03:23:27 +0000 (03:23 +0000)]
[DAGCombiner] Pass the original load to ExtendSetCCUses not the turncate.

Summary:
This method is trying to use the truncate node to find which SETCC operand should be replaced directly with the extended load.

This used to work correctly because all uses of the original load were replaced by the truncate before this function was called. So this was used to effectively bypass the truncate and find the load under it.

All but one of the callers now call this before the truncate has replaced the laod so the setcc doesn't yet use the truncate. To account for this we should pass the original load instead.

I changed the order of that one caller to make this work there too.

I don't have a test case because this is probably hidden by later DAG combines causing the extend and truncate to cancel out. I assume this way is a little more efficient and matches what was originally intended.

Reviewers: RKSimon, spatel, niravd

Reviewed By: niravd

Subscribers: llvm-commits

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

llvm-svn: 324311

6 years agoMark issue 3034 as 'Patch Ready'
Marshall Clow [Tue, 6 Feb 2018 03:23:16 +0000 (03:23 +0000)]
Mark issue 3034 as 'Patch Ready'

llvm-svn: 324310

6 years agoRevert "[libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default...
Nirav Dave [Tue, 6 Feb 2018 03:03:37 +0000 (03:03 +0000)]
Revert "[libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default constructible types."
Revert "Fix initialization of array<const T, 0> with GCC."
Revert "Make array<const T, 0> non-CopyAssignable and make swap and fill ill-formed."

This reverts commit r324182, r324185, and r324194 which were causing issues with zero-length std::arrays.

llvm-svn: 324309

6 years agoFix crash on invalid.
Richard Trieu [Tue, 6 Feb 2018 02:58:21 +0000 (02:58 +0000)]
Fix crash on invalid.

Don't call a method when the pointer is null.

llvm-svn: 324308

6 years agoMore patches ready
Marshall Clow [Tue, 6 Feb 2018 01:59:28 +0000 (01:59 +0000)]
More patches ready

llvm-svn: 324307

6 years ago[COFF] Add minimal support for /guard:cf
Reid Kleckner [Tue, 6 Feb 2018 01:58:26 +0000 (01:58 +0000)]
[COFF] Add minimal support for /guard:cf

Summary:
This patch adds some initial support for Windows control flow guard. At
the end of the day, the linker needs to synthesize a table of RVAs very
similar to the structured exception handler table (/safeseh).

Both /safeseh and /guard:cf take sections of symbol table indices
(.sxdata and .gfids$y) and turn them into RVA tables referenced by the
load config struct in the CRT through special symbols.

Reviewers: ruiu, amccarth

Subscribers: llvm-commits

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

llvm-svn: 324306

6 years ago[WebAssembly] Fix test expectations after r324274
Derek Schuff [Tue, 6 Feb 2018 01:21:17 +0000 (01:21 +0000)]
[WebAssembly] Fix test expectations after r324274

Wasm uses the expand action for several FP compare ops, and that behavior
changed.

llvm-svn: 324305

6 years agoUpdate test expectations after reverting PLT change
Reid Kleckner [Tue, 6 Feb 2018 00:56:06 +0000 (00:56 +0000)]
Update test expectations after reverting PLT change

llvm-svn: 324304

6 years ago[RISCV] Add support for %pcrel_lo.
Ahmed Charles [Tue, 6 Feb 2018 00:55:23 +0000 (00:55 +0000)]
[RISCV] Add support for %pcrel_lo.

llvm-svn: 324303

6 years agoFix test/Driver/sanitizer-ld.c broken by D40903
Alex Shlyapnikov [Tue, 6 Feb 2018 00:50:18 +0000 (00:50 +0000)]
Fix test/Driver/sanitizer-ld.c broken by D40903

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

llvm-svn: 324302

6 years agoRevert "Don't assume a null GV is local for ELF and MachO."
Reid Kleckner [Tue, 6 Feb 2018 00:47:14 +0000 (00:47 +0000)]
Revert "Don't assume a null GV is local for ELF and MachO."

This reverts r323297.

It breaks building grub.

llvm-svn: 324301

6 years agoAdd -no-allow-multiple-definition, -no-pic-executable and -no-warn-common.
Rui Ueyama [Tue, 6 Feb 2018 00:45:15 +0000 (00:45 +0000)]
Add -no-allow-multiple-definition, -no-pic-executable and -no-warn-common.

GNU gold has these options.

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

llvm-svn: 324300

6 years ago[ThinLTO] Remove dead and dropped symbol declarations when possible
Teresa Johnson [Tue, 6 Feb 2018 00:43:39 +0000 (00:43 +0000)]
[ThinLTO] Remove dead and dropped symbol declarations when possible

Summary:
Removing the dropped symbols will prevent indirect call promotion in the
ThinLTO Backend from adding a new reference to a symbol, which can
result in linker unsats. This can happen when we compile with a sample
profile collected from one binary by used for another, which may have
profiled targets that aren't used in the new binary.

Note that until dropDeadSymbols handles variables and aliases (in
progress), we may not be able to remove the declaration and can still
have an issue.

Reviewers: grimar, davidxl

Subscribers: mehdi_amini, inglorion, llvm-commits, eraman

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

llvm-svn: 324299

6 years agoFix regex from r324279 more better.
Paul Robinson [Tue, 6 Feb 2018 00:43:26 +0000 (00:43 +0000)]
Fix regex from r324279 more better.

llvm-svn: 324298

6 years agoFix LLD wasm error check on Windows, which prints "lld.EXE: error: ..."
Reid Kleckner [Tue, 6 Feb 2018 00:06:45 +0000 (00:06 +0000)]
Fix LLD wasm error check on Windows, which prints "lld.EXE: error: ..."

llvm-svn: 324297

6 years ago[Sanitizers] Basic Solaris sanitizer support (PR 33274)
Alex Shlyapnikov [Mon, 5 Feb 2018 23:59:13 +0000 (23:59 +0000)]
[Sanitizers] Basic Solaris sanitizer support (PR 33274)

Summary:
This patch (on top of https://reviews.llvm.org/D35755) provides the clang side necessary
to enable the Solaris port of the sanitizers implemented by https://reviews.llvm.org/D40898,
https://reviews.llvm.org/D40899, and https://reviews.llvm.org/D40900).

A few features of note:

* While compiler-rt cmake/base-config-ix.cmake (COMPILER_RT_OS_DIR) places
  the runtime libs in a tolower(CMAKE_SYSTEM_NAME) directory, clang defaults to
  the OS part of the target triplet (solaris2.11 in the case at hand).  The patch makes
  them agree on compiler-rt's idea.

* While Solaris ld accepts a considerable number of GNU ld options for compatibility,
  it only does so for the double-dash forms.  clang unfortunately is inconsistent here
  and sometimes uses the double-dash form, sometimes the single-dash one that
  confuses the hell out of Solaris ld.  I've changed the affected places to use the double-dash
  form that should always work.

* As described in https://reviews.llvm.org/D40899, Solaris ld doesn't create the
  __start___sancov_guards/__stop___sancov_guards labels gld/gold/lld do, so I'm
  including additional runtime libs into the link that provide them.

* One test uses -fstack-protector, but unlike other systems libssp hasn't been folded
  into Solaris libc, but needs to be linked with separately.

* For now, only 32-bit x86 asan is enabled on Solaris.  64-bit x86 should follow, but
  sparc (which requires additional compiler-rt changes not yet submitted) fails miserably
  due to a llvmsparc backend limitation:

fatal error: error in backend: Function "_ZN7testing8internal16BoolFromGTestEnvEPKcb": over-aligned dynamic alloca not supported.

  However, inside the gcc tree, Solaris/sparc asan works almost as well as x86.

Reviewers: rsmith, alekseyshl

Reviewed By: alekseyshl

Subscribers: jyknight, fedor.sergeev, cfe-commits

Tags: #sanitizers

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

llvm-svn: 324296

6 years ago[X86] Auto-generate complete checks. NFC
Craig Topper [Mon, 5 Feb 2018 23:57:03 +0000 (23:57 +0000)]
[X86] Auto-generate complete checks. NFC

llvm-svn: 324295

6 years ago[X86] Relax restrictions on what setcc condition codes can be folded with a sext...
Craig Topper [Mon, 5 Feb 2018 23:57:01 +0000 (23:57 +0000)]
[X86] Relax restrictions on what setcc condition codes can be folded with a sext when AVX512 is enabled.

We now allow all signed comparisons and not equal. The complement that needs to be added for this is no worse than the extend. And the vector output forms of pcmpeq/pcmpgt have better latency than the k-register version on SKX.

llvm-svn: 324294

6 years ago[testsuite] Skip a flakey test.
Davide Italiano [Mon, 5 Feb 2018 23:51:57 +0000 (23:51 +0000)]
[testsuite] Skip a flakey test.

llvm-svn: 324293

6 years agoAdd issues in 'Review'
Marshall Clow [Mon, 5 Feb 2018 23:50:49 +0000 (23:50 +0000)]
Add issues in 'Review'

llvm-svn: 324292

6 years agoLTO: Also include dso-local bit for calls in ThinLTO cache key.
Peter Collingbourne [Mon, 5 Feb 2018 23:46:32 +0000 (23:46 +0000)]
LTO: Also include dso-local bit for calls in ThinLTO cache key.

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

llvm-svn: 324291

6 years agoRemove <experimental/string_view>; use <string_view> instead. See https://libcxx...
Marshall Clow [Mon, 5 Feb 2018 23:43:34 +0000 (23:43 +0000)]
Remove <experimental/string_view>; use <string_view> instead. See https://libcxx.llvm.org/TS_deprecation.html

llvm-svn: 324290

6 years ago[LoopStrengthReduce, x86] don't add cost for a cmp that will be macro-fused (PR35681)
Sanjay Patel [Mon, 5 Feb 2018 23:43:05 +0000 (23:43 +0000)]
[LoopStrengthReduce, x86] don't add cost for a cmp that will be macro-fused (PR35681)

In the motivating case from PR35681 and represented by the macro-fuse-cmp test:
https://bugs.llvm.org/show_bug.cgi?id=35681
...there's a 37 -> 31 byte size win for the loop because we eliminate the big base
address offsets.

SPEC2017 on Ryzen shows no significant perf difference.

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

llvm-svn: 324289

6 years agoDisable test_restart_bug failing on Android
Eugene Zemtsov [Mon, 5 Feb 2018 23:31:58 +0000 (23:31 +0000)]
Disable test_restart_bug failing on Android

llvm-svn: 324288

6 years agoFix the cputype comparison in GDBRemoteCommunicationServerCommon::Handle_qHostInfo
Jason Molenda [Mon, 5 Feb 2018 23:10:51 +0000 (23:10 +0000)]
Fix the cputype comparison in GDBRemoteCommunicationServerCommon::Handle_qHostInfo
to use Mach-O cpu types instead of the ArchSpec enum value, and handle the case
of bridgeos.

llvm-svn: 324287

6 years agoIRGen: Move vtable load after argument evaluation.
Peter Collingbourne [Mon, 5 Feb 2018 23:09:13 +0000 (23:09 +0000)]
IRGen: Move vtable load after argument evaluation.

This change reduces the live range of the loaded function pointer,
resulting in a slight code size decrease (~10KB in clang), and also
improves the security of CFI for virtual calls by making it less
likely that the function pointer will be spilled, and ensuring that
it is not spilled across a function call boundary.

Fixes PR35353.

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

llvm-svn: 324286

6 years ago[PEI] Fix failing test caused by r324283
Francis Visoiu Mistrih [Mon, 5 Feb 2018 23:06:47 +0000 (23:06 +0000)]
[PEI] Fix failing test caused by r324283

X86FrameLowering sets stack size to 0 if redzone is enabled.

llvm-svn: 324285

6 years ago[Sanitizers, Darwin] Disable SANITIZER_SUPPORTS_WEAK_HOOKS before Mac OS X 10.9
Vitaly Buka [Mon, 5 Feb 2018 23:02:09 +0000 (23:02 +0000)]
[Sanitizers, Darwin] Disable SANITIZER_SUPPORTS_WEAK_HOOKS before Mac OS X 10.9

Summary:
Before Xcode 4.5, undefined weak symbols don't work reliably on Darwin:
https://stackoverflow.com/questions/6009321/weak-symbol-link-on-mac-os-x
Therefore this patch disables their use before Mac OS X 10.9 which is the first version
only supported by Xcode 4.5 and above.

Reviewers: glider, kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits

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

llvm-svn: 324284

6 years ago[PEI][NFC] Move StackSize opt-remark code next to -warn-stack code
Francis Visoiu Mistrih [Mon, 5 Feb 2018 22:46:54 +0000 (22:46 +0000)]
[PEI][NFC] Move StackSize opt-remark code next to -warn-stack code

This allows us to make sure we're always having the same sizes in both
remarks and warnings.

llvm-svn: 324283

6 years ago[demangler] Refactor the type parser
Erik Pilkington [Mon, 5 Feb 2018 22:41:20 +0000 (22:41 +0000)]
[demangler] Refactor the type parser

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

llvm-svn: 324282

6 years agoCMake: fix build directory name in clean rule
Adrian Prantl [Mon, 5 Feb 2018 22:35:46 +0000 (22:35 +0000)]
CMake: fix build directory name in clean rule

llvm-svn: 324281

6 years ago[lang/Objc] UNXFAIL a test. Nullability has been implemented in clang.
Davide Italiano [Mon, 5 Feb 2018 22:31:59 +0000 (22:31 +0000)]
[lang/Objc] UNXFAIL a test. Nullability has been implemented in clang.

(a while ago).

<rdar://problem/20416388>

llvm-svn: 324280

6 years agoFix Windows bots for test from r324270.
Paul Robinson [Mon, 5 Feb 2018 22:30:00 +0000 (22:30 +0000)]
Fix Windows bots for test from r324270.

llvm-svn: 324279

6 years ago[LowerMemIntrinsics] Update uses of deprecated MemIntrinsic::getAlignment API (NFC)
Daniel Neilson [Mon, 5 Feb 2018 22:23:58 +0000 (22:23 +0000)]
[LowerMemIntrinsics] Update uses of deprecated MemIntrinsic::getAlignment API (NFC)

Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
LowerMemIntrinsics pass to cease using the old getAlignment() API of MemoryIntrinsic in
favour of getting source & dest specific alignments through the new API.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, rL324148, rL324273 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

llvm-svn: 324278

6 years ago[clangd] Add a cstring include for strerror.
Benjamin Kramer [Mon, 5 Feb 2018 22:10:39 +0000 (22:10 +0000)]
[clangd] Add a cstring include for strerror.

Apparently this doesn't get included transitively on some systems.

llvm-svn: 324277

6 years ago[InstCombine] don't try to evaluate instructions with >1 use (revert r324014)
Sanjay Patel [Mon, 5 Feb 2018 21:50:32 +0000 (21:50 +0000)]
[InstCombine] don't try to evaluate instructions with >1 use (revert r324014)

This example causes a compile-time explosion:

define i16 @foo(i16 %in) {
  %x = zext i16 %in to i32
  %a1 = mul i32 %x, %x
  %a2 = mul i32 %a1, %a1
  %a3 = mul i32 %a2, %a2
  %a4 = mul i32 %a3, %a3
  %a5 = mul i32 %a4, %a4
  %a6 = mul i32 %a5, %a5
  %a7 = mul i32 %a6, %a6
  %a8 = mul i32 %a7, %a7
  %a9 = mul i32 %a8, %a8
  %a10 = mul i32 %a9, %a9
  %a11 = mul i32 %a10, %a10
  %a12 = mul i32 %a11, %a11
  %a13 = mul i32 %a12, %a12
  %a14 = mul i32 %a13, %a13
  %a15 = mul i32 %a14, %a14
  %a16 = mul i32 %a15, %a15
  %a17 = mul i32 %a16, %a16
  %a18 = mul i32 %a17, %a17
  %a19 = mul i32 %a18, %a18
  %a20 = mul i32 %a19, %a19
  %a21 = mul i32 %a20, %a20
  %a22 = mul i32 %a21, %a21
  %a23 = mul i32 %a22, %a22
  %a24 = mul i32 %a23, %a23
  %T = trunc i32 %a24 to i16
  ret i16 %T
}

llvm-svn: 324276

6 years agorefactor: DWARFCompileUnit::Producer -> DWARFProducer
Jan Kratochvil [Mon, 5 Feb 2018 21:50:01 +0000 (21:50 +0000)]
refactor: DWARFCompileUnit::Producer -> DWARFProducer

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

llvm-svn: 324275

6 years ago[SDAG] Legalize all CondCodes by inverting them and/or swapping operands
Krzysztof Parzyszek [Mon, 5 Feb 2018 21:27:16 +0000 (21:27 +0000)]
[SDAG] Legalize all CondCodes by inverting them and/or swapping operands

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

llvm-svn: 324274

6 years ago[SimplifyLibCalls] Update from deprecated IRBuilder API for creating memory intrinsic...
Daniel Neilson [Mon, 5 Feb 2018 21:23:22 +0000 (21:23 +0000)]
[SimplifyLibCalls] Update from deprecated IRBuilder API for creating memory intrinsics (NFC)

Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
SimplifyLibCalls pass to cease using the old IRBuilder createMemCpy/createMemMove
single-alignment APIs in favour of the new API that allows setting source and destination
alignments independently.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, r3L24148 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

llvm-svn: 324273

6 years agoReplace ApplyDynamicRelocs with WriteAddends.
Rafael Espindola [Mon, 5 Feb 2018 20:55:46 +0000 (20:55 +0000)]
Replace ApplyDynamicRelocs with WriteAddends.

The difference is that WriteAddends also takes IsRela into
consideration.

llvm-svn: 324271

6 years ago[DWARF] Regularize dumping strings from line tables.
Paul Robinson [Mon, 5 Feb 2018 20:43:15 +0000 (20:43 +0000)]
[DWARF] Regularize dumping strings from line tables.

The major visible difference here is that in line-table dumps,
directory and file names are wrapped in double-quotes; previously,
directory names got single quotes and file names were not quoted at
all.

The improvement in this patch is that when a DWARF v5 line table
header has indirect strings, in a verbose dump these will all have
their section[offset] printed as well as the name itself.  This
matches the format used for dumping strings in the .debug_info
section.

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

llvm-svn: 324270

6 years agoAdd support for attribute 'trivial_abi'.
Akira Hatanaka [Mon, 5 Feb 2018 20:23:22 +0000 (20:23 +0000)]
Add support for attribute 'trivial_abi'.

The 'trivial_abi' attribute can be applied to a C++ class, struct, or
union. It makes special functions of the annotated class (the destructor
and copy/move constructors) to be trivial for the purpose of calls and,
as a result, enables the annotated class or containing classes to be
passed or returned using the C ABI for the underlying type.

When a type that is considered trivial for the purpose of calls despite
having a non-trivial destructor (which happens only when the class type
or one of its subobjects is a 'trivial_abi' class) is passed to a
function, the callee is responsible for destroying the object.

For more background, see the discussions that took place on the mailing
list:

http://lists.llvm.org/pipermail/cfe-dev/2017-November/055955.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180101/thread.html#214043

rdar://problem/35204524

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

llvm-svn: 324269

6 years ago[sanitizer] Revert rL324263
Kostya Kortchinsky [Mon, 5 Feb 2018 20:17:24 +0000 (20:17 +0000)]
[sanitizer] Revert rL324263

Summary:
The 32-bit division  breaks SizeClassAllocator64PopulateFreeListOOM which uses
Primary that has a maximum size > 32-bit.

Reviewers: alekseyshl

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

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

llvm-svn: 324268

6 years ago[InstCombine] add test corresponding to r324252 (PR36225); NFC
Sanjay Patel [Mon, 5 Feb 2018 19:59:52 +0000 (19:59 +0000)]
[InstCombine] add test corresponding to r324252 (PR36225); NFC

As PR36225 shows, we definitely don't want to enable the
canEvaluate* logic with phis.

There's still a question of whether we should just revert
r324014 completely because it exposes a compile-time sinkhole
(although that problem might exist independently).

llvm-svn: 324266

6 years agoAdd release note on change to memcpy/memmove/memset builtin signatures
Daniel Neilson [Mon, 5 Feb 2018 19:39:38 +0000 (19:39 +0000)]
Add release note on change to memcpy/memmove/memset builtin signatures

Summary:
The signatures for the builtins @llvm.memcpy, @llvm.memmove, and @llvm.memset
where changed in rL322965. The number of arguments has decreased from five to
four with the removal of the alignment argument. Alignment is now conveyed
by supplying the align parameter attribute on the destination and/or source of
the cpy/move/set.

llvm-svn: 324265

6 years agoChange the default of --apply-dynamic-relocs.
Rafael Espindola [Mon, 5 Feb 2018 19:39:04 +0000 (19:39 +0000)]
Change the default of --apply-dynamic-relocs.

When using Elf_Rela every tool should use the addend in the
relocation.

We have --apply-dynamic-relocs to work around bugs in tools that don't
do that.

The default value of --apply-dynamic-relocs should be false to make
sure these bugs are more easily found in the future.

llvm-svn: 324264

6 years ago[sanitizer] SizeClassMap minor improvement/correctness changes
Kostya Kortchinsky [Mon, 5 Feb 2018 19:22:56 +0000 (19:22 +0000)]
[sanitizer] SizeClassMap minor improvement/correctness changes

Summary:
In `ClassID`, make sure we use an unsigned as based for the `lbits` shift.
The previous code resulted in spurious sign extensions like for x64:
```
add     esi, 0FFFFFFFFh
movsxd  rcx, esi
and     rcx, r15
```
The code with the `U` added is:
```
add     esi, 0FFFFFFFFh
and     rsi, r15
```
And for `MaxCachedHint`, use a 32-bit division instead of `64-bit`, which is
faster (https://lemire.me/blog/2017/11/16/fast-exact-integer-divisions-using-floating-point-operations/)
and already used in other parts of the code (64-bit `GetChunkIdx`, 32-bit
`GetMetaData` enforce 32-bit divisions)

Not major performance gains by any mean, but they don't hurt.

Reviewers: alekseyshl

Reviewed By: alekseyshl

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

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

llvm-svn: 324263

6 years agoAllow both -no-omagic and --no-omagic.
Rui Ueyama [Mon, 5 Feb 2018 19:14:03 +0000 (19:14 +0000)]
Allow both -no-omagic and --no-omagic.

Any multi-character option that doesn't start with "o" should be
allowed to start both with "-" and "--".

llvm-svn: 324262

6 years ago[X86] Teach DAG unfoldMemoryOperand to reconvert CMPs to tests
Nirav Dave [Mon, 5 Feb 2018 18:58:58 +0000 (18:58 +0000)]
[X86] Teach DAG unfoldMemoryOperand to reconvert CMPs to tests

Summary:
Copy MI-level cmp->test conversion to SelectionDAG-level memory unfold.
This fixes a regression from upcoming D41293 change.

Reviewers: craig.topper, RKSimon

Reviewed By: craig.topper

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 324261

6 years ago[X86] Artificially lower the complexity of the scalar ANDN patterns so that AND with...
Craig Topper [Mon, 5 Feb 2018 18:31:04 +0000 (18:31 +0000)]
[X86] Artificially lower the complexity of the scalar ANDN patterns so that AND with immediate will match first.

This allows the immediate to folded into the and instead of being forced to move into a register. This can sometimes result in shorter encodings since the and can sign extend an immediate.

This also allows us to match an and to a movzx after a not.

This can cause an extra move if the input to the separate NOT has an additional user which requires a copy before the NOT.

llvm-svn: 324260

6 years ago[Options] Make --cuda-path-ignore-env a Flag, NFCI.
Jonas Hahnfeld [Mon, 5 Feb 2018 18:19:40 +0000 (18:19 +0000)]
[Options] Make --cuda-path-ignore-env a Flag, NFCI.

This option doesn't take an argument!

llvm-svn: 324259

6 years ago[sanitizer] Allocator local cache improvements
Kostya Kortchinsky [Mon, 5 Feb 2018 18:06:45 +0000 (18:06 +0000)]
[sanitizer] Allocator local cache improvements

Summary:
Here are a few improvements proposed for the local cache:
- `InitCache` always read from `per_class_[1]` in the fast path. This was not
  ideal as we are working with `per_class_[class_id]`. The latter offers the
  same property we are looking for (eg: `max_count != 0` means initialized),
  so we might as well use it and keep our memory accesses local to the same
  `per_class_` element. So change `InitCache` to take the current `PerClass`
  as an argument. This also makes the fast-path assembly of `Deallocate` a lot
  more compact;
- Change the 32-bit `Refill` & `Drain` functions to mimic their 64-bit
  counterparts, by passing the current `PerClass` as an argument. This saves
  some array computations;
- As far as I can tell, `InitCache` has no place in `Drain`: it's either called
  from `Deallocate` which calls `InitCache`, or from the "upper" `Drain` which
  checks for `c->count` to be greater than 0 (strictly). So remove it there.
- Move the `stats_` updates to after we are done with the `per_class_` accesses
  in an attempt to preserve locality once more;
- Change some `CHECK` to `DCHECK`: I don't think the ones changed belonged in
  the fast path and seemed to be overly cautious failsafes;
- Mark some variables as `const`.

The overall result is cleaner more compact fast path generated code, and some
performance gains with Scudo (and likely other Sanitizers).

Reviewers: alekseyshl

Reviewed By: alekseyshl

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

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

llvm-svn: 324257

6 years agoAdd a comment explaining how the input for GetModuleSpecifications_EarlySectionHeader...
Pavel Labath [Mon, 5 Feb 2018 18:03:02 +0000 (18:03 +0000)]
Add a comment explaining how the input for GetModuleSpecifications_EarlySectionHeaders was generated

Davide pointed out this would be useful if the file ever needs to be
regenerated (and I certainly agree).

I also replace the test binary with a slightly smaller one -- I intended
to do this in the original commit, but I forgot to add it to the patch
as I was juggling several things at the same time.

llvm-svn: 324256

6 years ago[InstCombine] add unsigned saturation subtraction canonicalizations
Sanjay Patel [Mon, 5 Feb 2018 17:53:29 +0000 (17:53 +0000)]
[InstCombine] add unsigned saturation subtraction canonicalizations

This is the instcombine part of unsigned saturation canonicalization.
Backend patches already commited:
https://reviews.llvm.org/D37510
https://reviews.llvm.org/D37534

It converts unsigned saturated subtraction patterns to forms recognized
by the backend:
(a > b) ? a - b : 0 -> ((a > b) ? a : b) - b)
(b < a) ? a - b : 0 -> ((a > b) ? a : b) - b)
(b > a) ? 0 : a - b -> ((a > b) ? a : b) - b)
(a < b) ? 0 : a - b -> ((a > b) ? a : b) - b)
((a > b) ? b - a : 0) -> - ((a > b) ? a : b) - b)
((b < a) ? b - a : 0) -> - ((a > b) ? a : b) - b)
((b > a) ? 0 : b - a) -> - ((a > b) ? a : b) - b)
((a < b) ? 0 : b - a) -> - ((a > b) ? a : b) - b)

Patch by Yulia Koval!

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

llvm-svn: 324255

6 years agoFix parsing of object files with "early" section headers
Pavel Labath [Mon, 5 Feb 2018 17:25:40 +0000 (17:25 +0000)]
Fix parsing of object files with "early" section headers

ObjectFileELF::GetModuleSpecifications contained a lot of tip-toing code
which was trying to avoid loading the full object file into memory. It
did this by trying to load data only up to the offset if was accessing.
However, in practice this was useless, as 99% of object files we
encounter have section headers at the end, so we would load the whole
file as soon as we start parsing the section headers.

In fact, this would break as soon as we encounter a file which does
*not* have section headers at the end (yaml2obj produces these), as the
access to .strtab (which we need to get the section names) was not
guarded by this offset check.

As this strategy was completely ineffective anyway, I do not attempt to
proliferate it further by guarding the .strtab accesses. Instead I just
lead the full file as soon as we are reasonably sure that we are indeed
processing an elf file.

If we really care about the load size here, we would need to reimplement
this to just load the bits of the object file we need, instead of
loading everything from the start of the object file to the given
offset. However, given that the OS will do this for us for free when
using mmap, I think think this is really necessary.

For testing this I check a (tiny) SO file instead of yaml2obj-ing it
because the fact that they come out first is an implementation detail of
yaml2obj that can change in the future.

llvm-svn: 324254

6 years agoLTO: Include dso-local bit in ThinLTO cache key.
Peter Collingbourne [Mon, 5 Feb 2018 17:17:51 +0000 (17:17 +0000)]
LTO: Include dso-local bit in ThinLTO cache key.

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

llvm-svn: 324253

6 years ago[InstCombine] only allow narrow/wide evaluation of values with >1 use if that user...
Sanjay Patel [Mon, 5 Feb 2018 17:16:50 +0000 (17:16 +0000)]
[InstCombine] only allow narrow/wide evaluation of values with >1 use if that user is a binop

There was a logic hole in D42739 / rL324014 because we're not accounting for select and phi
instructions that might have repeated operands. This is likely a source of an infinite loop.
I haven't manufactured a test case to prove that, but it should be safe to speculatively limit
this transform to binops while we try to create that test.

llvm-svn: 324252

6 years agoSync PlatformNetBSD.cpp with Linux
Kamil Rytarowski [Mon, 5 Feb 2018 17:12:23 +0000 (17:12 +0000)]
Sync PlatformNetBSD.cpp with Linux

Summary:
Various changes in logging from log->Printf() to generic LLDB_LOG().

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg

Reviewed By: labath

Subscribers: llvm-commits, lldb-commits

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

llvm-svn: 324251

6 years ago[Hexagon] Memoize instruction positions in BitTracker
Krzysztof Parzyszek [Mon, 5 Feb 2018 17:12:07 +0000 (17:12 +0000)]
[Hexagon] Memoize instruction positions in BitTracker

llvm-svn: 324250

6 years ago[X86] Teach X86DAGToDAGISel::shrinkAndImmediate to preserve upper 32 zeroes of a...
Craig Topper [Mon, 5 Feb 2018 16:54:07 +0000 (16:54 +0000)]
[X86] Teach X86DAGToDAGISel::shrinkAndImmediate to preserve upper 32 zeroes of a 64 bit mask.

If the upper 32 bits of a 64 bit mask are all zeros, we have special isel patterns to use a 32-bit and instead of a 64-bit and by relying on the impliciting zeroing of 32 bit ops.

This patch teachs shrinkAndImmediate not to break that optimization.

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

llvm-svn: 324249

6 years agoRevert r323472 "[Debug] Add dbg.value intrinsics for PHIs created during LCSSA."
Hans Wennborg [Mon, 5 Feb 2018 16:10:42 +0000 (16:10 +0000)]
Revert r323472 "[Debug] Add dbg.value intrinsics for PHIs created during LCSSA."

This broke the Chromium build; see PR36238.

> This patch is an enhancement to propagate dbg.value information when
> Phis are created on behalf of LCSSA.  I noticed a case where a value
> carried across a loop was reported as <optimized out>.
>
> Specifically this case:
>
>   int bar(int x, int y) {
>     return x + y;
>   }
>
>   int foo(int size) {
>     int val = 0;
>     for (int i = 0; i < size; ++i) {
>       val = bar(val, i);  // Both val and i are correct
>     }
>     return val; // <optimized out>
>   }
>
> In the above case, after all of the interesting computation completes
> our value is reported as "optimized out." This change will add a
> dbg.value to correct this.
>
> This patch also moves the dbg.value insertion routine from
> LoopRotation.cpp into Local.cpp, so that we can share it in both places
> (LoopRotation and LCSSA).
>
> Patch by Matt Davis!
>
> Differential Revision: https://reviews.llvm.org/D42551

llvm-svn: 324247

6 years ago[clang-format] Re-land: Fixup #include guard indents after parseFile()
Mark Zeren [Mon, 5 Feb 2018 15:59:00 +0000 (15:59 +0000)]
[clang-format] Re-land: Fixup #include guard indents after parseFile()

Summary:
When a preprocessor indent closes after the last line of normal code we do not
correctly fixup include guard indents. For example:

  #ifndef HEADER_H
  #define HEADER_H
  #if 1
  int i;
  #  define A 0
  #endif
  #endif

incorrectly reformats to:

  #ifndef HEADER_H
  #define HEADER_H
  #if 1
  int i;
  #    define A 0
  #  endif
  #endif

To resolve this issue we must fixup levels after parseFile(). Delaying
the fixup introduces a new state, so consolidate include guard search
state into an enum.

Reviewers: krasimir, klimek

Subscribers: cfe-commits

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

llvm-svn: 324246

6 years agoBitTracker.h needs a full definition of MachineInstr, so include the defining file.
Benjamin Kramer [Mon, 5 Feb 2018 15:56:24 +0000 (15:56 +0000)]
BitTracker.h needs a full definition of MachineInstr, so include the defining file.

Patch by Dean Sturtevant!

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

llvm-svn: 324245

6 years ago[Hexagon] Forgot about HexagonISD::VZERO in selecting const vectors
Krzysztof Parzyszek [Mon, 5 Feb 2018 15:52:54 +0000 (15:52 +0000)]
[Hexagon] Forgot about HexagonISD::VZERO in selecting const vectors

llvm-svn: 324244