]> granicus.if.org Git - llvm/log
llvm
7 years agoThe change to llvm-nm in r305733 added fields to the struct NMSymbol
Kevin Enderby [Tue, 20 Jun 2017 00:41:04 +0000 (00:41 +0000)]
The change to llvm-nm in r305733 added fields to the struct NMSymbol
that are not set on the main path.  This diff does a memset to 0 the structs
so this change is to hopefully fix the sanitizer-x86_64-linux-fast bot.

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

7 years agoAMDGPU: Fix scratch wave offset relative FI expansion
Matt Arsenault [Mon, 19 Jun 2017 23:47:21 +0000 (23:47 +0000)]
AMDGPU: Fix scratch wave offset relative FI expansion

The offset may not be an inline immediate, so this needs
to be materialized into a register. The post-RA run of
SIShrinkInstructions is able to fold it later if it can.

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

7 years ago[ExecutionEngine] Fix some Clang-tidy modernize-use-using and Include What You Use...
Eugene Zelenko [Mon, 19 Jun 2017 23:37:52 +0000 (23:37 +0000)]
[ExecutionEngine] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

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

7 years ago[AMDGPU] Add infer address spaces pass before SROA
Stanislav Mekhanoshin [Mon, 19 Jun 2017 23:17:36 +0000 (23:17 +0000)]
[AMDGPU] Add infer address spaces pass before SROA

It adds it for the target after inlining but before SROA where
we can get most out of it.

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

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

7 years ago[Target] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Mon, 19 Jun 2017 22:43:19 +0000 (22:43 +0000)]
[Target] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

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

7 years agoFix machine instruction in test case
Sanjoy Das [Mon, 19 Jun 2017 22:35:48 +0000 (22:35 +0000)]
Fix machine instruction in test case

The AMD64rm instruction used in the test case was incorrect.  Since
the first input register to AND64rm is tied to output register, they
must be the same.

Thanks for Jesper Antonsson for pointing this out!

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

7 years ago[IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
Eugene Zelenko [Mon, 19 Jun 2017 22:05:08 +0000 (22:05 +0000)]
[IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).

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

7 years agoMark LLVMTestingSupport as not installed in LLVMBuild.
Zachary Turner [Mon, 19 Jun 2017 22:01:50 +0000 (22:01 +0000)]
Mark LLVMTestingSupport as not installed in LLVMBuild.

This is causing downstream issues with llvm-config.

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

7 years agoTry to fix uninitialized read in unit test.
Zachary Turner [Mon, 19 Jun 2017 21:59:09 +0000 (21:59 +0000)]
Try to fix uninitialized read in unit test.

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

7 years ago[AArch64][Falkor] Fix MOVZ sched predicate to not assert on non-imm operands (e.g...
Geoff Berry [Mon, 19 Jun 2017 21:57:44 +0000 (21:57 +0000)]
[AArch64][Falkor] Fix MOVZ sched predicate to not assert on non-imm operands (e.g. blockaddress).

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

7 years ago[AArch64][Kryo] Add missing write latency for LDAXP, LDXP second destination.
Geoff Berry [Mon, 19 Jun 2017 21:57:42 +0000 (21:57 +0000)]
[AArch64][Kryo] Add missing write latency for LDAXP, LDXP second destination.

Fixes PR33491 and PR33512.

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

7 years ago[AArch64][Falkor] Refine load/store increment latencies.
Geoff Berry [Mon, 19 Jun 2017 21:56:21 +0000 (21:56 +0000)]
[AArch64][Falkor] Refine load/store increment latencies.

Also fix LDXP & LDAXP write latency to avoid similar assert as PR33491 and PR33512.

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

7 years agoFix typos
Matt Arsenault [Mon, 19 Jun 2017 21:54:25 +0000 (21:54 +0000)]
Fix typos

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

7 years agoAMDGPU: Cleanup CreateLiveInRegister
Matt Arsenault [Mon, 19 Jun 2017 21:52:45 +0000 (21:52 +0000)]
AMDGPU: Cleanup CreateLiveInRegister

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

7 years agoFix a FIXME in llvm-objdump for the -exports-trie option that was not adding
Kevin Enderby [Mon, 19 Jun 2017 21:23:07 +0000 (21:23 +0000)]
Fix a FIXME in llvm-objdump for the -exports-trie option that was not adding
in the base address.

Without this Mach-O files, like 64-bit executables, don’t have the correct
addresses printed for their exports.  As the default is to link at address
0x100000000 not zero.

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

7 years agoRevert r305598, "utils: Add a git-r utility for mapping svn revisions to git revision...
Peter Collingbourne [Mon, 19 Jun 2017 20:43:09 +0000 (20:43 +0000)]
Revert r305598, "utils: Add a git-r utility for mapping svn revisions to git revisions in the monorepo."

$ git revert `git r 305598`

We need to decide whether we want development tools to be written in
Go first.

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

7 years ago[BDCE] Add comments. NFC
Xin Tong [Mon, 19 Jun 2017 20:10:41 +0000 (20:10 +0000)]
[BDCE] Add comments. NFC

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

7 years ago [PATCH] [PGO] Fixed cast operation in emIntrinsicVisitor::instrumentOneMemIntrinsic.
Ana Pazos [Mon, 19 Jun 2017 20:04:33 +0000 (20:04 +0000)]
 [PATCH] [PGO] Fixed cast operation in  emIntrinsicVisitor::instrumentOneMemIntrinsic.

Reviewers: xur, efriedma, davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

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

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

7 years agoRevert r305382, it caused PR33513.
Nico Weber [Mon, 19 Jun 2017 19:48:59 +0000 (19:48 +0000)]
Revert r305382, it caused PR33513.

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

7 years ago[CGP, PowerPC] try to constant fold before creating loads for memcmp expansion
Sanjay Patel [Mon, 19 Jun 2017 19:48:35 +0000 (19:48 +0000)]
[CGP, PowerPC] try to constant fold before creating loads for memcmp expansion

This is the last step needed to avoid regressions for x86 before we flip the switch to allow
expansion of the smallest set of memcpy() via CGP. The DAG version checks for constant strings,
so we need to do that here too.

FWIW, the 2 constant test is not handled by LibCallSimplifier::optimizeMemCmp() because that
code is limited to 8-bit constant arrays. LibCallSimplifier will also fail to optimize some 1
constant tests because its alignment requirements are too strict (shouldn't require alignment
for a constant operand).

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

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

7 years agoChange llvm-nm for Mach-O files to use dyld info in some cases when printing symbols.
Kevin Enderby [Mon, 19 Jun 2017 19:38:22 +0000 (19:38 +0000)]
Change llvm-nm for Mach-O files to use dyld info in some cases when printing symbols.

In order to reduce swift binary sizes, Apple is now stripping swift symbols
from the nlist symbol table.  llvm-nm currently only looks at the nlist symbol
table and misses symbols that are present in dyld info.   This makes it hard to
know the set of symbols for a binary using just llvm-nm.  Unless you know to
run llvm-objdump -exports-trie that can output the exported symbols in the dyld
info from the export trie, which does so but in a different format.

Also moving forward the time may come a when a fully linked Mach-O file that
uses dyld will no longer have an nlist symbol table to avoid duplicating the
symbol information.

This change adds three flags to llvm-nm, -add-dyldinfo, -no-dyldinfo, and
-dyldinfo-only.

The first, -add-dyldinfo, has the same effect as when the new bit in the Mach-O
header, MH_NLIST_OUTOFSYNC_WITH_DYLDINFO, appears in a binary.  In that it
looks through the dyld info from the export trie and adds symbols to be printed
that are not already in its internal SymbolList variable.  The -no-dyldinfo
option turns this behavior off.

The -dyldinfo-only option only looks at the dyld information and recreates the
symbol table from the dyld info from the export trie and binding information.
As if it the Mach-O file had no nlist symbol table.

Also fixed a few bugs with Mach-O N_INDR symbols not correctly printing the
indirect name, or in the same format as the old nm-classic program.

rdar://32021551

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

7 years agoRemove convenient but probably not worthwhile macro for lambda workaround
David Blaikie [Mon, 19 Jun 2017 19:01:08 +0000 (19:01 +0000)]
Remove convenient but probably not worthwhile macro for lambda workaround

Cleanup from r305405

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

7 years agoHave writeCOFFWriter return Expected<unique_ptr>.
Eric Beckmann [Mon, 19 Jun 2017 18:49:05 +0000 (18:49 +0000)]
Have writeCOFFWriter return Expected<unique_ptr>.

Summary: Have writeCOFFWriter return Expected<unique_ptr> instead of requiring being passed an uninitialized unique_ptr.

Reviewers: zturner, ruiu

Subscribers: hiraditya, llvm-commits

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

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

7 years agoImprove profile-guided heuristics to use estimated trip count.
Taewook Oh [Mon, 19 Jun 2017 18:48:58 +0000 (18:48 +0000)]
Improve profile-guided heuristics to use estimated trip count.

Summary:
Existing heuristic uses the ratio between the function entry
frequency and the loop invocation frequency to find cold loops. However,
even if the loop executes frequently, if it has a small trip count per
each invocation, vectorization is not beneficial. On the other hand,
even if the loop invocation frequency is much smaller than the function
invocation frequency, if the trip count is high it is still beneficial
to vectorize the loop.

This patch uses estimated trip count computed from the profile metadata
as a primary metric to determine coldness of the loop. If the estimated
trip count cannot be computed, it falls back to the original heuristics.

Reviewers: Ayal, mssimpso, mkuper, danielcdh, wmi, tejohnson

Reviewed By: tejohnson

Subscribers: tejohnson, mzolotukhin, llvm-commits

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

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

7 years ago[InstCombine] Make sure AddReachableCodeToWorklist sets MadeIRChange
Bjorn Pettersson [Mon, 19 Jun 2017 18:00:27 +0000 (18:00 +0000)]
[InstCombine] Make sure AddReachableCodeToWorklist sets MadeIRChange

Summary:
Some optimizations in AddReachableCodeToWorklist did not update
the MadeIRChange state. This could happen both when removing
trivially dead instructions (DCE) and at constant folds.

It is essential that changes to the IR is reported correctly,
since for example InstCombinePass::run() will indicate that all
analyses are preserved otherwise.
And the CGPassManager determines if the CallGraph is up-to-date
based on status from InstructionCombiningPass::runOnFunction().

The new test case early_dce_clobbers_callgraph.ll is a reproducer
for some asserts that started to trigger after changes in the
inliner in r305245. With this patch the test case passes again.

Reviewers: sanjoy, craig.topper, dblaikie

Reviewed By: craig.topper

Subscribers: llvm-commits

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

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

7 years agoRevert r304824 "Fix PR23384 (part 3 of 3)"
Hans Wennborg [Mon, 19 Jun 2017 17:57:15 +0000 (17:57 +0000)]
Revert r304824 "Fix PR23384 (part 3 of 3)"

This seems to be interacting badly with ASan somehow, causing false reports of
heap-buffer overflows: PR33514.

> Summary:
> The patch makes instruction count the highest priority for
> LSR solution for X86 (previously registers had highest priority).
>
> Reviewers: qcolombet
>
> Differential Revision: http://reviews.llvm.org/D30562
>
> From: Evgeny Stupachenko <evstupac@gmail.com>

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

7 years ago[Dominators] Clean up typedefs in GenericDomTreeConstruction. NFC.
Jakub Kuderski [Mon, 19 Jun 2017 17:24:56 +0000 (17:24 +0000)]
[Dominators] Clean up typedefs in GenericDomTreeConstruction. NFC.

Summary: This patch cleans up GenericDomTreeConstruction by replacing typedefs with usings and replaces `typename GraphT::NodeRef` with `NodePtr` to make the file more readable.

Reviewers: sanjoy, dberlin, chandlerc

Reviewed By: dberlin

Subscribers: llvm-commits

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

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

7 years ago[PDB] Start emitting source file and line information
Reid Kleckner [Mon, 19 Jun 2017 17:21:45 +0000 (17:21 +0000)]
[PDB] Start emitting source file and line information

Summary:
This is a first step towards getting line info to show up in VS and
windbg. So far, only llvm-pdbutil can parse the PDBs that we produce.
cvdump doesn't like something about our file checksum tables. I'll have
to dig into that next.

This patch adds a new DebugSubsectionRecordBuilder which takes bytes
directly from some other producer, such as a linker, and sticks it into
the PDB. Line tables only need to be relocated. No data needs to be
rewritten.

File checksums and string tables, on the other hand, need to be re-done.

Reviewers: zturner, ruiu

Subscribers: llvm-commits, hiraditya

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

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

7 years ago[Dominators] Clean up GenericDomTree.h. NFC.
Jakub Kuderski [Mon, 19 Jun 2017 16:59:20 +0000 (16:59 +0000)]
[Dominators] Clean up GenericDomTree.h. NFC.

Summary:
This patch cleans up GenericDomTree.h by:

- removing unnecessary <NodeT> in DomTreeNodeBase
- removing unnecessary std::move on bools
- changing type of DFSNumIn/DFSNumOut from int to unsigned (since the members were used as unsigned anyway)

The changes don't affect behavior -- everything works as before.

Reviewers: sanjoy, dberlin, chandlerc

Reviewed By: dberlin

Subscribers: davide, llvm-commits

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

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

7 years ago[CodeView] Fix dumping of public symbol record flags
Reid Kleckner [Mon, 19 Jun 2017 16:54:51 +0000 (16:54 +0000)]
[CodeView] Fix dumping of public symbol record flags

I noticed nonsensical type information while dumping PDBs produced by
MSVC.

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

7 years ago[NewGVN] Simplify findConditionEquivalence(). NFCI.
Davide Italiano [Mon, 19 Jun 2017 16:46:15 +0000 (16:46 +0000)]
[NewGVN] Simplify findConditionEquivalence(). NFCI.

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

7 years agoRemove brackets, NFC.
Dinar Temirbulatov [Mon, 19 Jun 2017 16:44:07 +0000 (16:44 +0000)]
Remove brackets, NFC.

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

7 years ago[InstCombine] Cleanup some duplicated one use checks
Craig Topper [Mon, 19 Jun 2017 16:23:49 +0000 (16:23 +0000)]
[InstCombine] Cleanup some duplicated one use checks

Summary:
These 4 patterns have the same one use check repeated twice for each. Once without a cast and one with. But the cast has no effect on what method is called.

For the OR case I believe it is always profitable regardless of the number of uses since we'll never increase the instruction count.

For the AND case I believe it is profitable if the pair of xors has one use such that we'll get rid of it completely. Or if the C value is something freely invertible, in which case the not doesn't cost anything.

Reviewers: spatel, majnemer

Reviewed By: spatel

Subscribers: llvm-commits

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

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

7 years ago[Reassociate] Support some reassociation of vector xors
Craig Topper [Mon, 19 Jun 2017 16:23:46 +0000 (16:23 +0000)]
[Reassociate] Support some reassociation of vector xors

Summary:
Currently we don't try to do anything with vector xors.

This patch adds support for removing duplicate pairs from a chain of vector xors as its pretty easy to support. We still dont' try to combine the xors with and/ors, but I might try that in a future patch.

Reviewers: mcrosier, davide, resistor

Reviewed By: mcrosier

Subscribers: llvm-commits

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

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

7 years ago[Reassociate] Make one of the helper methods static because it doesn't use any class...
Craig Topper [Mon, 19 Jun 2017 16:23:43 +0000 (16:23 +0000)]
[Reassociate] Make one of the helper methods static because it doesn't use any class variables. NFC

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

7 years ago[AMDGPU][mc][tests][NFC] Bulk ISA tests: Massive update. Add Gfx9 dasm tests.
Artem Tamazov [Mon, 19 Jun 2017 15:55:02 +0000 (15:55 +0000)]
[AMDGPU][mc][tests][NFC] Bulk ISA tests: Massive update. Add Gfx9 dasm tests.

A new Gfx9 dasm test added with approx 29000 cases.
Existing tests extended by (approx.):
* Gfx7 asm: 5000 test cases
* Gfx8 asm: 5000 test cases
* Gfx9 asm: 14400 test cases
* Gfx8 dasm: 5200 test cases

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

7 years agoAllow truncated and extend memory operations in Store Merge. NFCI.
Nirav Dave [Mon, 19 Jun 2017 15:32:28 +0000 (15:32 +0000)]
Allow truncated and extend memory operations in Store Merge. NFCI.

As all store merges checks are based on the memory operation
performed, allow use of truncated stores and extended loads as valid
input candidates for merging.

Relanding after fixing selection between truncated and normal store.

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

7 years ago[JumpThreading][LVI] Invalidate LVI information after blocks are merged
Anna Thomas [Mon, 19 Jun 2017 15:23:33 +0000 (15:23 +0000)]
[JumpThreading][LVI] Invalidate LVI information after blocks are merged

Summary:
After a single predecessor is merged into a basic block, we need to invalidate
the LVI information for the new merged block, when LVI is not provably true for
all of instructions in the new block.
The test cases added show the correct LVI information using the LVI printer
pass.

Reviewers: reames, dberlin, davide, sanjoy

Reviewed by: dberlin, davide

Subscribers: llvm-commits

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

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

7 years ago[TRE] Improve code motion in TRE, use AA to tell whether a load can be moved before...
Xin Tong [Mon, 19 Jun 2017 15:21:18 +0000 (15:21 +0000)]
[TRE] Improve code motion in TRE, use AA to tell whether a load can be moved before a call that writes to memory.

Summary: use AA to tell whether a load can be moved before a call that writes to memory.

Reviewers: dberlin, davide, sanjoy, hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, llvm-commits

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

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

7 years agoAdd test for store merge with noimplicitfloat
Nirav Dave [Mon, 19 Jun 2017 15:18:20 +0000 (15:18 +0000)]
Add test for store merge with noimplicitfloat

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

7 years ago[AArch64] Fix order of checks in shouldScheduleAdjacent.
Florian Hahn [Mon, 19 Jun 2017 13:45:41 +0000 (13:45 +0000)]
[AArch64] Fix order of checks in shouldScheduleAdjacent.

We need to check the opcode of FirstMI before accessing the operands. This
caused a buildbot failure during bootstrapping on AArch64.

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

7 years agoUse range for loops. NFCI.
Simon Pilgrim [Mon, 19 Jun 2017 13:24:12 +0000 (13:24 +0000)]
Use range for loops. NFCI.

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

7 years agoAMDGPU/GlobalISel: Mark G_BITCAST s32 <--> <2 x s16> legal
Tom Stellard [Mon, 19 Jun 2017 13:15:45 +0000 (13:15 +0000)]
AMDGPU/GlobalISel: Mark G_BITCAST s32 <--> <2 x s16> legal

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, igorb, dstuttard, tpr, t-tye, llvm-commits

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

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

7 years ago[GlobalISel][X86] Fold FI/G_GEP into LDR/STR instruction addressing mode.
Igor Breger [Mon, 19 Jun 2017 13:12:57 +0000 (13:12 +0000)]
[GlobalISel][X86] Fold FI/G_GEP into LDR/STR instruction addressing mode.

Summary: Implement some of the simplest addressing modes.It should help to test ABI.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, llvm-commits, kristof.beyls

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

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

7 years agoRecommit rL305677: [CodeGen] Add generic MacroFusion pass
Florian Hahn [Mon, 19 Jun 2017 12:53:31 +0000 (12:53 +0000)]
Recommit rL305677: [CodeGen] Add generic MacroFusion pass

Use llvm::make_unique to avoid ambiguity with MSVC.

This patch adds a generic MacroFusion pass, that is used on X86 and
AArch64, which both define target-specific shouldScheduleAdjacent
functions. This generic pass should make it easier for other targets to
implement macro fusion and I intend to add macro fusion for ARM shortly.

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

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

7 years ago[ARM] GlobalISel: Support G_ICMP for s8 and s16
Diana Picus [Mon, 19 Jun 2017 11:47:28 +0000 (11:47 +0000)]
[ARM] GlobalISel: Support G_ICMP for s8 and s16

Widen to s32 (like all other binary ops).

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

7 years agoRevert r305677 [CodeGen] Add generic MacroFusion pass.
Florian Hahn [Mon, 19 Jun 2017 11:26:15 +0000 (11:26 +0000)]
Revert r305677 [CodeGen] Add generic MacroFusion pass.

This causes Windows buildbot failures do an ambiguous call.

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

7 years ago[CodeGen] Add generic MacroFusion pass.
Florian Hahn [Mon, 19 Jun 2017 10:51:38 +0000 (10:51 +0000)]
[CodeGen] Add generic MacroFusion pass.

Summary:
This patch adds a generic MacroFusion pass, that is used on X86 and
AArch64, which both define target-specific shouldScheduleAdjacent
functions. This generic pass should make it easier for other targets to
implement macro fusion and I intend to add macro fusion for ARM shortly.

Reviewers: craig.topper, evandro, t.p.northover, atrick, MatzeB

Reviewed By: MatzeB

Subscribers: atrick, aemerson, mgorny, javed.absar, kristof.beyls, llvm-commits

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

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

7 years ago[ARM] GlobalISel: Support G_ICMP for i32 and pointers
Diana Picus [Mon, 19 Jun 2017 09:40:51 +0000 (09:40 +0000)]
[ARM] GlobalISel: Support G_ICMP for i32 and pointers

Add support throughout the pipeline:
- mark as legal for s32 and pointers
- map to GPRs
- lower to a sequence of instructions, which moves 0 or 1 into the
  result register based on the flags set by a CMPrr

We have copied from FastISel a helper function which maps CmpInst
predicates into ARMCC codes. Ideally, we should be able to move it
somewhere that both FastISel and GlobalISel can use.

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

7 years ago[X86] Simplify vector-shuffle-v48 test. NFC.
Guy Blank [Mon, 19 Jun 2017 08:58:13 +0000 (08:58 +0000)]
[X86] Simplify vector-shuffle-v48 test. NFC.

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

7 years ago[SCEV] Teach SCEVExpander to expand BinPow
Max Kazantsev [Mon, 19 Jun 2017 06:24:53 +0000 (06:24 +0000)]
[SCEV] Teach SCEVExpander to expand BinPow

Current implementation of SCEVExpander demonstrates a very naive behavior when
it deals with power calculation. For example, a SCEV for x^8 looks like

  (x * x * x * x * x * x * x * x)

If we try to expand it, it generates a very straightforward sequence of muls, like:

  x2 = mul x, x
  x3 = mul x2, x
  x4 = mul x3, x
      ...
  x8 = mul x7, x

This is a non-efficient way of doing that. A better way is to generate a sequence of
binary power calculation. In this case the expanded calculation will look like:

  x2 = mul x, x
  x4 = mul x2, x2
  x8 = mul x4, x4

In some cases the code size reduction for such SCEVs is dramatic. If we had a loop:

  x = a;
  for (int i = 0; i < 3; i++)
    x = x * x;

And this loop have been fully unrolled, we have something like:

  x = a;
  x2 = x * x;
  x4 = x2 * x2;
  x8 = x4 * x4;

The SCEV for x8 is the same as in example above, and if we for some reason
want to expand it, we will generate naively 7 multiplications instead of 3.
The BinPow expansion algorithm here allows to keep code size reasonable.

This patch teaches SCEV Expander to generate a sequence of BinPow multiplications
if we have repeating arguments in SCEVMulExpressions.

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

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

7 years ago[Doc] Fix getelementptr description about arguments
David Blaikie [Mon, 19 Jun 2017 05:34:21 +0000 (05:34 +0000)]
[Doc] Fix getelementptr description about arguments

Section "Arguments" of `getelementptr` [1] says the first argument is a
type, the second argument is a pointer or a vector of pointers, and is
the base address to start from. Update `getelementptr` FAQ [2]
accordingly, based on discussion with David on the mailing list [3].

[1] http://llvm.org/docs/LangRef.html#getelementptr-instruction
[2] http://llvm.org/docs/GetElementPtr.html
[3] http://lists.llvm.org/pipermail/llvm-dev/2017-June/114294.html

Patch by Wei-Ren Chen!

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

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

7 years agoNewGVN: Fix PR 33461, caused by slightly overzealous verification.
Daniel Berlin [Mon, 19 Jun 2017 00:24:00 +0000 (00:24 +0000)]
NewGVN: Fix PR 33461, caused by slightly overzealous verification.

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

7 years ago[x86] specify triples and auto-generate complete checks; NFC
Sanjay Patel [Sun, 18 Jun 2017 21:48:44 +0000 (21:48 +0000)]
[x86] specify triples and auto-generate complete checks; NFC

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

7 years ago[x86] specify triples and auto-generate complete checks; NFC
Sanjay Patel [Sun, 18 Jun 2017 21:42:19 +0000 (21:42 +0000)]
[x86] specify triples and auto-generate complete checks; NFC

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

7 years ago[x86] specify triple and auto-generate checks; NFC
Sanjay Patel [Sun, 18 Jun 2017 21:30:57 +0000 (21:30 +0000)]
[x86] specify triple and auto-generate checks; NFC

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

7 years agoDelete TypeDatabase.
Zachary Turner [Sun, 18 Jun 2017 20:52:45 +0000 (20:52 +0000)]
Delete TypeDatabase.

Merge the functionality into the random access type collection.
This class was only being used in 2 places, so getting rid of it
simplifies the code.

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

7 years ago[APFloat] Move the integerPartWidth constant into APFloatBase. Remove integerPart...
Craig Topper [Sun, 18 Jun 2017 18:15:41 +0000 (18:15 +0000)]
[APFloat] Move the integerPartWidth constant into APFloatBase. Remove integerPart typedef at file scope and just use the one in APFloatBase everywhere. NFC

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

7 years ago[Reassociate] Use APInt::isNullValue() instead of comparing with 0. NFC
Craig Topper [Sun, 18 Jun 2017 18:15:38 +0000 (18:15 +0000)]
[Reassociate] Use APInt::isNullValue() instead of comparing with 0. NFC

This should compile to slightly better code.

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

7 years agoImplement AllocateRWX and ReleaseRWX for NetBSD
Kamil Rytarowski [Sun, 18 Jun 2017 16:52:32 +0000 (16:52 +0000)]
Implement AllocateRWX and ReleaseRWX for NetBSD

Summary:
NetBSD ships with PaX MPROTECT disallowing RWX mappings.
There is a solution to bypass this restriction with double mapping
RX (code) and RW (data) using mremap(2) MAP_REMAPDUP.
The initial mapping must be mmap(2)ed with protection:
PROT_MPROTECT(PROT_EXEC).

This functionality to bypass PaX MPROTECT appeared in NetBSD-7.99.72.

This patch fixes 20 failing tests:
-    LLVM :: DebugInfo/debuglineinfo-macho.test
-    LLVM :: DebugInfo/debuglineinfo.test
-    LLVM :: ExecutionEngine/RuntimeDyld/Mips/ELF_Mips64r2N64_PIC_relocations.s
-    LLVM :: ExecutionEngine/RuntimeDyld/Mips/ELF_N32_relocations.s
-    LLVM :: ExecutionEngine/RuntimeDyld/Mips/ELF_N64R6_relocations.s
-    LLVM :: ExecutionEngine/RuntimeDyld/Mips/ELF_O32R6_relocations.s
-    LLVM :: ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s
-    LLVM :: ExecutionEngine/RuntimeDyld/X86/COFF_i386.s
-    LLVM :: ExecutionEngine/RuntimeDyld/X86/COFF_x86_64.s
-    LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF-relaxed.s
-    LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF_STT_FILE.s
-    LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF_x64-64_PC8_relocations.s
-    LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF_x64-64_PIC_relocations.s
-    LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF_x86-64_PIC-small-relocations.s
-    LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF_x86-64_debug_frame.s
-    LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF_x86_64_StubBuf.s
-    LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_empty_ehframe.s
-    LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_i386_DynNoPIC_relocations.s
-    LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_i386_eh_frame.s
-    LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, lhames

Reviewed By: joerg

Subscribers: sdardis, llvm-commits, arichardson

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

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

7 years agox86] adjust test constants to maintain coverage; NFC
Sanjay Patel [Sun, 18 Jun 2017 14:45:23 +0000 (14:45 +0000)]
x86] adjust test constants to maintain coverage; NFC

Increment (add 1) could be transformed to sub -1, and we'd lose coverage for these patterns.

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

7 years ago[x86] adjust test constants to maintain coverage; NFC
Sanjay Patel [Sun, 18 Jun 2017 14:23:47 +0000 (14:23 +0000)]
[x86] adjust test constants to maintain coverage; NFC

Increment (add 1) could be transformed to sub -1, and we'd lose coverage for these patterns.

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

7 years ago[x86] adjust test constants to maintain coverage; NFC
Sanjay Patel [Sun, 18 Jun 2017 14:01:32 +0000 (14:01 +0000)]
[x86] adjust test constants to maintain coverage; NFC

Increment (add 1) could be transformed to sub -1, and we'd lose coverage for these patterns.

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

7 years agoRevert r305642
Ismail Donmez [Sun, 18 Jun 2017 10:15:57 +0000 (10:15 +0000)]
Revert r305642

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

7 years agoTest to correct triple for SUSE on ARMv7
Ismail Donmez [Sun, 18 Jun 2017 10:00:59 +0000 (10:00 +0000)]
Test to correct triple for SUSE on ARMv7

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

7 years agoAdd argmononly attribute to strlen and wcslen, i.e. they only read memory (string...
Xin Tong [Sun, 18 Jun 2017 03:10:26 +0000 (03:10 +0000)]
Add argmononly attribute to strlen and wcslen, i.e. they only read memory (string) passed to them.

Summary:
This allows strlen to be moved out of the loop in case its argument is
not modified in the loop in LICM.

Reviewers: hfinkel, davide, sanjoy, dberlin

Subscribers: llvm-commits

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

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

7 years agoFixed the warning introduced by r305625 to make ubuntu-gcc7.1-werror bot green.
Galina Kistanova [Sat, 17 Jun 2017 21:05:28 +0000 (21:05 +0000)]
Fixed the warning introduced by r305625 to make ubuntu-gcc7.1-werror bot green.

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

7 years ago[SROA] Add support for non-integral pointers
Sanjoy Das [Sat, 17 Jun 2017 20:28:13 +0000 (20:28 +0000)]
[SROA] Add support for non-integral pointers

Summary: C.f. http://llvm.org/docs/LangRef.html#non-integral-pointer-type

Reviewers: chandlerc, loladiro

Reviewed By: loladiro

Subscribers: reames, loladiro, mcrosier, llvm-commits

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

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

7 years ago[TRE] Add assertion for folding trivial return block
Xin Tong [Sat, 17 Jun 2017 16:55:12 +0000 (16:55 +0000)]
[TRE] Add assertion for folding trivial return block

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

7 years ago[TRE] Update comments. NFC
Xin Tong [Sat, 17 Jun 2017 16:18:36 +0000 (16:18 +0000)]
[TRE] Update comments. NFC

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

7 years ago[CMake] Get rid of generating obj.*-tblgen if CMake >= 3.9 for Ninja generator.
NAKAMURA Takumi [Sat, 17 Jun 2017 13:45:55 +0000 (13:45 +0000)]
[CMake] Get rid of generating obj.*-tblgen if CMake >= 3.9 for Ninja generator.

CMake-3.9 doesn't let compilation units depend on their dependent libraries.

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

7 years ago[CMake] Introduce LLVM_TARGET_TRIPLE_ENV as an option to override LLVM_DEFAULT_TARGET...
NAKAMURA Takumi [Sat, 17 Jun 2017 03:19:08 +0000 (03:19 +0000)]
[CMake] Introduce LLVM_TARGET_TRIPLE_ENV as an option to override LLVM_DEFAULT_TARGET_TRIPLE at runtime.

No behavior is changed if LLVM_TARGET_TRIPLE_ENV is blank or undefined.

If LLVM_TARGET_TRIPLE_ENV is "TEST_TARGET_TRIPLE" and $TEST_TARGET_TRIPLE is not blank,
llvm::sys::getDefaultTargetTriple() returns $TEST_TARGET_TRIPLE.
Lit resets config.target_triple and config.environment[LLVM_TARGET_TRIPLE_ENV] to change the default target.

Without changing LLVM_DEFAULT_TARGET_TRIPLE nor rebuilding, lit can be run;

  TEST_TARGET_TRIPLE=i686-pc-win32 bin/llvm-lit -sv path/to/test/
  TEST_TARGET_TRIPLE=i686-pc-win32 ninja check-clang-tools

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

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

7 years agoRework logic and comment out the default relocation models for PPC.
Eric Christopher [Sat, 17 Jun 2017 02:25:56 +0000 (02:25 +0000)]
Rework logic and comment out the default relocation models for PPC.

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

7 years agoTurn a large if block into a smaller early return for clarity.
Eric Christopher [Sat, 17 Jun 2017 02:25:55 +0000 (02:25 +0000)]
Turn a large if block into a smaller early return for clarity.

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

7 years agoRemove the old and unused PPC32 and PPC64TargetMachine classes.
Eric Christopher [Sat, 17 Jun 2017 02:25:53 +0000 (02:25 +0000)]
Remove the old and unused PPC32 and PPC64TargetMachine classes.

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

7 years agoRemove unused forward declaration.
Eric Christopher [Sat, 17 Jun 2017 02:25:51 +0000 (02:25 +0000)]
Remove unused forward declaration.

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

7 years agoTidy up some calls to getRegister for readability.
Eric Christopher [Sat, 17 Jun 2017 02:25:49 +0000 (02:25 +0000)]
Tidy up some calls to getRegister for readability.

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

7 years agoRegScavenging: Add scavengeRegisterBackwards()
Matthias Braun [Sat, 17 Jun 2017 02:08:18 +0000 (02:08 +0000)]
RegScavenging: Add scavengeRegisterBackwards()

Re-apply r276044/r279124/r305516. Fixed a problem where we would refuse
to place spills as the very first instruciton of a basic block and thus
artifically increase pressure (test in
test/CodeGen/PowerPC/scavenging.mir:spill_at_begin)

This is a variant of scavengeRegister() that works for
enterBasicBlockEnd()/backward(). The benefit of the backward mode is
that it is not affected by incomplete kill flags.

This patch also changes
PrologEpilogInserter::doScavengeFrameVirtualRegs() to use the register
scavenger in backwards mode.

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

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

7 years ago[PPC] Remove isBarrier from CFENCE8's definition.
Tim Shen [Sat, 17 Jun 2017 01:25:34 +0000 (01:25 +0000)]
[PPC] Remove isBarrier from CFENCE8's definition.

Summary:
This is my misunderstanding on isBarrier. It's not for memory barriers,
but for other control flow purposes. lwsync doesn't have it either.

This fixes a simple crash with -verify-machineinstrs like below:

  define void @Foo() {
  entry:
    %tmp = load atomic i64, i64* undef acquire, align 8
    unreachable
  }

I deliberately don't want to check in the test, since there is little
chance to regress on such a mistake. Such a test adds noise to the code
base.

I plan to check in first, since it fixes a crash, and the fix is obvious.

Reviewers: kbarton, echristo

Subscribers: sanjoy, nemanjai, hiraditya, llvm-commits

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

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

7 years ago[SelectionDAG] Update Loop info after splitting critical edges.
Davide Italiano [Sat, 17 Jun 2017 00:56:27 +0000 (00:56 +0000)]
[SelectionDAG] Update Loop info after splitting critical edges.

The analysis is expected to be preserved by SelectionDAG.

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

7 years ago[InstCombine] Make FPMathOperator working with ConstantExpression(s).
Davide Italiano [Sat, 17 Jun 2017 00:07:22 +0000 (00:07 +0000)]
[InstCombine] Make FPMathOperator working with ConstantExpression(s).

Fixes PR33453.

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

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

7 years agoDon't crash if a type record can't be found.
Zachary Turner [Sat, 17 Jun 2017 00:02:24 +0000 (00:02 +0000)]
Don't crash if a type record can't be found.

This was a regression introduced in a previous patch.  Adding
back the code that handles this case.

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

7 years ago[WebAssembly] Use __stack_pointer global when writing wasm binary
Sam Clegg [Fri, 16 Jun 2017 23:59:10 +0000 (23:59 +0000)]
[WebAssembly] Use __stack_pointer global when writing wasm binary

This ensures that symbolic relocations are generated for stack
pointer manipulations.

These relocations are of type R_WEBASSEMBLY_GLOBAL_INDEX_LEB.
This change also adds support for reading relocations of this
type in WasmObjectFile.cpp.

Since its a globally imported symbol this does mean that
the get_global/set_global instruction won't be valid until
the objects are linked that global used in no longer an
imported global.

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

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

7 years ago[CodeView] Fix random access of type names.
Zachary Turner [Fri, 16 Jun 2017 23:42:44 +0000 (23:42 +0000)]
[CodeView] Fix random access of type names.

Suppose we had a type index offsets array with a boundary at type index
N. Then you request the name of the type with index N+1, and that name
requires the name of index N-1 (think a parameter list, for example). We
didn't handle this, and we would print something like (<unknown UDT>,
<unknown UDT>).

The fix for this is not entirely trivial, and speaks to a larger
problem. I think we need to kill TypeDatabase, or at the very least kill
TypeDatabaseVisitor. We need a thing that doesn't do any caching
whatsoever, just given a type index it can compute the type name "the
slow way". The reason for the bug is that we don't have anything like
that. Everything goes through the type database, and if we've visited a
record, then we're "done". It doesn't know how to do the expensive thing
of re-visiting dependent records if they've not yet been visited.

What I've done here is more or less copied the code (albeit greatly
simplified) from TypeDatabaseVisitor, but wrapped it in an interface
that just returns a std::string. The logic of caching the name is now in
LazyRandomTypeCollection. Eventually I'd like to move the record
database here as well and the visited record bitfield here as well, at
which point we can actually just delete TypeDatabase. I don't see any
reason for it if a "sequential" collection is just a special case of a
random access collection with an empty partial offsets array.

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

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

7 years agoRemove some dead code / includes.
Zachary Turner [Fri, 16 Jun 2017 23:42:15 +0000 (23:42 +0000)]
Remove some dead code / includes.

I'm trying to get rid of the TypeDatabase class, so the first
step is to minimize its footprint.

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

7 years agoobj2yaml: Improve error reporting
Sam Clegg [Fri, 16 Jun 2017 23:29:54 +0000 (23:29 +0000)]
obj2yaml: Improve error reporting

Previously only the error codes were reported which
meant that useful information about malformed inputs
was not shown.

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

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

7 years agobpf: fix a strict-aliasing issue
Yonghong Song [Fri, 16 Jun 2017 23:28:04 +0000 (23:28 +0000)]
bpf: fix a strict-aliasing issue

Davide Italiano reported the following issue if llvm
is compiled with gcc -Wstrict-aliasing -Werror:
.....
lib/Target/BPF/CMakeFiles/LLVMBPFCodeGen.dir/BPFISelDAGToDAG.cpp.o
../lib/Target/BPF/BPFISelDAGToDAG.cpp: In member function ‘virtual
void {anonymous}::BPFDAGToDAGISel::PreprocessISelDAG()’:
../lib/Target/BPF/BPFISelDAGToDAG.cpp:264:26: warning: dereferencing
type-punned pointer will break strict-aliasing rules
[-Wstrict-aliasing]
       val = *(uint16_t *)new_val;
.....

The error is caused by my previous commit (revision 305560).

This patch fixed the issue by introducing an union to avoid
type casting.

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

7 years ago[ConstantRange] Implement getSignedMin/Max in a less complicated and faster way
Craig Topper [Fri, 16 Jun 2017 23:26:23 +0000 (23:26 +0000)]
[ConstantRange] Implement getSignedMin/Max in a less complicated and faster way

Summary: As far as I can tell we should be able to implement these almost the same way we do unsigned, but using signed comparisons and checks for min signed value instead of min unsigned value.

Reviewers: pete, davide, sanjoy

Reviewed By: davide

Subscribers: llvm-commits

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

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

7 years ago[SelectionDAG] Use APInt::isSubsetOf. NFC
Craig Topper [Fri, 16 Jun 2017 23:19:14 +0000 (23:19 +0000)]
[SelectionDAG] Use APInt::isSubsetOf. NFC

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

7 years ago[SelectionDAG] Use APInt::isNullValue/isOneValue. NFC
Craig Topper [Fri, 16 Jun 2017 23:19:12 +0000 (23:19 +0000)]
[SelectionDAG] Use APInt::isNullValue/isOneValue. NFC

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

7 years ago[TargetLowering] Use ConstantSDNode::isOne and getSExtValue instead of getting the...
Craig Topper [Fri, 16 Jun 2017 23:19:10 +0000 (23:19 +0000)]
[TargetLowering] Use ConstantSDNode::isOne and getSExtValue instead of getting the underlying APInt first. NFC

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

7 years agoRevert rL305578. There is still some buildbot failure to be fixed.
Wei Mi [Fri, 16 Jun 2017 23:14:35 +0000 (23:14 +0000)]
Revert rL305578. There is still some buildbot failure to be fixed.

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

7 years agoMove testcase into the target-appropriate subdirectory.
Adrian Prantl [Fri, 16 Jun 2017 23:02:05 +0000 (23:02 +0000)]
Move testcase into the target-appropriate subdirectory.

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

7 years agoImprove the accuracy of variable ranges .debug_loc location lists.
Adrian Prantl [Fri, 16 Jun 2017 22:40:04 +0000 (22:40 +0000)]
Improve the accuracy of variable ranges .debug_loc location lists.

For the following motivating example
  bool c();
  void f();
  bool start() {
    bool result = c();
    if (!c()) {
      result = false;
      goto exit;
    }
    f();
    result = true;
  exit:
    return result;
  }

we would previously generate a single DW_AT_const_value(1) because
only the DBG_VALUE in the second-to-last basic block survived
codegen. This patch improves the heuristic used to determine when a
DBG_VALUE is available at the beginning of its variable's enclosing
lexical scope:

- Stop giving singular constants blanket permission to take over the
  entire scope. There is still a special case for constants in the
  function prologue that we also miight want to retire later.

- Use the lexical scope information to determine available-at-entry
  instead of proximity to the function prologue.

After this patch we generate a location list with a more accurate
narrower availability for the constant true value. As a pleasant side
effect, we also generate inline locations instead of location lists
where a loacation covers the entire range of the enclosing lexical
scope.

Measured on compiling llc with four targets this doesn't have an
effect on compile time and reduces the size of the debug info for llc
by ~600K.

rdar://problem/30286912

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

7 years agoutils: Add a git-r utility for mapping svn revisions to git revisions in the monorepo.
Peter Collingbourne [Fri, 16 Jun 2017 22:15:18 +0000 (22:15 +0000)]
utils: Add a git-r utility for mapping svn revisions to git revisions in the monorepo.

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

7 years ago[DWARF] Corrected behavior for when no .apple_names section is present in the object.
Spyridoula Gravani [Fri, 16 Jun 2017 22:03:21 +0000 (22:03 +0000)]
[DWARF] Corrected behavior for when no .apple_names section is present in the object.
The verifier should not output any message in such a case.
Added test case with no .apple_name section in the file to verify new functionality.
Made existing test case more specific.

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

7 years agoClean up some things in the WindowsResource changes.
Eric Beckmann [Fri, 16 Jun 2017 22:00:42 +0000 (22:00 +0000)]
Clean up some things in the WindowsResource changes.

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

7 years ago[Object] Remove redundant std::move.
Benjamin Kramer [Fri, 16 Jun 2017 21:27:12 +0000 (21:27 +0000)]
[Object] Remove redundant std::move.

Found by -Wpessimizing-move.

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

7 years agoSwitch external cvtres.exe for llvm's own resource library.
Eric Beckmann [Fri, 16 Jun 2017 21:13:24 +0000 (21:13 +0000)]
Switch external cvtres.exe for llvm's own resource library.

In this patch, I flip the switch in DriverUtils from using the external
cvtres.exe tool to using the Windows Resource library in llvm.

I also fixed a bug where .rsrc sections were marked as discardable
memory and therefore were placed in the wrong order in the final PE.

Furthermore, I modified WindowsResource to write the coff directly to a
memory buffer instead of to file, also had it use the machine types
already declared in COFF.h instead creating my own enum.

Finally, I flipped the switch to allow all unit tests that had
previously run only on windows due to a winres dependency to run
cross-platform.

Reviewers: zturner, ruiu

Subscribers: llvm-commits, hiraditya

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

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

7 years ago[InstCombine] Set correct insertion point for selects generated while folding phis
Anna Thomas [Fri, 16 Jun 2017 21:08:37 +0000 (21:08 +0000)]
[InstCombine] Set correct insertion point for selects generated while folding phis

Summary:
When we fold vector constants that are operands of phi's that feed into select,
we need to set the correct insertion point for the *new* selects that get generated.
The correct insertion point is the incoming block for the phi.
Such cases can occur with patch r298845, which fixed folding of
vector constants, but the new selects could be inserted incorrectly (as the added
test case shows).

Reviewers: majnemer, spatel, sanjoy

Reviewed by: spatel

Subscribers: llvm-commits

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

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