OSDN Git Service

android-x86/external-llvm.git
6 years agoLowerAtomic: Don't skip optnone functions; atomic still need lowering (PR34020)
Hans Wennborg [Wed, 23 Aug 2017 15:43:28 +0000 (15:43 +0000)]
LowerAtomic: Don't skip optnone functions; atomic still need lowering (PR34020)

The lowering isn't really an optimization, so optnone shouldn't make a
difference. ARM relies on the pass running when using "-mthread-model
single", because in that mode, it doesn't run AtomicExpand. See bug for
more details.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311565 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFixed invalid variable name in Dockerfile scripts.
Ilya Biryukov [Wed, 23 Aug 2017 15:36:44 +0000 (15:36 +0000)]
Fixed invalid variable name in Dockerfile scripts.

LLVM_SVN_REVISION was used instead of LLVM_SVN_REV.
This caused a revision option to be ignored in Dockerfiles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311564 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert r311546 as it breaks build
Victor Leschuk [Wed, 23 Aug 2017 15:21:10 +0000 (15:21 +0000)]
Revert r311546 as it breaks build

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/4394

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311560 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMake lit :: shtest-format.py supported on Windows again
Victor Leschuk [Wed, 23 Aug 2017 14:59:09 +0000 (14:59 +0000)]
Make lit :: shtest-format.py supported on Windows again

It was marked as unsupported on Windows in r311230 because on some Win10
machines it failed or caused hang. The problem was that on these machines
system bash (C:\Windows\System32\bash.exe) was used which requires paths to be
passed like '/mnt/c/path/to/my/script' instead of 'C:\path\to\my\script'.

TODO: we should make lit detect if system bash is used instead of msys and set
appropriate path format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311558 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert r311552: [Bash-autocompletion] Add support for static analyzer flags
Rui Ueyama [Wed, 23 Aug 2017 14:48:58 +0000 (14:48 +0000)]
Revert r311552: [Bash-autocompletion] Add support for static analyzer flags

This reverts commit r311552 because it broke ubsan and asan bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311557 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[coroutines] CoroBegin from inner coroutines should be considered for spills
Gor Nishanov [Wed, 23 Aug 2017 14:47:52 +0000 (14:47 +0000)]
[coroutines] CoroBegin from inner coroutines should be considered for spills

Summary:
If a coroutine outer calls another coroutine inner and the inner coroutine body is inlined into the outer, coro.begin from the inner coroutine should be considered for spilling if accessed across suspends.

Prior to this change, coroutine frame building code was not considering any coro.begins for spilling.
With this change, we only ignore coro.begin for the current coroutine, but, any coro.begins that were inlined into the current coroutine are eligible for spills.

Fixes PR34267

Reviewers: GorNishanov

Subscribers: qcolombet, llvm-commits, EricWF

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311556 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Reassociate] Don't canonicalize x + (-Constant * y) -> x - (Constant * y)..
Chad Rosier [Wed, 23 Aug 2017 14:10:06 +0000 (14:10 +0000)]
[Reassociate] Don't canonicalize x + (-Constant * y) -> x - (Constant * y)..

..if the resulting subtract will be broken up later.  This can cause us to get
into an infinite loop.

x + (-5.0 * y)      -> x - (5.0 * y)       ; Canonicalize neg const
x - (5.0 * y)       -> x + (0 - (5.0 * y)) ; Break up subtract
x + (0 - (5.0 * y)) -> x + (-5.0 * y)      ; Replace 0-X with X*-1.

PR34078

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311554 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Bash-autocompletion] Add support for static analyzer flags
Yuka Takahashi [Wed, 23 Aug 2017 13:39:47 +0000 (13:39 +0000)]
[Bash-autocompletion] Add support for static analyzer flags

Summary:
This is a patch for clang autocomplete feature.

It will collect values which -analyzer-checker takes, which is defined in
clang/StaticAnalyzer/Checkers/Checkers.inc, dynamically.
First, from ValuesCode class in Options.td, TableGen will generate C++
code in Options.inc. Options.inc will be included in DriverOptions.cpp, and
calls OptTable's addValues function. addValues function will add second
argument to Option's Values class. Values contains string like "foo,bar,.."
which is handed to Values class
in OptTable.

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: hiraditya, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311552 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[globalisel][tablegen] Add support for ImmLeaf without SDNodeXForm
Daniel Sanders [Wed, 23 Aug 2017 12:14:18 +0000 (12:14 +0000)]
[globalisel][tablegen] Add support for ImmLeaf without SDNodeXForm

Summary:
This patch adds support for predicates on imm nodes but only for ImmLeaf and not for PatLeaf or PatFrag and only where the value does not need to be transformed before being rendered into the instruction.

The limitation on PatLeaf/PatFrag/SDNodeXForm is due to differences in the necessary target-supplied C++ for GlobalISel.

Depends on D36085

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, javed.absar, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311546 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] Check for assembler instructions in test.
Florian Hahn [Wed, 23 Aug 2017 11:53:24 +0000 (11:53 +0000)]
[ARM] Check for assembler instructions in test.

Currently this test causes test failures on some machines, due to isel not being registered. Update the test to run all passes and check emitted assembly instructions for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311545 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] Add missing patterns for insert_subvector.
Florian Hahn [Wed, 23 Aug 2017 10:20:59 +0000 (10:20 +0000)]
[ARM] Add missing patterns for insert_subvector.

Summary: In some cases, shufflevector instruction can be transformed involving insert_subvector instructions. The ARM backend was missing some insert_subvector patterns, causing a failure during instruction selection. AArch64 has similar patterns.

Reviewers: t.p.northover, olista01, javed.absar, rengolin

Reviewed By: javed.absar

Subscribers: aemerson, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311543 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[globalisel][tablegen] Add tests for FeatureBitsets and ComplexPattern predicates.
Daniel Sanders [Wed, 23 Aug 2017 10:09:25 +0000 (10:09 +0000)]
[globalisel][tablegen] Add tests for FeatureBitsets and ComplexPattern predicates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311542 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[gold] Test we don't strip globals when producing relocatables.
Davide Italiano [Wed, 23 Aug 2017 09:43:41 +0000 (09:43 +0000)]
[gold] Test we don't strip globals when producing relocatables.

lld was broken in this regard (PR33097). The gold plugin gets this
right so, no changes needed, but better adding a test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311541 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Fold branches with irrelevant conditions to a constant.
Davide Italiano [Wed, 23 Aug 2017 09:14:37 +0000 (09:14 +0000)]
[InstCombine] Fold branches with irrelevant conditions to a constant.

InstCombine folds instructions with irrelevant conditions to undef.
This, as Nuno confirmed is a bug.
(see https://bugs.llvm.org/show_bug.cgi?id=33409#c1 )

Given the original motivation for the change is that of removing an
USE, we now fold to false instead (which reaches the same goal
without undesired side effects).

Fixes PR33409.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311540 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PowerPC] better instruction selection for OR (XOR) with a 32-bit immediate
Hiroshi Inoue [Wed, 23 Aug 2017 08:55:18 +0000 (08:55 +0000)]
[PowerPC] better instruction selection for OR (XOR) with a 32-bit immediate

- recommitting after fixing a test failure on MacOS

On PPC64, OR (XOR) with a 32-bit immediate can be done with only two instructions, i.e. ori + oris.
But the current LLVM generates three or four instructions for this purpose (and also it clobbers one GPR).

This patch makes PPC backend generate ori + oris (xori + xoris) for OR (XOR) with a 32-bit immediate.

e.g. (x | 0xFFFFFFFF) should be

ori 3, 3, 65535
oris 3, 3, 65535

but LLVM generates without this patch

li 4, 0
oris 4, 4, 65535
ori 4, 4, 65535
or 3, 3, 4

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311538 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64] Silence unused variable warning in opt mode after r311533
Krasimir Georgiev [Wed, 23 Aug 2017 08:40:22 +0000 (08:40 +0000)]
[AArch64] Silence unused variable warning in opt mode after r311533

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311535 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64] ISel legalization debug messages. NFCI.
Sjoerd Meijer [Wed, 23 Aug 2017 08:18:37 +0000 (08:18 +0000)]
[AArch64] ISel legalization debug messages. NFCI.

Debugging AArch64 instruction legalization and custom lowering is really an
unpleasant experience because it shows nodes that appear out of thin air.
In commit r311444, some debug messages have been added to SelectionDAG, the
target independent part, and this patch adds some AArch64 specific messages.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311533 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Lanai] Remove dead functions from LanaiRegisterInfo
Alex Bradbury [Wed, 23 Aug 2017 07:14:48 +0000 (07:14 +0000)]
[Lanai] Remove dead functions from LanaiRegisterInfo

getEHExceptionRegister and getEHHandlerRegister are unused and were removed
from most backends in rL192099. This patch removes them from Lanai.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311531 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert rL311526: [PowerPC] better instruction selection for OR (XOR) with a 32-bit...
Hiroshi Inoue [Wed, 23 Aug 2017 06:38:05 +0000 (06:38 +0000)]
Revert rL311526: [PowerPC] better instruction selection for OR (XOR) with a 32-bit immediate

This reverts commit rL311526 due to failures in some buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311530 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Remove unused argument. NFC
Craig Topper [Wed, 23 Aug 2017 05:46:09 +0000 (05:46 +0000)]
[InstCombine] Remove unused argument. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311529 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Replace a simple matcher with a plain old dyn_cast. NFC
Craig Topper [Wed, 23 Aug 2017 05:46:08 +0000 (05:46 +0000)]
[InstCombine] Replace a simple matcher with a plain old dyn_cast. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311528 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Remove an unnecessary dyn_cast to Instruction and a switch over two...
Craig Topper [Wed, 23 Aug 2017 05:46:07 +0000 (05:46 +0000)]
[InstCombine] Remove an unnecessary dyn_cast to Instruction and a switch over two opcodes. Just dyn_cast to the specific instruction classes individually. NFC

Change the helper methods to take the more specific class as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311527 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PowerPC] better instruction selection for OR (XOR) with a 32-bit immediate
Hiroshi Inoue [Wed, 23 Aug 2017 05:15:15 +0000 (05:15 +0000)]
[PowerPC] better instruction selection for OR (XOR) with a 32-bit immediate

On PPC64, OR (XOR) with a 32-bit immediate can be done with only two instructions, i.e. ori + oris.
But the current LLVM generates three or four instructions for this purpose (and also it clobbers one GPR).

This patch makes PPC backend generate ori + oris (xori + xoris) for OR (XOR) with a 32-bit immediate.

e.g. (x | 0xFFFFFFFF) should be

ori 3, 3, 65535
oris 3, 3, 65535

but LLVM generates without this patch

li 4, 0
oris 4, 4, 65535
ori 4, 4, 65535
or 3, 3, 4

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311526 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[XRay][CodeGen] Use PIC-friendly code in XRay sleds; remove synthetic references...
Dean Michael Berris [Wed, 23 Aug 2017 04:49:41 +0000 (04:49 +0000)]
[XRay][CodeGen] Use PIC-friendly code in XRay sleds; remove synthetic references in .text

Summary:
This change achieves two things:

  - Redefine the Custom Event handling instrumentation points emitted by
    the compiler to not require dynamic relocation of references to the
    __xray_CustomEvent trampoline.

  - Remove the synthetic reference we emit at the end of a function that
    we used to keep auxiliary sections alive in favour of SHF_LINK_ORDER
    associated with the section where the function is defined.

To achieve the custom event handling change, we've had to introduce the
concept of sled versioning -- this will need to be supported by the
runtime to allow us to understand how to turn on/off the new version of
the custom event handling sleds. That change has to land first before we
change the way we write the sleds.

To remove the synthetic reference, we rely on a relatively new linker
feature that preserves the sections that are associated with each other.
This allows us to limit the effects on the .text section of ELF
binaries.

Because we're still using absolute references that are resolved at
runtime for the instrumentation map (and function index) maps, we mark
these sections write-able. In the future we can re-define the entries in
the map to use relative relocations instead that can be statically
determined by the linker. That change will be a bit more invasive so we
defer this for later.

Depends on D36816.

Reviewers: dblaikie, echristo, pcc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311525 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agobpf: add variants of -mcpu=# and support for additional jmp insns
Yonghong Song [Wed, 23 Aug 2017 04:25:57 +0000 (04:25 +0000)]
bpf: add variants of -mcpu=# and support for additional jmp insns

-mcpu=# will support:
  . generic: the default insn set
  . v1: insn set version 1, the same as generic
  . v2: insn set version 2, version 1 + additional jmp insns
  . probe: the compiler will probe the underlying kernel to
           decide proper version of insn set.

We did not not use -mcpu=native since llc/llvm will interpret -mcpu=native
as the underlying hardware architecture regardless of -march value.

Currently, only x86_64 supports -mcpu=probe. Other architecture will
silently revert to "generic".

Also added -mcpu=help to print available cpu parameters.
llvm will print out the information only if there are at least one
cpu and at least one feature. Add an unused dummy feature to
enable the printout.

Examples for usage:
$ llc -march=bpf -mcpu=v1 -filetype=asm t.ll
$ llc -march=bpf -mcpu=v2 -filetype=asm t.ll
$ llc -march=bpf -mcpu=generic -filetype=asm t.ll
$ llc -march=bpf -mcpu=probe -filetype=asm t.ll
$ llc -march=bpf -mcpu=v3 -filetype=asm t.ll
'v3' is not a recognized processor for this target (ignoring processor)
...
$ llc -march=bpf -mcpu=help -filetype=asm t.ll
Available CPUs for this target:

  generic - Select the generic processor.
  probe   - Select the probe processor.
  v1      - Select the v1 processor.
  v2      - Select the v2 processor.

Available features for this target:

  dummy - unused feature.

Use +feature to enable a feature, or -feature to disable it.
For example, llc -mcpu=mycpu -mattr=+feature1,-feature2
...

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311522 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix tail-merge-after-mbp test
Matthias Braun [Wed, 23 Aug 2017 03:49:53 +0000 (03:49 +0000)]
Fix tail-merge-after-mbp test

The output of this test changed after the fix in r311520 to have
-run-pass=block-placement behave like it does in a normal pipeline.
Adjust the test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311521 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd test case for r311511
Matthias Braun [Wed, 23 Aug 2017 03:17:59 +0000 (03:17 +0000)]
Add test case for r311511

This also changes the TailDuplicator to be configured explicitely
pre/post regalloc rather than relying on the isSSA() flag. This was
necessary to have `llc -run-pass` work reliably.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311520 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoNFC: fix ToolDrivers syntax and typo errors
Martell Malone [Wed, 23 Aug 2017 02:10:28 +0000 (02:10 +0000)]
NFC: fix ToolDrivers syntax and typo errors

infoTable -> InfoTable camelCase
Libtool Options #define offset

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311517 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUpdate LLVM fuzzers to use the libFuzzer bundled with the compiler toolchain
George Karpenkov [Wed, 23 Aug 2017 00:40:58 +0000 (00:40 +0000)]
Update LLVM fuzzers to use the libFuzzer bundled with the compiler toolchain

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311515 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove llvm-pdbutil/fuzzer.
George Karpenkov [Wed, 23 Aug 2017 00:02:10 +0000 (00:02 +0000)]
Remove llvm-pdbutil/fuzzer.

The code does not compile, is not maintained, and does not have a buildbot.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311512 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoTargetInstrInfo: Change duplicate() to work on bundles.
Matthias Braun [Tue, 22 Aug 2017 23:56:30 +0000 (23:56 +0000)]
TargetInstrInfo: Change duplicate() to work on bundles.

Adds infrastructure to clone whole instruction bundles rather than just
single instructions. This fixes a bug where tail duplication would
unbundle instructions while cloning.

This should unbreak the "Clang Stage 1: cmake, RA, with expensive checks
enabled" build on greendragon. The bot broke with r311139 hitting this
pre-existing bug.

A proper testcase will come next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311511 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SelectionDAG] Make ISD::isConstantSplatVector always return an element sized APInt.
Craig Topper [Tue, 22 Aug 2017 23:54:13 +0000 (23:54 +0000)]
[SelectionDAG] Make ISD::isConstantSplatVector always return an element sized APInt.

This partially reverts r311429 in favor of making ISD::isConstantSplatVector do something not confusing. Turns out the only other user of it was also having to deal with the weird property of it returning a smaller size.

So rather than continue to deal with this quirk everywhere, just make the interface do something sane.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311510 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Remove check for sext of vector icmp from shouldOptimizeCast
Craig Topper [Tue, 22 Aug 2017 23:40:15 +0000 (23:40 +0000)]
[InstCombine] Remove check for sext of vector icmp from shouldOptimizeCast

Looks like for 'and' and 'or' we end up performing at least some of the transformations this is bocking in a round about way anyway.

For 'and sext(cmp1), sext(cmp2) we end up later turning it into 'select cmp1, sext(cmp2), 0'. Then we optimize that back to sext (and cmp1, cmp2). This is the same result we would have gotten if shouldOptimizeCast hadn't blocked it. We do something analogous for 'or'.

With this patch we allow that transformation to happen directly in foldCastedBitwiseLogic. And we now support the same thing for 'xor'. This is definitely opening up many other cases, but since we already went around it for some cases hopefully it's ok.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311508 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[llvm-dwarfdump] Print type names in DW_AT_type DIEs"
Jonas Devlieghere [Tue, 22 Aug 2017 21:59:46 +0000 (21:59 +0000)]
Revert "[llvm-dwarfdump] Print type names in DW_AT_type DIEs"

This reverts commit r311492.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311499 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-dwarfdump] Print type names in DW_AT_type DIEs
Jonas Devlieghere [Tue, 22 Aug 2017 21:41:49 +0000 (21:41 +0000)]
[llvm-dwarfdump] Print type names in DW_AT_type DIEs

This patch adds printing for DW_AT_type DIEs like it's currently already
the case for DW_AT_specification DIEs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311492 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoWholeProgramDevirt: Create bitcast to i8* at each virtual call site.
Peter Collingbourne [Tue, 22 Aug 2017 21:41:19 +0000 (21:41 +0000)]
WholeProgramDevirt: Create bitcast to i8* at each virtual call site.

We can't reuse the llvm.assume instruction's bitcast because it may not
dominate every user of the vtable pointer.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311491 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SanitizerCoverage] Optimize stack-depth instrumentation.
Matt Morehouse [Tue, 22 Aug 2017 21:28:29 +0000 (21:28 +0000)]
[SanitizerCoverage] Optimize stack-depth instrumentation.

Summary:
Use the initialexec TLS type and eliminate calls to the TLS
wrapper.  Fixes the sanitizer-x86_64-linux-fuzzer bot failure.

Reviewers: vitalybuka, kcc

Reviewed By: kcc

Subscribers: hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311490 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ADCE][Dominators] Reapply: Teach ADCE to preserve dominators
Jakub Kuderski [Tue, 22 Aug 2017 16:30:21 +0000 (16:30 +0000)]
[ADCE][Dominators] Reapply: Teach ADCE to preserve dominators

Summary:
This patch teaches ADCE to preserve both DominatorTrees and PostDominatorTrees.

This is reapplies the original patch r311057 that was reverted in r311381.
The previous version wasn't using the batch update api for updating dominators,
which in vary rare cases caused assertion failures.

This also fixes PR34258.

Reviewers: dberlin, chandlerc, sanjoy, davide, grosser, brzycki

Reviewed By: davide

Subscribers: grandinj, zhendongsu, llvm-commits, david2050

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311467 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Debug info] Add new DbgValues after looping over DAG
Jonas Devlieghere [Tue, 22 Aug 2017 16:28:07 +0000 (16:28 +0000)]
[Debug info] Add new DbgValues after looping over DAG

I was contacted by Jesper Antonsson from Ericsson who ran into problems
with r311181 in their test suites with for an out-of-tree target.
Because of the latter I don't have a reproducer, but we definitely don't
want to modify the data structure on which we are iterating inside the
loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311466 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] auto-generate full checks; NFC
Sanjay Patel [Tue, 22 Aug 2017 16:27:00 +0000 (16:27 +0000)]
[x86] auto-generate full checks; NFC

I don't see anything Darwin-specific here, so I made the target generic x86-64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311465 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] simplify runs and auto-generate full checks
Sanjay Patel [Tue, 22 Aug 2017 16:21:45 +0000 (16:21 +0000)]
[x86] simplify runs and auto-generate full checks

I've replaced the two OS-specific runs with a generic run because
there's no functional difference in the resulting output that
we're checking. Also, the script still doesn't work with a Win
target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311463 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoEmit section information for extern variables
Erich Keane [Tue, 22 Aug 2017 15:30:43 +0000 (15:30 +0000)]
Emit section information for extern variables

Update IR generated to retain section information for external declarations.
This is related to https://reviews.llvm.org/D36487

Patch By: eandrews
Differential Revision: https://reviews.llvm.org/D36712

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311459 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM][AArch64] Add Armv8.3-a unittests
Sam Parker [Tue, 22 Aug 2017 12:46:33 +0000 (12:46 +0000)]
[ARM][AArch64] Add Armv8.3-a unittests

Add Armv8.3-A to the architecture to the TargetParser unittests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311450 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM][AArch64] v8.3-A Javascript Conversion
Sam Parker [Tue, 22 Aug 2017 11:08:21 +0000 (11:08 +0000)]
[ARM][AArch64] v8.3-A Javascript Conversion

Armv8.3-A adds instructions that convert a double-precision floating
point number to a signed 32-bit integer with round towards zero,
designed for improving Javascript performance.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311448 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] Avoid creating duplicate ANDs in SelectionDAG
Renato Golin [Tue, 22 Aug 2017 11:02:45 +0000 (11:02 +0000)]
[ARM] Avoid creating duplicate ANDs in SelectionDAG

When expanding a BRCOND into a BR_CC, do not create an AND 1
if one already exists.

Review: D36705

Patch by Joel Galenson <jgalenson@google.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311447 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] Call setBooleanContents(ZeroOrOneBooleanContent)
Renato Golin [Tue, 22 Aug 2017 11:02:37 +0000 (11:02 +0000)]
[ARM] Call setBooleanContents(ZeroOrOneBooleanContent)

The ARM backend should call setBooleanContents so that it can
use known bits to make some optimizations.

Review: D35821

Patch by Joel Galenson <jgalenson@google.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311446 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SelectionDAG] Add getNode debug messages
Sjoerd Meijer [Tue, 22 Aug 2017 10:43:51 +0000 (10:43 +0000)]
[SelectionDAG] Add getNode debug messages

This adds debug messages to various functions that create new SDValue nodes.
This is e.g. useful to have during legalization, as otherwise it can prints
legalization info of nodes that did not appear in the dumps before.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311444 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64] Cleanup of HasFullFP16 argument. NFC.
Sjoerd Meijer [Tue, 22 Aug 2017 09:21:08 +0000 (09:21 +0000)]
[AArch64] Cleanup of HasFullFP16 argument. NFC.

This is a clean up of commit r311154; it's not necessary to pass HasFullFP16 as
an argument, instead just query the DAG.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311438 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix a typo in r311435.
Chandler Carruth [Tue, 22 Aug 2017 09:20:52 +0000 (09:20 +0000)]
Fix a typo in r311435.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311437 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse report_fatal_error for unsupported calling conventions
Alex Bradbury [Tue, 22 Aug 2017 09:11:41 +0000 (09:11 +0000)]
Use report_fatal_error for unsupported calling conventions

The calling convention can be specified by the user in IR. Failing to support
a particular calling convention isn't a programming error, and so relying on
llvm_unreachable to catch and report an unsupported calling convention is not
appropriate.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311435 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[lib/Analysis] - Mark personality functions as live.
George Rimar [Tue, 22 Aug 2017 08:50:56 +0000 (08:50 +0000)]
[lib/Analysis] - Mark personality functions as live.

This is PR33245.

Case I am fixing is next:
Imagine we have 2 BC files, one defines and uses personality routine,
second has only declaration and also uses it.

Previously algorithm computing dead symbols (llvm::computeDeadSymbols) did
not know about personality routines and leaved them dead even if function that
has routine was live.

As a result thinLTOInternalizeAndPromoteGUID() method changed binding for
such symbol to local. Later when LLD tried to link these objects it failed
because one object had undefined global symbol for routine and second
object contained local definition instead of global.

Patch set the live root flag on the corresponding FunctionSummary
for personality routines when we build the per-module summaries
during the compile step.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311432 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Prevent several calls to ISD::isConstantSplatVector from returning a narrower...
Craig Topper [Tue, 22 Aug 2017 05:40:17 +0000 (05:40 +0000)]
[X86] Prevent several calls to ISD::isConstantSplatVector from returning a narrower APInt than the original scalar type

ISD::isConstantSplatVector can shrink to the smallest splat width. But we don't check the size of the resulting APInt at all. This can cause us to misinterpret the results.

This patch just adds a flag to prevent the APInt from changing width.

Fixes PR34271.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311429 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoIntegrate manifest merging library into LLD.
Eric Beckmann [Tue, 22 Aug 2017 03:15:28 +0000 (03:15 +0000)]
Integrate manifest merging library into LLD.

Summary: Now that the llvm-mt manifest merging libraries are complete, we may use them to merge manifests instead of needing to shell out to mt.exe.

Subscribers: mgorny, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311424 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agodsymutil: don't copy compile units without children from PCM files
Adrian Prantl [Tue, 22 Aug 2017 01:10:48 +0000 (01:10 +0000)]
dsymutil: don't copy compile units without children from PCM files

rdar://problem/33830532

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311416 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMoving libFuzzer from LLVM to compiler-rt.
George Karpenkov [Mon, 21 Aug 2017 23:25:12 +0000 (23:25 +0000)]
Moving libFuzzer from LLVM to compiler-rt.

This change only removes libFuzzer tests and CMake machinery,
the source copy temporarily remains at the old location.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311405 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRe-apply "Introduce FuzzMutate library"
Justin Bogner [Mon, 21 Aug 2017 22:57:06 +0000 (22:57 +0000)]
Re-apply "Introduce FuzzMutate library"

Same as r311392 with some fixes for library dependencies. Thanks to
Chapuni for helping work those out!

Original commit message:

This introduces the FuzzMutate library, which provides structured
fuzzing for LLVM IR, as described in my EuroLLVM 2017 talk. Most of
the basic mutators to inject and delete IR are provided, with support
for most basic operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311402 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[RegAlloc] Make sure live-ranges reflect the state of the IR when removing them
Quentin Colombet [Mon, 21 Aug 2017 22:56:18 +0000 (22:56 +0000)]
[RegAlloc] Make sure live-ranges reflect the state of the IR when removing them

When removing a live-range we used to not touch them making debug
prints harder to read because the IR was not matching what the
live-ranges information was saying.

This only affects debug printing and allows to put stronger asserts in
the code (see r308906 for instance).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311401 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ValueTracking] Add assertions that the starting Depth in isKnownToBeAPowerOfTwo...
Craig Topper [Mon, 21 Aug 2017 22:56:12 +0000 (22:56 +0000)]
[ValueTracking] Add assertions that the starting Depth in isKnownToBeAPowerOfTwo and ComputeNumSignBitsImpl is not above MaxDepth

The function does an equality check later to terminate the recursion, but that won't work if its starts out too high. Similar assert already exists in computeKnownBits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311400 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] add udiv/urem tests with constant numerator; NFC
Sanjay Patel [Mon, 21 Aug 2017 22:40:02 +0000 (22:40 +0000)]
[InstCombine] add udiv/urem tests with constant numerator; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311396 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "Re-apply "Introduce FuzzMutate library""
Justin Bogner [Mon, 21 Aug 2017 22:28:47 +0000 (22:28 +0000)]
Revert "Re-apply "Introduce FuzzMutate library""

The dependencies for the new library seem to be misconfigured on some
linux configs:

  http://bb.pgr.jp/builders/llvm-i686-linux-RA/builds/5435/steps/build_all/logs/stdio

This reverts r311392.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311393 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRe-apply "Introduce FuzzMutate library"
Justin Bogner [Mon, 21 Aug 2017 22:25:04 +0000 (22:25 +0000)]
Re-apply "Introduce FuzzMutate library"

Redo r311356 with a fix to avoid std::uniform_int_distribution<bool>.
The bool specialization is undefined according to the standard, even
though libc++ seems to have it.

Original commit message:

This introduces the FuzzMutate library, which provides structured
fuzzing for LLVM IR, as described in my [EuroLLVM 2017 talk][1]. Most
of the basic mutators to inject and delete IR are provided, with
support for most basic operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311392 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] add more tests for udiv/urem narrowing; NFC
Sanjay Patel [Mon, 21 Aug 2017 21:57:52 +0000 (21:57 +0000)]
[InstCombine] add more tests for udiv/urem narrowing; NFC

We don't currently limit these folds with hasOneUse() or shouldChangeType().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311390 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64] Restore the test of conditional branch fusion
Evandro Menezes [Mon, 21 Aug 2017 21:57:43 +0000 (21:57 +0000)]
[AArch64] Restore the test of conditional branch fusion

Restore the functionality of this test that was broken by
https://reviews.llvm.org/rL306144.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311389 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoGlobalISel (AArch64): fix ABI at border between GPRs and SP.
Tim Northover [Mon, 21 Aug 2017 21:56:11 +0000 (21:56 +0000)]
GlobalISel (AArch64): fix ABI at border between GPRs and SP.

If a struct would end up half in GPRs and half on SP the ABI says it should
actually go entirely on the stack. We were getting this wrong in GlobalISel
before, causing compatibility issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311388 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[IR] AutoUpgrade ModuleFlagBehavior for PIC and PIE level
Steven Wu [Mon, 21 Aug 2017 21:49:13 +0000 (21:49 +0000)]
[IR] AutoUpgrade ModuleFlagBehavior for PIC and PIE level

Summary:
From r303590, ModuleFlagBehavior for PIC and PIE level is changed from
Error to Max. This will cause bitcode compatibility issue when linking
against a bitcode static archive built with old compiler.
Add an auto-ugprade path to upgrade the the ModuleFlagBehavior in the
old bitcode to match the new one so IRLinker can link them.

Reviewers: tejohnson, mehdi_amini, dexonsmith

Reviewed By: dexonsmith

Subscribers: hans, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311387 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Move the checks for pointer types in getMaskedTypeForICmpPair earlier...
Craig Topper [Mon, 21 Aug 2017 21:00:45 +0000 (21:00 +0000)]
[InstCombine] Move the checks for pointer types in getMaskedTypeForICmpPair earlier in the function

I don't think there's any reason to have them scattered about and on all 4 operands. We already have an early check that both compares must be the same type. And within a given compare the LHS and RHS must have the same type. Beyond that I don't think there's anyway this function returns anything valid for pointer types. So let's just return early and be done with it.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311383 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Support, Windows] Handle long paths with unix separators
Pirama Arumuga Nainar [Mon, 21 Aug 2017 20:49:44 +0000 (20:49 +0000)]
[Support, Windows] Handle long paths with unix separators

Summary:
The function widenPath() for Windows also normalizes long path names by
iterating over the path's components and calling append().  The
assumption during the iteration that separators are not returned by the
iterator doesn't hold because the iterators do return a separator when
the path has a drive name.  Handle this case by ignoring separators
during iteration.

Reviewers: rnk

Subscribers: danalbert, srhines

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311382 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "Reapply: [ADCE][Dominators] Teach ADCE to preserve dominators"
Sanjoy Das [Mon, 21 Aug 2017 20:39:18 +0000 (20:39 +0000)]
Revert "Reapply: [ADCE][Dominators] Teach ADCE to preserve dominators"

Summary: This partially reverts commit r311057 since it breaks ADCE.  See PR34258.

Reviewers: kuhar

Subscribers: mcrosier, david2050, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311381 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ORE] Remove Old Optimization Remark API
Sam Elliott [Mon, 21 Aug 2017 20:30:44 +0000 (20:30 +0000)]
[ORE] Remove Old Optimization Remark API

Summary: https://bugs.llvm.org/show_bug.cgi?id=33789

Reviewers: anemet

Reviewed By: anemet

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311380 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PDB] Serialize records into a stack-allocated buffer.
Zachary Turner [Mon, 21 Aug 2017 20:17:19 +0000 (20:17 +0000)]
[PDB] Serialize records into a stack-allocated buffer.

We were using a std::vector<> and resizing to MaxRecordLength,
which is ~64KB.  We would then do this repeatedly often many
times in a tight loop, which was causing measurable performance
impact when linking PDBs.

Patch by Alex Telishev
Differential Revision: https://reviews.llvm.org/D36940

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311375 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAlways compile libFuzzer with no coverage
George Karpenkov [Mon, 21 Aug 2017 20:12:58 +0000 (20:12 +0000)]
Always compile libFuzzer with no coverage

Do not compile libFuzzer itself with coverage, regardless of LLVM variables

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311374 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[lld/pdb] Speed up construction of publics & globals addr map.
Zachary Turner [Mon, 21 Aug 2017 20:08:40 +0000 (20:08 +0000)]
[lld/pdb] Speed up construction of publics & globals addr map.

computeAddrMap function calls std::stable_sort with a comparison
function that computes deserialized symbols every time its called.
In the result deserializeAs<PublicSym32> is called 20-30 times per
symbol. It's much faster to calculate it beforehand and pass a
pointer to it to the comparison function.

Patch by Alex Telishev
Differential Revision: https://reviews.llvm.org/D36941

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311373 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InlineCost] Add cl::opt to allow full inline cost to be computed for debugging purposes.
Haicheng Wu [Mon, 21 Aug 2017 20:00:09 +0000 (20:00 +0000)]
[InlineCost] Add cl::opt to allow full inline cost to be computed for debugging purposes.

Currently, the inline cost model will bail once the inline cost exceeds the
inline threshold in order to avoid unnecessary compile-time. However, when
debugging it is useful to compute the full cost, so this command line option
is added to override the default behavior.

I took over this work from Chad Rosier (mcrosier@codeaurora.org).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311371 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InlineCost] Add more debug during inline cost computation.
Chad Rosier [Mon, 21 Aug 2017 19:56:46 +0000 (19:56 +0000)]
[InlineCost] Add more debug during inline cost computation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311370 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[BinaryStream] Defaultify copy and move constructors.
Zachary Turner [Mon, 21 Aug 2017 19:46:46 +0000 (19:46 +0000)]
[BinaryStream] Defaultify copy and move constructors.

The various BinaryStream classes had explicit copy constructors
which resulted in deleted move constructors.  This was causing
the internal std::shared_ptr to get copied rather than moved
very frequently, since these classes are often used as return
values.

Patch by Alex Telishev
Differential Revision: https://reviews.llvm.org/D36942

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311368 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LibCallSimplifier] try harder to fold memcmp with constant arguments (2nd try)
Sanjay Patel [Mon, 21 Aug 2017 19:13:14 +0000 (19:13 +0000)]
[LibCallSimplifier] try harder to fold memcmp with constant arguments (2nd try)

The 1st try was reverted because it could inf-loop by creating a dead instruction.
Fixed that to not happen and added a test case to verify.

Original commit message:

Try to fold:
memcmp(X, C, ConstantLength) == 0 --> load X == *C

Without this change, we're unnecessarily checking the alignment of the constant data,
so we miss the transform in the first 2 tests in the patch.

I noted this shortcoming of LibCallSimpifier in one of the recent CGP memcmp expansion
patches. This doesn't help the example in:
https://bugs.llvm.org/show_bug.cgi?id=34032#c13
...directly, but it's worth short-circuiting more of these simple cases since we're
already trying to do that.

The benefit of transforming to load+cmp is that existing IR analysis/transforms may
further simplify that code. For example, if the load of the variable is common to
multiple memcmp calls, CSE can remove the duplicate instructions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311366 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Teach foldSelectICmpAnd to recognize a (icmp slt X, 0) and (icmp sgt...
Craig Topper [Mon, 21 Aug 2017 19:02:06 +0000 (19:02 +0000)]
[InstCombine] Teach foldSelectICmpAnd to recognize a (icmp slt X, 0) and (icmp sgt X, -1) as equivalent to an and with the sign bit of the truncated type

This is similar to what was already done in foldSelectICmpAndOr. Ultimately I'd like to see if we can call foldSelectICmpAnd from foldSelectIntoOp if we detect a power of 2 constant. This would allow us to remove foldSelectICmpAndOr entirely.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311362 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "Introduce FuzzMutate library"
Justin Bogner [Mon, 21 Aug 2017 17:57:12 +0000 (17:57 +0000)]
Revert "Introduce FuzzMutate library"

Looks like this fails to build with libstdc++.

This reverts r311356

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311358 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoIntroduce FuzzMutate library
Justin Bogner [Mon, 21 Aug 2017 17:44:36 +0000 (17:44 +0000)]
Introduce FuzzMutate library

This introduces the FuzzMutate library, which provides structured
fuzzing for LLVM IR, as described in my [EuroLLVM 2017 talk][1]. Most
of the basic mutators to inject and delete IR are provided, with
support for most basic operations.

I will follow up with the instruction selection fuzzer, which is
implemented in terms of this library.

[1]: http://llvm.org/devmtg/2017-03//2017/02/20/accepted-sessions.html#2

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311356 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PPC] Refine checks for emiting TOC restore nop and tail-call eligibility.
Sean Fertile [Mon, 21 Aug 2017 17:35:32 +0000 (17:35 +0000)]
[PPC] Refine checks for emiting TOC restore nop and tail-call eligibility.

For the medium and large code models we only need to check if a call crosses
dso-boundaries when considering tail-call elgibility.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311353 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMigrate WholeProgramDevirt to new Optimization Remark API
Sam Elliott [Mon, 21 Aug 2017 16:57:21 +0000 (16:57 +0000)]
Migrate WholeProgramDevirt to new Optimization Remark API

Summary:
This is an attempt to move WholeProgramDevirt to the new remark API.

https://bugs.llvm.org/show_bug.cgi?id=33793

Reviewers: anemet

Reviewed By: anemet

Subscribers: fhahn, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311352 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[APFloat] Fix IsInteger() for DoubleAPFloat.
Davide Italiano [Mon, 21 Aug 2017 16:51:54 +0000 (16:51 +0000)]
[APFloat] Fix IsInteger() for DoubleAPFloat.

Previously, we would just assert instead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311351 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] add tests for memcmp with constant; NFC
Sanjay Patel [Mon, 21 Aug 2017 16:47:12 +0000 (16:47 +0000)]
[InstCombine] add tests for memcmp with constant; NFC

This is the baseline (current) version of the tests that would
have been added with the transform in r311333 (reverted at
r311340 due to inf-looping).

Adding these now to aid in testing and minimize the patch if/when
it is reinstated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311350 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoEmit only A Single Opt Remark When Inlining
Sam Elliott [Mon, 21 Aug 2017 16:45:47 +0000 (16:45 +0000)]
Emit only A Single Opt Remark When Inlining

Summary:
This updates the Inliner to only add a single Optimization
Remark when Inlining, rather than an Analysis Remark and an
Optimization Remark.

Fixes https://bugs.llvm.org/show_bug.cgi?id=33786

Reviewers: anemet, davidxl, chandlerc

Reviewed By: anemet

Subscribers: haicheng, fhahn, mehdi_amini, dblaikie, llvm-commits, eraman

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311349 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Fix a weakness in canEvaluateZExtd around 'and' instructions
Craig Topper [Mon, 21 Aug 2017 16:04:11 +0000 (16:04 +0000)]
[InstCombine] Fix a weakness in canEvaluateZExtd around 'and' instructions

Summary:
If the bitsToClear from the LHS of an 'and' comes back non-zero, but all of those bits are known zero on the RHS, we can reset bitsToClear.

Without this, the 'or' in the modified test case blocks the transform because it has non-zero bits in its RHS in those bits.

Reviewers: spatel, majnemer, davide

Reviewed By: davide

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311343 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] When selecting sse_load_f32/f64 pattern, make sure there's only one use of...
Craig Topper [Mon, 21 Aug 2017 16:04:04 +0000 (16:04 +0000)]
[X86] When selecting sse_load_f32/f64 pattern, make sure there's only one use of every node all the way back to the root of the match

Summary: With masked operations, its possible for the operation node like fadd, fsub, etc. to be used by multiple different vselects. Since the pattern matching will start at the vselect, we need to make sure the operation node itself is only used once before we can fold a load. Otherwise we'll end up folding the same load into multiple instructions.

Reviewers: RKSimon, spatel, zvi, igorb

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311342 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert 311208, 311209
Xinliang David Li [Mon, 21 Aug 2017 16:00:38 +0000 (16:00 +0000)]
Revert 311208, 311209

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311341 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agorevert r311333: [LibCallSimplifier] try harder to fold memcmp with constant arguments
Sanjay Patel [Mon, 21 Aug 2017 15:16:25 +0000 (15:16 +0000)]
revert r311333: [LibCallSimplifier] try harder to fold memcmp with constant arguments

We're getting lots of compile-timeout bot failures like:
http://lab.llvm.org:8011/builders/clang-native-arm-lnt/builds/7119
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311340 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] add vector tests; NFC
Sanjay Patel [Mon, 21 Aug 2017 15:11:39 +0000 (15:11 +0000)]
[InstCombine] add vector tests; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311339 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-pdbutil] Add support for dumping detailed module stats.
Zachary Turner [Mon, 21 Aug 2017 14:53:25 +0000 (14:53 +0000)]
[llvm-pdbutil] Add support for dumping detailed module stats.

This adds support for dumping a summary of module symbols
and CodeView debug chunks.  This option prints a table for
each module of all of the symbols that occurred in the module
and the number of times it occurred and total byte size.  Then
at the end it prints the totals for the entire file.

Additionally, this patch adds the -jmc (just my code) option,
which suppresses modules which are from external libraries or
linker imports, so that you can focus only on the object files
and libraries that originate from your own source code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311338 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Mon, 21 Aug 2017 14:34:06 +0000 (14:34 +0000)]
[InstCombine] regenerate test checks; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311337 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LibCallSimplifier] try harder to fold memcmp with constant arguments
Sanjay Patel [Mon, 21 Aug 2017 13:55:49 +0000 (13:55 +0000)]
[LibCallSimplifier] try harder to fold memcmp with constant arguments

Try to fold:
memcmp(X, C, ConstantLength) == 0 --> load X == *C

Without this change, we're unnecessarily checking the alignment of the constant data,
so we miss the transform in the first 2 tests in the patch.

I noted this shortcoming of LibCallSimpifier in one of the recent CGP memcmp expansion
patches. This doesn't help the example in:
https://bugs.llvm.org/show_bug.cgi?id=34032#c13
...directly, but it's worth short-circuiting more of these simple cases since we're
already trying to do that.

The benefit of transforming to load+cmp is that existing IR analysis/transforms may
further simplify that code. For example, if the load of the variable is common to
multiple memcmp calls, CSE can remove the duplicate instructions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311333 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PowerPC] Check if the pre-increment PHI Node already exists
Stefan Pintilie [Mon, 21 Aug 2017 13:36:18 +0000 (13:36 +0000)]
[PowerPC] Check if the pre-increment PHI Node already exists

Preparations to use the per-increment are sometimes done in the target
independent pass Loop Strength Reduction. We try to detect them in the PowerPC
specific pass so that they are not done twice and so that we do not add PHIs
that are not required.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311332 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[GlobalISel][X86] Support G_BRCOND operation.
Igor Breger [Mon, 21 Aug 2017 10:51:54 +0000 (10:51 +0000)]
[GlobalISel][X86] Support G_BRCOND operation.

Summary: Support G_BRCOND operation. For now don't try to fold cmp/trunc instructions.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, llvm-commits, kristof.beyls

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311327 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AsmParser] Recommit: Hash is not a comment on some targets
Oliver Stannard [Mon, 21 Aug 2017 09:58:37 +0000 (09:58 +0000)]
[AsmParser] Recommit: Hash is not a comment on some targets

Re-committing after r311325 fixed an unintentional use of '#' comments in
clang.

The '#' token is not a comment for all targets (on ARM and AArch64 it marks an
immediate operand), so we shouldn't treat it as such.

Comments are already converted to AsmToken::EndOfStatement by
AsmLexer::LexLineComment, so this check was unnecessary.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311326 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[GlobalISel][X86] InstructionSelector, for now use fallback path for LOAD_STACK_GUARD...
Igor Breger [Mon, 21 Aug 2017 09:17:28 +0000 (09:17 +0000)]
[GlobalISel][X86] InstructionSelector, for now use fallback path for LOAD_STACK_GUARD and PHI nodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311323 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[GlobalISel][X86] LowerCall, for now don't handel ByValue function arguments.
Igor Breger [Mon, 21 Aug 2017 08:59:59 +0000 (08:59 +0000)]
[GlobalISel][X86] LowerCall, for now don't handel ByValue function arguments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311321 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InterLeaved] Adding lit test for future work interleaved load strid 3
Michael Zuckerman [Mon, 21 Aug 2017 08:56:39 +0000 (08:56 +0000)]
[InterLeaved] Adding lit test for future work interleaved load strid 3

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311320 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] Teach the "generic" x86 CPU to avoid patterns that are slow on
Chandler Carruth [Mon, 21 Aug 2017 08:45:22 +0000 (08:45 +0000)]
[x86] Teach the "generic" x86 CPU to avoid patterns that are slow on
widely used processors.

This occured to me when I saw that we were generating 'inc' and 'dec'
when for Haswell and newer we shouldn't. However, there were a few "X is
slow" things that we should probably just set.

I've avoided any of the "X is fast" features because most of those would
be pretty serious regressions on processors where X isn't actually fast.
The slow things are likely to be negligible costs on processors where
these aren't slow and a significant win when they are slow.

In retrospect this seems somewhat obvious. Not sure why we didn't do
this a long time ago.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311318 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] Handle more cases where we can re-use an atomic operation's flags
Chandler Carruth [Mon, 21 Aug 2017 08:45:19 +0000 (08:45 +0000)]
[x86] Handle more cases where we can re-use an atomic operation's flags
rather than doing a separate comparison.

This both saves an explicit comparision and avoids the use of `xadd`
which introduces register constraints and other challenges to the
generated code.

The motivating case is from atomic reference counts where `1` is the
sentinel rather than `0` for whatever reason. This can and should be
lowered efficiently on x86 by just using a different flag, however the
x86 code only handled the `0` case.

There remains some further opportunities here that are currently hidden
due to canonicalization. I've included test cases that show these and
FIXMEs. However, I don't at the moment have any production use cases and
they seem substantially harder to address.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311317 91177308-0d34-0410-b5e6-96231b3b80d8