OSDN Git Service

android-x86/external-llvm.git
6 years agoAdd ‘llvm.experimental.constrained.fma‘ Intrinsic.
Wei Ding [Thu, 24 Aug 2017 04:18:24 +0000 (04:18 +0000)]
Add ‘llvm.experimental.constrained.fma‘ Intrinsic.

Differential Revision: http://reviews.llvm.org/D36335

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

6 years agoSupport all integer types in DiagnosticInfoOptimizationBase::Argument
Adam Nemet [Thu, 24 Aug 2017 04:04:49 +0000 (04:04 +0000)]
Support all integer types in  DiagnosticInfoOptimizationBase::Argument

We were missing size_t (unsigned long) on macOS.

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

6 years agoNewGVN: We weren't properly simplifying selects with equal arguments due to a thinko.
Daniel Berlin [Thu, 24 Aug 2017 02:43:17 +0000 (02:43 +0000)]
NewGVN: We weren't properly simplifying selects with equal arguments due to a thinko.

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

6 years agoFix bug 34051 by handling empty .res files gracefully.
Eric Beckmann [Thu, 24 Aug 2017 02:36:50 +0000 (02:36 +0000)]
Fix bug 34051 by handling empty .res files gracefully.

Summary:
Previously, llvm-cvtres crashes on .res files which are empty except for
the null header.  This allows the library to simply pass over them.

Subscribers: llvm-commits, hiraditya

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

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

6 years ago[DAG] Fix Node Replacement in PromoteIntBinOp
Hans Wennborg [Thu, 24 Aug 2017 01:08:27 +0000 (01:08 +0000)]
[DAG] Fix Node Replacement in PromoteIntBinOp

When one operand is a user of another in a promoted binary operation
we may replace and delete the returned value before returning
triggering an assertion. Reorder node replacements to prevent this.

Fixes PR34137.

Landing on behalf of Nirav.

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

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

6 years ago[AVR] Use the correct register classes for 16-bit atomic operations
Dylan McKay [Thu, 24 Aug 2017 00:14:38 +0000 (00:14 +0000)]
[AVR] Use the correct register classes for 16-bit atomic operations

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

6 years agoAdd test to cover accurate-sample-profile.
Dehao Chen [Wed, 23 Aug 2017 23:19:11 +0000 (23:19 +0000)]
Add test to cover accurate-sample-profile.

Summary: This patch adds test to cover the logic guarded by "accurate-sample-profile" flag.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: sanjoy, llvm-commits, eraman

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

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

6 years agoARM: use internal relocations for local symbols after all.
Tim Northover [Wed, 23 Aug 2017 22:07:10 +0000 (22:07 +0000)]
ARM: use internal relocations for local symbols after all.

Switching to external relocations for ARM-mode branches (to allow Thumb
interworking when the offset is unencodable) causes calls to temporary symbols
to be miscompiled and instead go to the parent externally visible symbol.

Calling a temporary never happens in compiled code, but can occasionally in
hand-written assembly.

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

6 years agoRetire the llvm.dbg.mir hack after r311594.
Adrian Prantl [Wed, 23 Aug 2017 22:02:36 +0000 (22:02 +0000)]
Retire the llvm.dbg.mir hack after r311594.

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

6 years agoFix Verifier test - add REQUIRES aarch64-registered-target
Aditya Nandakumar [Wed, 23 Aug 2017 21:55:36 +0000 (21:55 +0000)]
Fix Verifier test - add REQUIRES aarch64-registered-target

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

6 years agoAdd a Verifier check for DILocation's scopes.
Adrian Prantl [Wed, 23 Aug 2017 21:52:24 +0000 (21:52 +0000)]
Add a Verifier check for DILocation's scopes.

Found via https://bugs.llvm.org/show_bug.cgi?id=33997.

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

6 years ago[WebAssembly] Fix overflow for input with missing version
Jonas Devlieghere [Wed, 23 Aug 2017 21:36:04 +0000 (21:36 +0000)]
[WebAssembly] Fix overflow for input with missing version

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

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

6 years ago[PGO] Set edge weights for indirectbr instruction with profile counts
Rong Xu [Wed, 23 Aug 2017 21:36:02 +0000 (21:36 +0000)]
[PGO] Set edge weights for indirectbr instruction with profile counts

Current PGO only annotates the edge weight for branch and switch instructions
with profile counts. We should also annotate the indirectbr instruction as
all the information is there. This patch enables the annotating for indirectbr
instructions. Also uses this annotation in branch probability analysis.

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

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

6 years ago[AArch64][Falkor] Fix bug in Falkor HWPF tag collision avoidance
Geoff Berry [Wed, 23 Aug 2017 21:11:28 +0000 (21:11 +0000)]
[AArch64][Falkor] Fix bug in Falkor HWPF tag collision avoidance

LDPDi was incorrectly marked as ignoring the destination register in the
prefetcher tag.

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

6 years agoTest commit.
Pete Couperus [Wed, 23 Aug 2017 20:58:22 +0000 (20:58 +0000)]
Test commit.

Fix instrinsic -> intrinsic typo.

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

6 years ago[GISEl]: Translate phi into G_PHI
Aditya Nandakumar [Wed, 23 Aug 2017 20:45:48 +0000 (20:45 +0000)]
[GISEl]: Translate phi into G_PHI

G_PHI has the same semantics as PHI but also has types.
This lets us verify that the types in the G_PHI are consistent.
This also allows specifying legalization actions for G_PHIs.

https://reviews.llvm.org/D36990

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

6 years agoAttempt to fix the BUILD_SHARED_LIBS build after the DIExpression change
Reid Kleckner [Wed, 23 Aug 2017 20:39:35 +0000 (20:39 +0000)]
Attempt to fix the BUILD_SHARED_LIBS build after the DIExpression change

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

6 years agoParse and print DIExpressions inline to ease IR and MIR testing
Reid Kleckner [Wed, 23 Aug 2017 20:31:27 +0000 (20:31 +0000)]
Parse and print DIExpressions inline to ease IR and MIR testing

Summary:
Most DIExpressions are empty or very simple. When they are complex, they
tend to be unique, so checking them inline is reasonable.

This also avoids the need for CodeGen passes to append to the
llvm.dbg.mir named md node.

See also PR22780, for making DIExpression not be an MDNode.

Reviewers: aprantl, dexonsmith, dblaikie

Subscribers: qcolombet, javed.absar, eraman, hiraditya, llvm-commits

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

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

6 years agoUpdate branch coalescing to be a PowerPC specific pass
Lei Huang [Wed, 23 Aug 2017 19:25:04 +0000 (19:25 +0000)]
Update branch coalescing to be a PowerPC specific pass

Implementing this pass as a PowerPC specific pass.  Branch coalescing utilizes
the analyzeBranch method which currently does not include any implicit operands.
This is not an issue on PPC but must be handled on other targets.

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

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

6 years agoUpdated my email address.
Greg Clayton [Wed, 23 Aug 2017 18:00:07 +0000 (18:00 +0000)]
Updated my email address.

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

6 years ago[X86] Fix -Wenum-compare warning
Benjamin Kramer [Wed, 23 Aug 2017 17:50:46 +0000 (17:50 +0000)]
[X86] Fix -Wenum-compare warning

lib/Target/X86/X86ISelLowering.cpp:34613:25: error: enumeral mismatch in
conditional expression: 'llvm::ISD::NodeType' vs
'llvm::X86ISD::NodeType'

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

6 years ago[AVX512] Don't create SHRUNKBLEND SDNodes for 512-bit vectors
Craig Topper [Wed, 23 Aug 2017 16:41:02 +0000 (16:41 +0000)]
[AVX512] Don't create SHRUNKBLEND SDNodes for 512-bit vectors

There are no 512-bit blend instructions so we shouldn't create SHRUNKBLEND for them.

On a side note, it looks like there may be a missed opportunity for constant folding TESTM when LHS and RHS are equal.

This fixes PR34139.

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

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

6 years ago[X86] Remove X86ISD::FMADD in favor ISD::FMA
Craig Topper [Wed, 23 Aug 2017 16:28:04 +0000 (16:28 +0000)]
[X86] Remove X86ISD::FMADD in favor ISD::FMA

There's no reason to have a target specific node with the same semantics as a target independent opcode.

This should simplify D36335 so that it doesn't need to touch X86ISelDAGToDAG.cpp

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

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

6 years agobpf: close the file descriptor after probe inside getHostCPUNameForBPF
Yonghong Song [Wed, 23 Aug 2017 16:24:31 +0000 (16:24 +0000)]
bpf: close the file descriptor after probe inside getHostCPUNameForBPF

Signed-off-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311567 91177308-0d34-0410-b5e6-96231b3b80d8

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