OSDN Git Service

android-x86/external-llvm.git
7 years agoFix LLDB Android AArch64 GCC debug info build
Omair Javaid [Thu, 2 Feb 2017 01:17:49 +0000 (01:17 +0000)]
Fix LLDB Android AArch64 GCC debug info build

Committing after fixing suggested changes and tested release/debug builds on
x86_64-linux and arm/aarch64 builds.

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

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

7 years agoRe-submit r293820: Return Error instead of bool from mergeTypeStreams().
Rui Ueyama [Thu, 2 Feb 2017 00:47:10 +0000 (00:47 +0000)]
Re-submit r293820: Return Error instead of bool from mergeTypeStreams().

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

7 years ago[IPSCCP] Restore the old behaviour (pre r293799).
Davide Italiano [Thu, 2 Feb 2017 00:46:54 +0000 (00:46 +0000)]
[IPSCCP] Restore the old behaviour (pre r293799).

It's not clear the change I made a good idea, and it definitely needs
further discussion. Thanks to Eli for pointing out.

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

7 years agoX86: Produce @ABS8 symbol modifiers for absolute symbols in range [0,128).
Peter Collingbourne [Thu, 2 Feb 2017 00:32:03 +0000 (00:32 +0000)]
X86: Produce @ABS8 symbol modifiers for absolute symbols in range [0,128).

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

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

7 years agoInferAddressSpaces: clang-format some things
Matt Arsenault [Thu, 2 Feb 2017 00:28:25 +0000 (00:28 +0000)]
InferAddressSpaces: clang-format some things

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

7 years ago[dsymutil] Fix __LINKEDIT vmsize in dsymutil upgrade path
Steven Wu [Thu, 2 Feb 2017 00:00:13 +0000 (00:00 +0000)]
[dsymutil] Fix __LINKEDIT vmsize in dsymutil upgrade path

Summary:
dsymutil upgrade path can change the size of segment and it needs to update
the vmsize of the segment to reflect the size change.

rdar://problem/30290714

Reviewers: friss

Subscribers: llvm-commits

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

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

7 years agoRemove an assertion that doesn't hold when mixing -g and -gmlt through
Paul Robinson [Wed, 1 Feb 2017 23:51:56 +0000 (23:51 +0000)]
Remove an assertion that doesn't hold when mixing -g and -gmlt through
LTO.  Replace it with a related assertion, ensuring that abstract
variables appear only in abstract scopes.
Part of PR31437.

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

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

7 years agoRemove XFAIL for test/DebugInfo/Generic/gmlt_profiling.ll
Dehao Chen [Wed, 1 Feb 2017 23:28:55 +0000 (23:28 +0000)]
Remove XFAIL for test/DebugInfo/Generic/gmlt_profiling.ll

Summary: test/DebugInfo/Generic/gmlt_profiling.ll will also pass on darwin, so we should remove the XFAIL in the test.

Reviewers: dblaikie, aprantl

Reviewed By: dblaikie

Subscribers: llvm-commits

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

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

7 years ago[AMDGPU] Account workgroup size in LDS occupancy limits
Stanislav Mekhanoshin [Wed, 1 Feb 2017 22:59:50 +0000 (22:59 +0000)]
[AMDGPU] Account workgroup size in LDS occupancy limits

Functions matching LDS use to occupancy return results for a workgroup
of 64 workitems. The numbers has to be adjusted for bigger workgroups.
For example a workgroup of size 256 already occupies 4 waves just by
itself. Given that all numbers of LDS use in the compiler are per
workgroup, occupancy shall be multiplied by 4 in this case. Each 64
workitems still limited by the same number, but 4 subrgoups 64 workitems
each can afford 4 times more LDS to get the same occupancy.

In addition change initializes LDS size in the subtarget to a real value
for SI+ targets. This is required since LDS size is a variable in these
calculations.

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

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

7 years ago[AArch64] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Wed, 1 Feb 2017 22:56:06 +0000 (22:56 +0000)]
[AArch64] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

7 years agoChange debug-info-for-profiling from a TargetOption to a function attribute.
Dehao Chen [Wed, 1 Feb 2017 22:45:09 +0000 (22:45 +0000)]
Change debug-info-for-profiling from a TargetOption to a function attribute.

Summary: LTO requires the debug-info-for-profiling to be a function attribute.

Reviewers: echristo, mehdi_amini, dblaikie, probinson, aprantl

Reviewed By: mehdi_amini, dblaikie, aprantl

Subscribers: aprantl, probinson, ahatanak, llvm-commits, mehdi_amini

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

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

7 years ago[libFuzzer] Disable afl tests on non-posix systems.
Marcos Pividori [Wed, 1 Feb 2017 22:40:50 +0000 (22:40 +0000)]
[libFuzzer] Disable afl tests on non-posix systems.

AflDriver is not supported on non posix systems.

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

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

7 years ago[libFuzzer] Disable equivalence tests on non posix systems.
Marcos Pividori [Wed, 1 Feb 2017 22:40:45 +0000 (22:40 +0000)]
[libFuzzer] Disable equivalence tests on non posix systems.

We can not run this test until we implement shared memory on Windows.

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

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

7 years ago[libFuzzer] Isolate merge tests that require posix.
Marcos Pividori [Wed, 1 Feb 2017 22:40:40 +0000 (22:40 +0000)]
[libFuzzer] Isolate merge tests that require posix.

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

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

7 years ago[libFuzzer] Add features `windows` and `posix` for lit tests.
Marcos Pividori [Wed, 1 Feb 2017 22:40:34 +0000 (22:40 +0000)]
[libFuzzer] Add features `windows` and `posix` for lit tests.

Add 2 features: posix and windows.
Sometimes we want some specific tests only for posix and we use:
 REQUIRES: posix
Sometimes we want some specific tests only for windows and we use:
 REQUIRES: windows

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

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

7 years ago[libFuzzer] Accept different extensions.
Marcos Pividori [Wed, 1 Feb 2017 22:40:29 +0000 (22:40 +0000)]
[libFuzzer] Accept different extensions.

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

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

7 years ago[libFuzzer] Fix test because cmd prompt does not expand wildcard.
Marcos Pividori [Wed, 1 Feb 2017 22:39:55 +0000 (22:39 +0000)]
[libFuzzer] Fix test because cmd prompt does not expand wildcard.

Commands should expand the wildcards on Windows, the cmd prompt doesn't.
Because of that sancov was not finding the needed file.
To deal with this, we use ls and xargs from gnu win utils.

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

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

7 years agoRevert r293820: Return Error instead of bool from mergeTypeStreams().
Rui Ueyama [Wed, 1 Feb 2017 22:28:43 +0000 (22:28 +0000)]
Revert r293820: Return Error instead of bool from mergeTypeStreams().

It broke buildbots.

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

7 years ago[ValueTracking] remove a FIXME for something we don't want to do; NFC
Sanjay Patel [Wed, 1 Feb 2017 22:27:34 +0000 (22:27 +0000)]
[ValueTracking] remove a FIXME for something we don't want to do; NFC

The comment was added with:
https://reviews.llvm.org/rL293773
...but there would be a cost to implement this and possibly no payoff.

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

7 years agoReturn Error instead of bool from mergeTypeStreams().
Rui Ueyama [Wed, 1 Feb 2017 22:09:34 +0000 (22:09 +0000)]
Return Error instead of bool from mergeTypeStreams().

Previously, mergeTypeStreams returns only true or false, so it was
impossible to know the reason if it failed. This patch changes the
function signature so that it returns an Error object.

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

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

7 years agoRemove an assertion that doesn't hold when mixing -g and -gmlt through
Paul Robinson [Wed, 1 Feb 2017 21:54:50 +0000 (21:54 +0000)]
Remove an assertion that doesn't hold when mixing -g and -gmlt through
LTO.  Part of PR31437.

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

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

7 years agofix typos; NFC
Sanjay Patel [Wed, 1 Feb 2017 21:38:32 +0000 (21:38 +0000)]
fix typos; NFC

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

7 years ago[InstCombine] move folds for shift-shift pairs; NFCI
Sanjay Patel [Wed, 1 Feb 2017 21:31:34 +0000 (21:31 +0000)]
[InstCombine] move folds for shift-shift pairs; NFCI

Although this is 'no-functional-change-intended', I'm adding tests
for shl-shl and lshr-lshr pairs because there is no existing test
coverage for those folds.

It seems like we should be able to remove some code from foldShiftedShift()
at this point because we're handling those patterns on the general path.

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

7 years agoShut up another GCC warning about operator precedence. NFC.
Michael Kuperstein [Wed, 1 Feb 2017 21:06:33 +0000 (21:06 +0000)]
Shut up another GCC warning about operator precedence. NFC.

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

7 years agoAMDGPU: Allow clustering flat memory operations
Matt Arsenault [Wed, 1 Feb 2017 20:22:51 +0000 (20:22 +0000)]
AMDGPU: Allow clustering flat memory operations

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

7 years ago[JumpThread] No need to erase BB from LoopHeaders. NFC.
Jun Bum Lim [Wed, 1 Feb 2017 19:06:55 +0000 (19:06 +0000)]
[JumpThread] No need to erase BB from LoopHeaders. NFC.

Summary: No need to try to ease BB from LoopHeaders as we already know that BB is not in LoopHeaders.

Reviewers: hsung, majnemer, mcrosier, haicheng, rengolin

Reviewed By: rengolin

Subscribers: llvm-commits

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

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

7 years ago[SCCP] Make sure we get this case right without noinline.
Davide Italiano [Wed, 1 Feb 2017 19:03:46 +0000 (19:03 +0000)]
[SCCP] Make sure we get this case right without noinline.

Thanks to Hal for pointing out in the post-commit review of
r293727.

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

7 years ago[IPSCCP] Don't propagate return values of functions marked as noinline.
Davide Italiano [Wed, 1 Feb 2017 18:52:20 +0000 (18:52 +0000)]
[IPSCCP] Don't propagate return values of functions marked as noinline.

This tries to address what Hal defined (in the post-commit review of
r293727) a long-standing problem with noinline, where we end up
de facto inlining trivial functions e.g.

__attribute__((noinline)) int patatino(void) { return 5; }

because of return value propagation.

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

7 years ago[mips] Parse the 'bopt' and 'nobopt' directives in IAS.
Simon Dardis [Wed, 1 Feb 2017 18:50:24 +0000 (18:50 +0000)]
[mips] Parse the 'bopt' and 'nobopt' directives in IAS.

The GAS assembler supports the ".set bopt" directive but according
to the sources it doesn't do anything. It's supposed to optimize
branches by filling the delay slot of a branch with it's target.

This patch teaches the MIPS asm parser to accept both and warn in
the case of 'bopt' that the bopt directive is unsupported.

This resolves PR/31841.

Thanks to Sean Bruno for reporting the issue!

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

7 years ago[pdb] Add a new command for analyzing hash collisions.
Zachary Turner [Wed, 1 Feb 2017 18:30:22 +0000 (18:30 +0000)]
[pdb] Add a new command for analyzing hash collisions.

This introduces the `analyze` subcommand.  For now there is only
one option, to analyze hash collisions in the type streams.  In
the future, however, we could add many more things here, such
as performing size analyses, compacting, and statistics about
the type of records etc.

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

7 years ago[X86] Extend single-source shuffle cost test to test more arches. NFC.
Michael Kuperstein [Wed, 1 Feb 2017 18:09:47 +0000 (18:09 +0000)]
[X86] Extend single-source shuffle cost test to test more arches. NFC.

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

7 years ago[libFuzzer] Do not use llvm-objdump for disassembling a DSO.
Marcos Pividori [Wed, 1 Feb 2017 17:59:23 +0000 (17:59 +0000)]
[libFuzzer] Do not use llvm-objdump for disassembling a DSO.

When disassembling a DSO, for calls to functions from the PLT, llvm-objdump only
prints the offset from the PLT, like: <.plt+0x30>.

While objdump and dumpbin print the function name, like:
<__sanitizer_cov_trace_pc_guard@plt>

When analyzing the coverage in libFuzzer we dissasemble and look for the calls
to __sanitizer_cov_trace_pc_guard.

So, this fails when using llvm-objdump on a DSO.

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

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

7 years ago[libFuzzer] Properly check if we can use dumpbin.
Marcos Pividori [Wed, 1 Feb 2017 17:59:19 +0000 (17:59 +0000)]
[libFuzzer] Properly check if we can use dumpbin.

The flag "/sumary" is necessary, otherwise it returns a non-zero value.

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

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

7 years ago[ImplicitNullChecks] NFC Fix the implicit-null-checks.mir test
Sanjoy Das [Wed, 1 Feb 2017 17:50:40 +0000 (17:50 +0000)]
[ImplicitNullChecks] NFC Fix the implicit-null-checks.mir test

Summary:
Currently the test implicit-null-checks.mir crashes if we run llc with
-enable-implicit-null-checks -start-before implicit-null-checks
options. Change fixes the RET instruction causing the crash.

Patch by Serguei Katkov!

Reviewers: sanjoy, reames

Reviewed By: sanjoy

Subscribers: llvm-commits

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

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

7 years ago[LV] Move interleaved access helper functions to VectorUtils (NFC)
Matthew Simpson [Wed, 1 Feb 2017 17:45:46 +0000 (17:45 +0000)]
[LV] Move interleaved access helper functions to VectorUtils (NFC)

This patch moves some helper functions related to interleaved access
vectorization out of LoopVectorize.cpp and into VectorUtils.cpp. We would like
to use these functions in a follow-on patch that improves interleaved load and
store lowering in (ARM/AArch64)ISelLowering.cpp. One of the functions was
already duplicated there and has been removed.

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

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

7 years agoMake test case resilient to \ or / directory separators
David Blaikie [Wed, 1 Feb 2017 17:34:41 +0000 (17:34 +0000)]
Make test case resilient to \ or / directory separators

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

7 years agoAdd missing test cases from r293697/D29094
David Blaikie [Wed, 1 Feb 2017 17:15:24 +0000 (17:15 +0000)]
Add missing test cases from r293697/D29094

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

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

7 years ago[InstCombine] Allow InstCombine to merge adjacent guards
Sanjoy Das [Wed, 1 Feb 2017 16:34:55 +0000 (16:34 +0000)]
[InstCombine] Allow InstCombine to merge adjacent guards

Summary:
If there are two adjacent guards with different conditions, we can
remove one of them and include its condition into the condition of
another one. This patch allows InstCombine to merge them by the
following pattern:

    guard(a); guard(b) -> guard(a & b).

Reviewers: reames, apilipenko, igor-laevsky, anna, sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

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

7 years ago[X86][SSE] Remove unused argument. NFCI.
Simon Pilgrim [Wed, 1 Feb 2017 16:34:50 +0000 (16:34 +0000)]
[X86][SSE] Remove unused argument. NFCI.

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

7 years agoAMDGPU: Improve nsw/nuw/exact when promoting uniform i16 ops
Matt Arsenault [Wed, 1 Feb 2017 16:25:23 +0000 (16:25 +0000)]
AMDGPU: Improve nsw/nuw/exact when promoting uniform i16 ops

These were simply preserving the flags of the original operation,
which was too conservative in most cases and incorrect for mul.

nsw/nuw may be needed for some combines to cleanup messes when
intermediate sext_inregs are introduced later.

Tested valid combinations with alive.

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

7 years ago[ImplicitNullCheck] Extend canReorder scope
Sanjoy Das [Wed, 1 Feb 2017 16:04:21 +0000 (16:04 +0000)]
[ImplicitNullCheck] Extend canReorder scope

Summary:
This change allows a re-order of two intructions if their uses
are overlapped.

Patch by Serguei Katkov!

Reviewers: reames, sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

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

7 years ago[ValueTracking] avoid crashing from bad assumptions (PR31809)
Sanjay Patel [Wed, 1 Feb 2017 15:41:32 +0000 (15:41 +0000)]
[ValueTracking] avoid crashing from bad assumptions (PR31809)

A program may contain llvm.assume info that disagrees with other analysis.
This may be caused by UB in the program, so we must not crash because of that.

As noted in the code comments:
https://llvm.org/bugs/show_bug.cgi?id=31809
...we can do better, but this at least avoids the assert/crash in the bug report.

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

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

7 years ago[mips] Fix an initialization issue with MipsABIInfo in MipsTargetELFStreamer
Simon Dardis [Wed, 1 Feb 2017 15:39:23 +0000 (15:39 +0000)]
[mips] Fix an initialization issue with MipsABIInfo in MipsTargetELFStreamer

DebugInfoDWARFTests is the only user so far which initializes the
MCObjectStreamer without initializing the ASMParser. The MIPS backend
relies on the ASMParser to initialize the MipsABIInfo object and to
update the target streamer with it. This should turn the mips buildbots
green.

Reviewers: atanasyan, zoran.jovanovic

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

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

7 years ago[PowerPC] Fix sjlj pseduo instructions to use G8RC_NOX0 register class
Kit Barton [Wed, 1 Feb 2017 14:33:57 +0000 (14:33 +0000)]
[PowerPC] Fix sjlj pseduo instructions to use G8RC_NOX0 register class

The the following instructions:
  - LD/LWZ (expanded from sjLj pseudo-instructions)
  - LXVL/LXVLL vector loads
  - STXVL/STXVLL vector stores
all require G8RC_NO0X class registers for RA.

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

Committed for Lei Huang

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

7 years ago[X86][SSE] Merge SSE2 PINSRW lowering with SSE41 PINSRB/PINSRW lowering. NFCI.
Simon Pilgrim [Wed, 1 Feb 2017 13:32:19 +0000 (13:32 +0000)]
[X86][SSE] Merge SSE2 PINSRW lowering with SSE41 PINSRB/PINSRW lowering. NFCI.

These are identical apart from the extra SSE41 guard for PINSRB.

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

7 years ago [legalizetypes] Push fp16 -> fp32 extension node to worklist.
Florian Hahn [Wed, 1 Feb 2017 13:01:33 +0000 (13:01 +0000)]
 [legalizetypes] Push fp16 -> fp32 extension node to worklist.

Summary:
This way, the type legalization machinery will take care of registering
the result of this node properly.

This patches fixes all failing fp16 test cases  with expensive checks.
(CodeGen/ARM/fp16-promote.ll, CodeGen/ARM/fp16.ll, CodeGen/X86/cvt16.ll
CodeGen/X86/soft-fp.ll)

Reviewers: t.p.northover, baldrick, olista01, bogner, jmolloy, davidxl, ab, echristo, hfinkel

Reviewed By: hfinkel

Subscribers: mehdi_amini, hfinkel, davide, RKSimon, aemerson, llvm-commits

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

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

7 years ago[ARM] const cast fix for ARMAttributeParser test
Sam Parker [Wed, 1 Feb 2017 12:58:57 +0000 (12:58 +0000)]
[ARM] const cast fix for ARMAttributeParser test

GCC 4.8 produced a cast qualifier warning, so replaced with C++ style
const cast.

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

7 years ago[LoopPredication] Add a new line to debug output in LoopPredication pass
Artur Pilipenko [Wed, 1 Feb 2017 12:25:38 +0000 (12:25 +0000)]
[LoopPredication] Add a new line to debug output in LoopPredication pass

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

7 years ago[ARM] Enable Cortex-M23 and Cortex-M33 support.
Javed Absar [Wed, 1 Feb 2017 11:55:03 +0000 (11:55 +0000)]
[ARM] Enable Cortex-M23 and Cortex-M33 support.

Add both cores to the target parser and TableGen. Test that eabi
attributes are set correctly for both cores. Additionally, test the
absence and presence of MOVT in Cortex-M23 and Cortex-M33, respectively.

Committed on behalf of Sanne Wouda.
Reviewers : rengolin, olista01.

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

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

7 years ago[globalisel] Make the MatchAction hierarchy consistent with the matchers. NFC.
Daniel Sanders [Wed, 1 Feb 2017 10:53:10 +0000 (10:53 +0000)]
[globalisel] Make the MatchAction hierarchy consistent with the matchers. NFC.

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

Subscribers: dberris, llvm-commits, kristof.beyls

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

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

7 years ago[LoopUnroll] Use addClonedBlockToLoopInfo to add loop header to LI (NFC).
Florian Hahn [Wed, 1 Feb 2017 10:39:35 +0000 (10:39 +0000)]
[LoopUnroll] Use addClonedBlockToLoopInfo to add loop header to LI (NFC).

Summary:
I have a similar patch up for review already (D29173). If you prefer I
can squash them both together.

Also I think there more potential for code sharing between
LoopUnroll.cpp and LoopUnrollRuntime.cpp. Do you think patches for
that would be worthwhile?

Reviewers: mkuper, mzolotukhin

Reviewed By: mkuper, mzolotukhin

Subscribers: llvm-commits

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

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

7 years ago*MacroFusion.cpp: Suppress warnings to eliminate \param(s). [-Wdocumentation]
NAKAMURA Takumi [Wed, 1 Feb 2017 07:30:46 +0000 (07:30 +0000)]
*MacroFusion.cpp: Suppress warnings to eliminate \param(s). [-Wdocumentation]

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

7 years ago[X86] For AVX1/AVX2 isel, don't use FP move instructions for 128-bit loads/stores...
Craig Topper [Wed, 1 Feb 2017 07:17:16 +0000 (07:17 +0000)]
[X86] For AVX1/AVX2 isel, don't use FP move instructions for 128-bit loads/stores of integer types.

For SSE we use fp because of the smaller encoding, but that doesn't apply to AVX. So just do the natural thing so we don't have to explain why we aren't. We can't do this for 256-bit loads/stores since integer loads and stores aren't available in AVX1 so we need fallback patterns since the integer types are legal.

This doesn't affect any tests because execution domain fixing freely converts the instructions anyway. Honestly, we could probably rely on it for the SSE size optimization too.

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

7 years ago[AArch64] Add new target feature to fuse literal generation
Evandro Menezes [Wed, 1 Feb 2017 02:54:42 +0000 (02:54 +0000)]
[AArch64] Add new target feature to fuse literal generation

This feature enables the fusion of such operations on Cortex A57, as
recommended in its Software Optimisation Guide, sections 4.14 and 4.15.

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

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

7 years ago[AArch64] Add new subtarget feature to fuse AES crypto operations
Evandro Menezes [Wed, 1 Feb 2017 02:54:39 +0000 (02:54 +0000)]
[AArch64] Add new subtarget feature to fuse AES crypto operations

This feature enables the fusion of such operations on Cortex A57, as
recommended in its Software Optimisation Guide, section 4.13, and on Exynos
M1.

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

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

7 years ago[CodeGen] Move MacroFusion to the target
Evandro Menezes [Wed, 1 Feb 2017 02:54:34 +0000 (02:54 +0000)]
[CodeGen] Move MacroFusion to the target

This patch moves the class for scheduling adjacent instructions,
MacroFusion, to the target.

In AArch64, it also expands the fusion to all instructions pairs in a
scheduling block, beyond just among the predecessors of the branch at the
end.

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

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

7 years ago[ImplicitNullCheck] NFC isSuitableMemoryOp cleanup
Sanjoy Das [Wed, 1 Feb 2017 02:49:25 +0000 (02:49 +0000)]
[ImplicitNullCheck] NFC isSuitableMemoryOp cleanup

Summary:
isSuitableMemoryOp method is repsonsible for verification
that instruction is a candidate to use in implicit null check.
Additionally it checks that base register is not re-defined before.
In case base has been re-defined it just returns false and lookup
is continued while any suitable instruction will not succeed this check
as well. This results in redundant further operations.

So when we found that base register has been re-defined we just
stop.

Patch by Serguei Katkov!

Reviewers: reames, sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

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

7 years agoSanitizerCoverage: Support sanitizer guard section on darwin
Justin Bogner [Wed, 1 Feb 2017 02:38:39 +0000 (02:38 +0000)]
SanitizerCoverage: Support sanitizer guard section on darwin

MachO's sections need a segment as well as a section name, and the
section start and end symbols are spelled differently than on ELF.

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

7 years agoMCMacho: Allow __thread_ptr section after dwarf sections
Matthias Braun [Wed, 1 Feb 2017 01:31:36 +0000 (01:31 +0000)]
MCMacho: Allow __thread_ptr section after dwarf sections

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

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

7 years ago[Mips] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Wed, 1 Feb 2017 01:22:51 +0000 (01:22 +0000)]
[Mips] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

7 years agoFix regalloc assignment of overlapping registers
Stanislav Mekhanoshin [Wed, 1 Feb 2017 01:18:36 +0000 (01:18 +0000)]
Fix regalloc assignment of overlapping registers

SplitEditor::defFromParent() can create a register copy.
If register is a tuple of other registers and not all lanes are used
a copy will be done on a full tuple regardless. Later register unit
for an unused lane will be considered free and another overlapping
register tuple can be assigned to a different value even though first
register is live at that point. That is because interference only look at
liveness info, while full register copy clobbers all lanes, even unused.

This patch fixes copy to only cover used lanes.

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

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

7 years ago[IPSCCP] Teach how to not propagate return values of naked functions.
Davide Italiano [Wed, 1 Feb 2017 01:01:22 +0000 (01:01 +0000)]
[IPSCCP] Teach how to not propagate return values of naked functions.

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

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

7 years agoAMDGPU: Cleanup fmin/fmax legacy function
Matt Arsenault [Wed, 1 Feb 2017 00:42:40 +0000 (00:42 +0000)]
AMDGPU: Cleanup fmin/fmax legacy function

Use a more specific subtarget check and combine hasOneUse checks

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

7 years ago[XRay] Use std::errc::invalid_argument instead of std::errc::bad_message
Dean Michael Berris [Wed, 1 Feb 2017 00:22:20 +0000 (00:22 +0000)]
[XRay] Use std::errc::invalid_argument instead of std::errc::bad_message

This change should appease the mingw32 builds.

Follow-up to D29319.

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

7 years agoInferAddressSpaces: Handle select
Matt Arsenault [Wed, 1 Feb 2017 00:08:53 +0000 (00:08 +0000)]
InferAddressSpaces: Handle select

This fails to handle some cases where one of the inputs is
a constant to be fixed in a later commit.

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

7 years ago[libFuzzer] increase the default size for shmem
Kostya Serebryany [Wed, 1 Feb 2017 00:07:47 +0000 (00:07 +0000)]
[libFuzzer] increase the default size for shmem

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

7 years ago[XRay] Define the InstrumentationMap type
Dean Michael Berris [Wed, 1 Feb 2017 00:05:29 +0000 (00:05 +0000)]
[XRay] Define the InstrumentationMap type

Summary:
This change implements the instrumentation map loading library which can
understand both YAML-defined instrumentation maps, and ELF 64-bit object
files that have the XRay instrumentation map section. We break it out
into a library on its own to allow for other applications to deal with
the XRay instrumentation map defined in XRay-instrumented binaries.

This type provides both raw access to the logical representation of the
instrumentation map entries as well as higher level functions for
converting a function ID into a function address.

At this point we only support ELF64 binaries and YAML-defined XRay
instrumentation maps. Future changes should extend this to support
32-bit ELF binaries, as well as other binary formats (like MachO).

As part of this change we also migrate all uses of the extraction logic
that used to be defined in tools/llvm-xray/ to use this new type and
interface for loading from files. We also remove the flag from the
`llvm-xray` tool that required users to specify the type of the
instrumentation map file being provided to instead make the library
auto-detect the file type.

Reviewers: dblaikie

Subscribers: mgorny, varno, llvm-commits

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

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

7 years agoInferAddressSpaces: Remove dead declaration
Matt Arsenault [Tue, 31 Jan 2017 23:57:20 +0000 (23:57 +0000)]
InferAddressSpaces: Remove dead declaration

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

7 years agoInferAddressSpaces: Avoid double map lookup
Matt Arsenault [Tue, 31 Jan 2017 23:48:44 +0000 (23:48 +0000)]
InferAddressSpaces: Avoid double map lookup

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

7 years agoInferAddressSpaces: Fix broken casting of constants
Matt Arsenault [Tue, 31 Jan 2017 23:48:40 +0000 (23:48 +0000)]
InferAddressSpaces: Fix broken casting of constants

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

7 years agoAMDGPU: Fix warning
Matt Arsenault [Tue, 31 Jan 2017 23:48:37 +0000 (23:48 +0000)]
AMDGPU: Fix warning

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

7 years agoCodeGen: Allow small copyable blocks to "break" the CFG.
Kyle Butt [Tue, 31 Jan 2017 23:48:32 +0000 (23:48 +0000)]
CodeGen: Allow small copyable blocks to "break" the CFG.

When choosing the best successor for a block, ordinarily we would have preferred
a block that preserves the CFG unless there is a strong probability the other
direction. For small blocks that can be duplicated we now skip that requirement
as well, subject to some simple frequency calculations.

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

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

7 years agoMove more code to helper functions. NFC.
Rafael Espindola [Tue, 31 Jan 2017 23:26:32 +0000 (23:26 +0000)]
Move more code to helper functions. NFC.

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

7 years ago[NVPTX] Compute approx sqrt as 1/rsqrt(x) rather than x*rsqrt(x).
Justin Lebar [Tue, 31 Jan 2017 23:08:57 +0000 (23:08 +0000)]
[NVPTX] Compute approx sqrt as 1/rsqrt(x) rather than x*rsqrt(x).

x*rsqrt(x) returns NaN for x == 0, whereas 1/rsqrt(x) returns 0, as
desired.

Verified that the particular nvptx approximate instructions here do in
fact return 0 for x = 0.

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

7 years agoMove some code to a helper function. NFC.
Rafael Espindola [Tue, 31 Jan 2017 23:07:08 +0000 (23:07 +0000)]
Move some code to a helper function. NFC.

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

7 years agoShut up GCC warning about operator precedence. NFC.
Michael Kuperstein [Tue, 31 Jan 2017 22:48:45 +0000 (22:48 +0000)]
Shut up GCC warning about operator precedence. NFC.

Technically, this is actually changes the expression and the original
assert was "wrong", but since the conjunction is with true, it doesn't
matter in this case.

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

7 years agoNewGVN: Dead argument cleanup
Daniel Berlin [Tue, 31 Jan 2017 22:32:03 +0000 (22:32 +0000)]
NewGVN: Dead argument cleanup

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

7 years agoNewGVN: Cleanup conditions to match reality
Daniel Berlin [Tue, 31 Jan 2017 22:32:01 +0000 (22:32 +0000)]
NewGVN: Cleanup conditions to match reality

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

7 years agoNewGVN: Add basic support for symbolic comparison evaluation
Daniel Berlin [Tue, 31 Jan 2017 22:31:58 +0000 (22:31 +0000)]
NewGVN: Add basic support for symbolic comparison evaluation

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

7 years agoNewGVN: Formatting cleanup after lookupOperandLeader change
Daniel Berlin [Tue, 31 Jan 2017 22:31:56 +0000 (22:31 +0000)]
NewGVN: Formatting cleanup after lookupOperandLeader change

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

7 years agoNewGVN: Remove the unsued two arguments from lookupOperandLeader.
Daniel Berlin [Tue, 31 Jan 2017 22:31:53 +0000 (22:31 +0000)]
NewGVN: Remove the unsued two arguments from lookupOperandLeader.

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

7 years agoNewGVN: Cleanup header files we are using.
Daniel Berlin [Tue, 31 Jan 2017 22:31:50 +0000 (22:31 +0000)]
NewGVN: Cleanup header files we are using.

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

7 years agoAdd a verbose/human readable mode to llvm-symbolizer to investigate discriminators...
David Blaikie [Tue, 31 Jan 2017 22:19:38 +0000 (22:19 +0000)]
Add a verbose/human readable mode to llvm-symbolizer to investigate discriminators and other line table/backtrace features

Patch by Simon Que!

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

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

7 years agoScopedHashTable lookup should be const
Daniel Berlin [Tue, 31 Jan 2017 22:01:08 +0000 (22:01 +0000)]
ScopedHashTable lookup should be const

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

7 years ago[NewGVN] Preserve TargetLibraryInfo analysis.
Davide Italiano [Tue, 31 Jan 2017 21:53:18 +0000 (21:53 +0000)]
[NewGVN] Preserve TargetLibraryInfo analysis.

We can maybe preserve more but this is a first step.
Ack'ed by Danny on IRC.

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

7 years ago[Utils] Update comment in vimrc
Dan Gohman [Tue, 31 Jan 2017 21:33:21 +0000 (21:33 +0000)]
[Utils] Update comment in vimrc

Fixed wrong paths in comments for *.vim files.

Patch By: Bruno Rosa (brunoalr)

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

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

7 years ago[Support] Add newline when dumping an APInt.
Davide Italiano [Tue, 31 Jan 2017 21:26:18 +0000 (21:26 +0000)]
[Support] Add newline when dumping an APInt.

This annoyed me a few times but was lazy so I haven't fixed it
until today, when the output of my debugger was too confusing.

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

7 years agoMake this file clang-format friendly and clang-format it.
Rafael Espindola [Tue, 31 Jan 2017 21:11:12 +0000 (21:11 +0000)]
Make this file clang-format friendly and clang-format it.

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

7 years agoDo not propagate DebugLoc across basic blocks
Taewook Oh [Tue, 31 Jan 2017 20:57:13 +0000 (20:57 +0000)]
Do not propagate DebugLoc across basic blocks

Summary:
DebugLoc shouldn't be propagated across basic blocks to prevent incorrect stepping and imprecise sample profile result. rL288903 addressed the wrong DebugLoc propagation issue by limiting the copy of DebugLoc when GVN removes a fully redundant load that is dominated by some other load. However, DebugLoc is still incorrectly propagated in the following example:

```
1:  extern int g;
2:
3:  void foo(int x, int y, int z) {
4:    if (x)
5:      g = 0;
6:    else
7:      g = 1;
8:
9:    int i = 0;
10:   for ( ; i < y ; i++)
11:     if (i > z)
12:       g++;
13: }

```
Below is LLVM IR representation of the program before GVN:

```
@g = external local_unnamed_addr global i32, align 4

; Function Attrs: nounwind uwtable
define void @foo(i32 %x, i32 %y, i32 %z) local_unnamed_addr #0 !dbg !4 {
entry:
  %not.tobool = icmp eq i32 %x, 0, !dbg !8
  %.sink = zext i1 %not.tobool to i32, !dbg !8
  store i32 %.sink, i32* @g, align 4, !tbaa !9
  %cmp8 = icmp sgt i32 %y, 0, !dbg !13
  br i1 %cmp8, label %for.body.preheader, label %for.end, !dbg !17

for.body.preheader:                               ; preds = %entry
  br label %for.body, !dbg !19

for.body:                                         ; preds = %for.body.preheader, %for.inc
  %i.09 = phi i32 [ %inc4, %for.inc ], [ 0, %for.body.preheader ]
  %cmp1 = icmp sgt i32 %i.09, %z, !dbg !19
  br i1 %cmp1, label %if.then2, label %for.inc, !dbg !21

if.then2:                                         ; preds = %for.body
  %0 = load i32, i32* @g, align 4, !dbg !22, !tbaa !9
  %inc = add nsw i32 %0, 1, !dbg !22
  store i32 %inc, i32* @g, align 4, !dbg !22, !tbaa !9
  br label %for.inc, !dbg !23

for.inc:                                          ; preds = %for.body, %if.then2
  %inc4 = add nuw nsw i32 %i.09, 1, !dbg !24
  %exitcond = icmp ne i32 %inc4, %y, !dbg !13
  br i1 %exitcond, label %for.body, label %for.end.loopexit, !dbg !17

for.end.loopexit:                                 ; preds = %for.inc
  br label %for.end, !dbg !26

for.end:                                          ; preds = %for.end.loopexit, %entry
  ret void, !dbg !26
}

```
where

```
!21 = !DILocation(line: 11, column: 9, scope: !15)
!22 = !DILocation(line: 12, column: 8, scope: !20)
!23 = !DILocation(line: 12, column: 7, scope: !20)
!24 = !DILocation(line: 10, column: 20, scope: !25)
```

And below is after GVN:

```
@g = external local_unnamed_addr global i32, align 4

define void @foo(i32 %x, i32 %y, i32 %z) local_unnamed_addr !dbg !4 {
entry:
  %not.tobool = icmp eq i32 %x, 0, !dbg !8
  %.sink = zext i1 %not.tobool to i32, !dbg !8
  store i32 %.sink, i32* @g, align 4, !tbaa !9
  %cmp8 = icmp sgt i32 %y, 0, !dbg !13
  br i1 %cmp8, label %for.body.preheader, label %for.end, !dbg !17

for.body.preheader:                               ; preds = %entry
  br label %for.body, !dbg !19

for.body:                                         ; preds = %for.inc, %for.body.preheader
  %0 = phi i32 [ %1, %for.inc ], [ %.sink, %for.body.preheader ], !dbg !21
  %i.09 = phi i32 [ %inc4, %for.inc ], [ 0, %for.body.preheader ]
  %cmp1 = icmp sgt i32 %i.09, %z, !dbg !19
  br i1 %cmp1, label %if.then2, label %for.inc, !dbg !22

if.then2:                                         ; preds = %for.body
  %inc = add nsw i32 %0, 1, !dbg !21
  store i32 %inc, i32* @g, align 4, !dbg !21, !tbaa !9
  br label %for.inc, !dbg !23

for.inc:                                          ; preds = %if.then2, %for.body
  %1 = phi i32 [ %inc, %if.then2 ], [ %0, %for.body ]
  %inc4 = add nuw nsw i32 %i.09, 1, !dbg !24
  %exitcond = icmp ne i32 %inc4, %y, !dbg !13
  br i1 %exitcond, label %for.body, label %for.end.loopexit, !dbg !17

for.end.loopexit:                                 ; preds = %for.inc
  br label %for.end, !dbg !26

for.end:                                          ; preds = %for.end.loopexit, %entry
  ret void, !dbg !26
}

```
As you see, GVN removes the load in if.then2 block and creates a phi instruction in for.body for it. The problem is that DebugLoc of remove load instruction is propagated to the newly created phi instruction, which is wrong. rL288903 cannot handle this case because ValuesPerBlock.size() is not 1 in this example when the load is removed.

Reviewers: aprantl, andreadb, wolfgangp

Reviewed By: andreadb

Subscribers: davide, llvm-commits

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

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

7 years agoFix VectorUtils include guard name (NFC)
Matthew Simpson [Tue, 31 Jan 2017 20:29:10 +0000 (20:29 +0000)]
Fix VectorUtils include guard name (NFC)

VectorUtils was moved to Analysis from Transforms/Utils, but some comments and
the include guard name still reflect its old location.

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

7 years agoGlobalISel: the translation of an invoke must branch to the good block.
Tim Northover [Tue, 31 Jan 2017 20:12:18 +0000 (20:12 +0000)]
GlobalISel: the translation of an invoke must branch to the good block.

Otherwise bad things happen if the basic block order isn't trivial after an
invoke.

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

7 years agoInterleaveAccessPass: Avoid constructing invalid shuffle masks
Matthias Braun [Tue, 31 Jan 2017 18:37:53 +0000 (18:37 +0000)]
InterleaveAccessPass: Avoid constructing invalid shuffle masks

Fix a bug where we would construct shufflevector instructions addressing
invalid elements.

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

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

7 years agoGlobalISel: merge invoke and call translation paths.
Tim Northover [Tue, 31 Jan 2017 18:36:11 +0000 (18:36 +0000)]
GlobalISel: merge invoke and call translation paths.

Well, sort of. But the lower-level code that invoke used to be using completely
botched the handling of varargs functions, which hopefully won't be possible if
they're using the same code.

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

7 years agoMC: Introduce the ABS8 symbol modifier.
Peter Collingbourne [Tue, 31 Jan 2017 18:28:44 +0000 (18:28 +0000)]
MC: Introduce the ABS8 symbol modifier.

@ABS8 can be applied to symbols which appear as immediate operands to
instructions that have a 8-bit immediate form for that operand. It causes
the assembler to use the 8-bit form and an 8-bit relocation (e.g. R_386_8
or R_X86_64_8) for the symbol.

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

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

7 years ago[X86][XOP] Add test showing failure to combine build vector to vpermil2ps shuffle
Simon Pilgrim [Tue, 31 Jan 2017 18:10:34 +0000 (18:10 +0000)]
[X86][XOP] Add test showing failure to combine build vector to vpermil2ps shuffle

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

7 years agoFix a bug in llvm-obdump(1) with the -macho flag disassembling an object
Kevin Enderby [Tue, 31 Jan 2017 18:09:10 +0000 (18:09 +0000)]
Fix a bug in llvm-obdump(1) with the -macho flag disassembling an object
without symbols that makes calls through a symbol stub which were not
correctly being annotated with “## symbol stub for: _foo”.

Just adds the same parameters for getting the annotations from
DisAsm->getInstruction() and passing them to IP->printInst() from the
code above when boolean variable symbolTableWorked was true.

rdar://29791952

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

7 years ago[Instcombine] Combine consecutive identical fences
Davide Italiano [Tue, 31 Jan 2017 18:09:05 +0000 (18:09 +0000)]
[Instcombine] Combine consecutive identical fences

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

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

7 years agoDon't combine stores to a swifterror pointer operand to a different type
Arnold Schwaighofer [Tue, 31 Jan 2017 17:53:49 +0000 (17:53 +0000)]
Don't combine stores to a swifterror pointer operand to a different type

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

7 years agoExplicitly promote indirect calls before sample profile annotation.
Dehao Chen [Tue, 31 Jan 2017 17:49:37 +0000 (17:49 +0000)]
Explicitly promote indirect calls before sample profile annotation.

Summary: In iterative sample pgo where profile is collected from PGOed binary, we may see indirect call targets promoted and inlined in the profile. Before profile annotation, we need to make this happen in order to annotate correctly on IR. This patch explicitly promotes these indirect calls and inlines them before profile annotation.

Reviewers: xur, davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

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

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

7 years ago[InstCombine] add test for possible zext-phi transform; NFC
Sanjay Patel [Tue, 31 Jan 2017 17:43:00 +0000 (17:43 +0000)]
[InstCombine] add test for possible zext-phi transform; NFC

The datalayout doesn't include i1, so we don't do a potential shrink and sink transform.

Example based on discussion here:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/109631.html

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