]> granicus.if.org Git - llvm/log
llvm
7 years ago[InstCombine] Canonicalize clamp of float types to minmax in fast mode.
Nikolai Bozhenov [Wed, 28 Jun 2017 09:26:20 +0000 (09:26 +0000)]
[InstCombine] Canonicalize clamp of float types to minmax in fast mode.

Summary:
This commit allows matchSelectPattern to recognize clamp of float
arguments in the presence of FMF the same way as already done for
integers.

This case is a little different though. With integers, given the
min/max pattern is recognized, DAGBuilder starts selecting MIN/MAX
"automatically". That is not the case for float, because for them only
full FMINNAN/FMINNUM/FMAXNAN/FMAXNUM ISD nodes exist and they do care
about NaNs. On the other hand, some backends (e.g. X86) have only
FMIN/FMAX nodes that do not care about NaNS and the former NAN/NUM
nodes are illegal thus selection is not happening. So I decided to do
such kind of transformation in IR (InstCombiner) instead of
complicating the logic in the backend.

Reviewers: spatel, jmolloy, majnemer, efriedma, craig.topper

Reviewed By: efriedma

Subscribers: hiraditya, javed.absar, n.bozhenov, llvm-commits

Patch by Andrei Elovikov <andrei.elovikov@intel.com>

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

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

7 years agoAdd tests to document current InstCombine behavior for clamp pattern.
Nikolai Bozhenov [Wed, 28 Jun 2017 09:22:58 +0000 (09:22 +0000)]
Add tests to document current InstCombine behavior for clamp pattern.

Summary:
This commit adds the tests for clamp pattern as a prerequisite of
D33186 to make the impact of that fix more clear and also to document
current behavior.

Reviewers: spatel, jmolloy

Reviewed By: spatel

Subscribers: n.bozhenov, llvm-commits

Patch by Andrei Elovikov <andrei.elovikov@intel.com>

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

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

7 years ago[DebugInfo] - Removed trailing whitespaces. NFC.
George Rimar [Wed, 28 Jun 2017 08:26:57 +0000 (08:26 +0000)]
[DebugInfo] - Removed trailing whitespaces. NFC.

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

7 years agoRecommit "[ELF] - Add ability for DWARFContextInMemory to exit early when any error...
George Rimar [Wed, 28 Jun 2017 08:21:19 +0000 (08:21 +0000)]
Recommit "[ELF] - Add ability for DWARFContextInMemory to exit early when any error happen."

With fix in include folder character case:
#include "llvm/Codegen/AsmPrinter.h" -> #include "llvm/CodeGen/AsmPrinter.h"

Original commit message:

Change introduces error reporting policy for DWARFContextInMemory.
New callback provided by client is able to handle error on it's
side and return Halt or Continue.

That allows to either keep current behavior when parser prints all errors
but continues parsing object or implement something very different, like
stop parsing on a first error and report an error in a client style.

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

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

7 years ago[ARM] Make -mcpu=generic schedule for an in-order core (Cortex-A8).
Kristof Beyls [Wed, 28 Jun 2017 07:07:03 +0000 (07:07 +0000)]
[ARM] Make -mcpu=generic schedule for an in-order core (Cortex-A8).

The benchmarking summarized in
http://lists.llvm.org/pipermail/llvm-dev/2017-May/113525.html showed
this is beneficial for a wide range of cores.

As is to be expected, quite a few small adaptations are needed to the
regressions tests, as the difference in scheduling results in:
- Quite a few small instruction schedule differences.
- A few changes in register allocation decisions caused by different
 instruction schedules.
- A few changes in IfConversion decisions, due to a difference in
 instruction schedule and/or the estimated cost of a branch mispredict.

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

7 years agoRevert r306512 "[ELF] - Add ability for DWARFContextInMemory to exit early when any...
George Rimar [Wed, 28 Jun 2017 07:06:17 +0000 (07:06 +0000)]
Revert r306512 "[ELF] - Add ability for DWARFContextInMemory to exit early when any error happen."

It broke BB:

[13/106] 13 0.022 Generating VCSRevision.h
[25/106] 24 1.209 Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o
FAILED: unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o
/home/bb/bin/g++  -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_GLOBAL_ISEL -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iunittests/DebugInfo/DWARF -I../llvm-project/llvm/unittests/DebugInfo/DWARF -Iinclude -I../llvm-project/llvm/include -I../llvm-project/llvm/utils/unittest/googletest/include -I../llvm-project/llvm/utils/unittest/googlemock/include -fPIC -fvisibility-inlines-hidden -m32 -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O3    -UNDEBUG  -Wno-variadic-macros -fno-exceptions -fno-rtti -MD -MT unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o -MF unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o.d -o unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o -c ../llvm-project/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
../llvm-project/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp:18:37: fatal error: llvm/Codegen/AsmPrinter.h: No such file or directory
 #include "llvm/Codegen/AsmPrinter.h"
                                     ^
compilation terminated.

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

7 years ago[ELF] - Add ability for DWARFContextInMemory to exit early when any error happen.
George Rimar [Wed, 28 Jun 2017 06:57:20 +0000 (06:57 +0000)]
[ELF] - Add ability for DWARFContextInMemory to exit early when any error happen.

Change introduces error reporting policy for DWARFContextInMemory.
New callback provided by client is able to handle error on it's
side and return Halt or Continue.

That allows to either keep current behavior when parser prints all errors
but continues parsing object or implement something very different, like
stop parsing on a first error and report an error in a client style.

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

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

7 years ago[InstCombine] Add test case demonstrating that we don't handle icmp eq (trunc (lshr...
Craig Topper [Wed, 28 Jun 2017 06:45:36 +0000 (06:45 +0000)]
[InstCombine] Add test case demonstrating that we don't handle icmp eq (trunc (lshr(X, cst1)), cst->icmp (and X, mask), cst when the shift type is larger than 64-bits. NFC

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

7 years agoRevert r306508 "[InstCombine] Add test case demonstrating that we don't handle icmp...
Craig Topper [Wed, 28 Jun 2017 06:43:58 +0000 (06:43 +0000)]
Revert r306508 "[InstCombine] Add test case demonstrating that we don't handle icmp eq (trunc (lshr(X, cst1)), cst->icmp (and X, mask), cst when the shift type is larger than 64-bits. NFC"

I accidentally had a extra change in there.

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

7 years ago[InstCombine] Add test case demonstrating that we don't handle icmp eq (trunc (lshr...
Craig Topper [Wed, 28 Jun 2017 06:42:48 +0000 (06:42 +0000)]
[InstCombine] Add test case demonstrating that we don't handle icmp eq (trunc (lshr(X, cst1)), cst->icmp (and X, mask), cst when the shift type is larger than 64-bits. NFC

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

7 years agoAdd missing library dependency to fix build break in llvm-lto2
Hiroshi Inoue [Wed, 28 Jun 2017 06:14:30 +0000 (06:14 +0000)]
Add missing library dependency to fix build break in llvm-lto2

error message
CMakeFiles/llvm-lto2.dir/llvm-lto2.cpp.o: In function `dumpSymtab(int, char**)':
llvm-lto2.cpp:(.text._ZL10dumpSymtabiPPc+0x238): undefined reference to `llvm::getBitcodeFileContents(llvm::MemoryBufferRef)'
collect2: error: ld returned 1 exit status

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

7 years ago[IRCE][NFC] Better get SCEV for 1 in calculateSubRanges
Max Kazantsev [Wed, 28 Jun 2017 04:57:45 +0000 (04:57 +0000)]
[IRCE][NFC] Better get SCEV for 1 in calculateSubRanges

A slightly more efficient way to get constant, we avoid resolving in getSCEV and excessive
invocations, and we don't create a ConstantInt if 'true' branch is taken.

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

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

7 years agoRevert "[DAG] Fold FrameIndex offset into BaseIndexOffset analysis. NFCI."
Nirav Dave [Wed, 28 Jun 2017 03:20:04 +0000 (03:20 +0000)]
Revert "[DAG] Fold FrameIndex offset into BaseIndexOffset analysis. NFCI."

This reverts commit r306498 which appears to cause a compilrt-rt test failures

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

7 years ago[AMDGPU] Add pattern for v_alignbit_b32 with immediate
Stanislav Mekhanoshin [Wed, 28 Jun 2017 02:52:39 +0000 (02:52 +0000)]
[AMDGPU] Add pattern for v_alignbit_b32 with immediate

If immediate in shift is less than 32 we can use alignbit too.

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

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

7 years agoAllow to truncate left shift with non-constant shift amount
Stanislav Mekhanoshin [Wed, 28 Jun 2017 02:37:11 +0000 (02:37 +0000)]
Allow to truncate left shift with non-constant shift amount

That is pretty common for clang to produce code like
(shl %x, (and %amt, 31)). In this situation we can still perform
trunc (shl) into shl (trunc) conversion given the known value
range of shift amount.

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

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

7 years ago[DAG] Fold FrameIndex offset into BaseIndexOffset analysis. NFCI.
Nirav Dave [Wed, 28 Jun 2017 02:09:50 +0000 (02:09 +0000)]
[DAG] Fold FrameIndex offset into BaseIndexOffset analysis. NFCI.

Pull FrameIndex comparision reasoning from DAGCombiner::isAlias to
general BaseIndexOffset.

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

7 years agoInlining: Don't re-map simplified cloned instructions.
Kyle Butt [Wed, 28 Jun 2017 01:41:25 +0000 (01:41 +0000)]
Inlining: Don't re-map simplified cloned instructions.

When simplifying an instruction that has been re-mapped, it should never
simplify to an instruction in the original function. In the edge case
where we are inlining a function into itself, the existing code led to
incorrect behavior. Replace the incorrect code with an assert verifying
that we never expect simplification to produce an instruction in the old
function, unless the functions are the same.

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

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

7 years ago[TableGen] Improve Debug Output for --debug-only=subtarget-emitter NFCI
Joel Jones [Wed, 28 Jun 2017 00:06:40 +0000 (00:06 +0000)]
[TableGen] Improve Debug Output for --debug-only=subtarget-emitter NFCI

Add headers for each section of output, with white space and "+++" to
improve readability.

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

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

7 years agoAdd missing library dependency.
Peter Collingbourne [Wed, 28 Jun 2017 00:05:27 +0000 (00:05 +0000)]
Add missing library dependency.

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

7 years ago[COFF, ARM64] Add support for Windows ARM64 COFF format
Mandeep Singh Grang [Tue, 27 Jun 2017 23:58:19 +0000 (23:58 +0000)]
[COFF, ARM64] Add support for Windows ARM64 COFF format

Summary:
This is the llvm part of the initial implementation to support Windows ARM64 COFF format.
I will gradually add more functionality in subsequent patches.

Reviewers: ruiu, rnk, t.p.northover, compnerd

Reviewed By: ruiu, compnerd

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

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

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

7 years agoObject: Teach irsymtab::read() to try to use the irsymtab that we wrote to disk.
Peter Collingbourne [Tue, 27 Jun 2017 23:50:24 +0000 (23:50 +0000)]
Object: Teach irsymtab::read() to try to use the irsymtab that we wrote to disk.

Fixes PR27551.

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

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

7 years agoBitcode: Write the irsymtab to disk.
Peter Collingbourne [Tue, 27 Jun 2017 23:50:11 +0000 (23:50 +0000)]
Bitcode: Write the irsymtab to disk.

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

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

7 years agoObject: Add version and producer fields to the irsymtab header. NFCI.
Peter Collingbourne [Tue, 27 Jun 2017 23:49:58 +0000 (23:49 +0000)]
Object: Add version and producer fields to the irsymtab header. NFCI.

These will be necessary in order to handle upgrades from old bitcode
files.

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

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

7 years ago[CGP] add specialization for memcmp expansion with only one basic block
Sanjay Patel [Tue, 27 Jun 2017 23:15:01 +0000 (23:15 +0000)]
[CGP] add specialization for memcmp expansion with only one basic block

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

7 years ago[NewPM/Inliner] Reduce threshold for cold callsites in the non-PGO case
Easwaran Raman [Tue, 27 Jun 2017 23:11:18 +0000 (23:11 +0000)]
[NewPM/Inliner] Reduce threshold for cold callsites in the non-PGO case

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

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

7 years agoGlobalISel: add some more sanity-checking to MachineInstrBuilder. NFC.
Tim Northover [Tue, 27 Jun 2017 22:45:35 +0000 (22:45 +0000)]
GlobalISel: add some more sanity-checking to MachineInstrBuilder. NFC.

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

7 years ago[AArch64] Inline callee if its target-features are a subset of the caller
Florian Hahn [Tue, 27 Jun 2017 22:27:32 +0000 (22:27 +0000)]
[AArch64] Inline callee if its target-features are a subset of the caller

Summary:
Similar to X86, it should be safe to inline callees if their target-features
are a subset of the caller. This change matches GCC's inlining behavior
with respect to attributes [1].

[1] https://gcc.gnu.org/onlinedocs/gcc/AArch64-Function-Attributes.html#AArch64-Function-Attributes

Reviewers: kristof.beyls, javed.absar, rengolin, t.p.northover

Reviewed By: t.p.northover

Subscribers: aemerson, eraman, llvm-commits

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

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

7 years ago[EarlyCSE][MemorySSA] Enable MemorySSA in function-simplification pass of EarlyCSE.
Geoff Berry [Tue, 27 Jun 2017 22:25:02 +0000 (22:25 +0000)]
[EarlyCSE][MemorySSA] Enable MemorySSA in function-simplification pass of EarlyCSE.

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

7 years ago[Analysis] Revert r306472 changes in LoopInfo headers to fix broken builds.
Eugene Zelenko [Tue, 27 Jun 2017 22:20:38 +0000 (22:20 +0000)]
[Analysis] Revert r306472 changes in LoopInfo headers to fix broken builds.

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

7 years ago[GISel]: Add G_FEXP, G_FEXP2 opcodes
Aditya Nandakumar [Tue, 27 Jun 2017 22:19:32 +0000 (22:19 +0000)]
[GISel]: Add G_FEXP, G_FEXP2 opcodes

Also add IRTranslator support.
https://reviews.llvm.org/D34710

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

7 years agoclang-format a file.
Rafael Espindola [Tue, 27 Jun 2017 22:14:20 +0000 (22:14 +0000)]
clang-format a file.

It had a few inconsistent indentations that made a followup patch
hard to read.

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

7 years agore-commit r306336: Enable vectorizer-maximize-bandwidth by default.
Dehao Chen [Tue, 27 Jun 2017 22:05:58 +0000 (22:05 +0000)]
re-commit r306336: Enable vectorizer-maximize-bandwidth by default.

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

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

7 years ago[Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Tue, 27 Jun 2017 21:52:05 +0000 (21:52 +0000)]
[Analysis] 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@306472 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CGP] eliminate a sub instruction in memcmp expansion
Sanjay Patel [Tue, 27 Jun 2017 21:46:34 +0000 (21:46 +0000)]
[CGP] eliminate a sub instruction in memcmp expansion

As noted in D34071, there are some IR optimization opportunities that could be
handled by normal IR passes if this expansion wasn't happening so late in CGP.

Regardless of that, it seems wasteful to knowingly produce suboptimal IR here,
so I'm proposing this change:
  %s = sub i32 %x, %y
  %r = icmp ne %s, 0
    =>
  %r = icmp ne %x, %y

Changing the predicate to 'eq' mimics what InstCombine would do, so that's just
an efficiency improvement if we decide this expansion should happen sooner.

The fact that the PowerPC backend doesn't eliminate the 'subf.' might be
something for PPC folks to investigate separately.

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

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

7 years agoGlobalISel: verify that a COPY is trivial when created.
Tim Northover [Tue, 27 Jun 2017 21:41:40 +0000 (21:41 +0000)]
GlobalISel: verify that a COPY is trivial when created.

Without this check, COPY instructions can actually be one of the generic casts
in disguise. That's confusing and bad.

At some point during ISel this restriction has to be relaxed since the fully
selected instructions will usually use COPY for those purposes. Right now I
think it's possible that relaxation occurs during RegBankSelect (hence the
change there). I'm not convinced that's where it belongs long-term though.

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

7 years agoClean up a test case
Xinliang David Li [Tue, 27 Jun 2017 21:35:49 +0000 (21:35 +0000)]
Clean up a test case

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

7 years agoCreate a PHI value when merging with a known undef live-in
Krzysztof Parzyszek [Tue, 27 Jun 2017 21:30:46 +0000 (21:30 +0000)]
Create a PHI value when merging with a known undef live-in

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

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

7 years ago[WebAssembly] Only run WebAssembly objdump tests if it is enabled as a target
Sam Clegg [Tue, 27 Jun 2017 21:19:27 +0000 (21:19 +0000)]
[WebAssembly] Only run WebAssembly objdump tests if it is enabled as a target

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

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

7 years ago[AArch64] Performance enhancements for Cavium ThunderX2 T99
Joel Jones [Tue, 27 Jun 2017 20:44:55 +0000 (20:44 +0000)]
[AArch64] Performance enhancements for Cavium ThunderX2 T99

This patch enables significant performance enhancements to the
Cavium ThunderX2T99 LLVM backend, as observed by running SPEC2K6,
by adding more detailed scheduling information.

Related Bugzilla bug: http://bugs.llvm.org/show_bug.cgi?id=32562

Patch by: steleman

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

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

7 years ago[WebAssembly] Add support for printing relocations with llvm-objdump
Sam Clegg [Tue, 27 Jun 2017 20:40:53 +0000 (20:40 +0000)]
[WebAssembly] Add support for printing relocations with llvm-objdump

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

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

7 years ago[WebAssembly] Add data size and alignement to linking section
Sam Clegg [Tue, 27 Jun 2017 20:27:59 +0000 (20:27 +0000)]
[WebAssembly] Add data size and alignement to linking section

The overal size of the data section (including BSS)
is otherwise not included in the wasm binary.

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

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

7 years ago[Hexagon] Use proper predicate register state when expanding PS_vselect
Krzysztof Parzyszek [Tue, 27 Jun 2017 19:59:46 +0000 (19:59 +0000)]
[Hexagon] Use proper predicate register state when expanding PS_vselect

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

7 years ago[InstCombine] Propagate nsw flag when turning mul by pow2 into shift when the constan...
Craig Topper [Tue, 27 Jun 2017 19:57:53 +0000 (19:57 +0000)]
[InstCombine] Propagate nsw flag when turning mul by pow2 into shift when the constant is a vector splat or the scalar bit width is larger than 64-bits

The check to see if we can propagate the nsw flag used m_ConstantInt(uint64_t*&) which doesn't work with splat vectors and has a restriction that the bitwidth of the ConstantInt must be 64-bits are less.

This patch changes it to use m_APInt to remove both these issues

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

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

7 years ago[Constants] Fix copy-pasto in llvm_unreachable message. NFC
Craig Topper [Tue, 27 Jun 2017 19:57:51 +0000 (19:57 +0000)]
[Constants] Fix copy-pasto in llvm_unreachable message. NFC

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

7 years ago[CGP] simplify code to get bswap in memcmp expansion; NFCI
Sanjay Patel [Tue, 27 Jun 2017 19:31:35 +0000 (19:31 +0000)]
[CGP] simplify code to get bswap in memcmp expansion; NFCI

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

7 years ago[AMDGPU] Add 2 new alignbit patterns
Stanislav Mekhanoshin [Tue, 27 Jun 2017 19:10:47 +0000 (19:10 +0000)]
[AMDGPU] Add 2 new alignbit patterns

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

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

7 years ago[CodeExtractor] Prevent extraction of block involving blockaddress
Serge Guelton [Tue, 27 Jun 2017 18:57:53 +0000 (18:57 +0000)]
[CodeExtractor] Prevent extraction of block involving blockaddress

BlockAddress are only valid within their function context, which does not
interact well with CodeExtractor. Detect this case and prevent it.

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

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

7 years ago[AMDGPU] Simplify setcc (sext from i1 b), -1|0, cc
Stanislav Mekhanoshin [Tue, 27 Jun 2017 18:53:03 +0000 (18:53 +0000)]
[AMDGPU] Simplify setcc (sext from i1 b), -1|0, cc

Depending on the compare code that can be either an argument of
sext or negate of it. This helps to avoid v_cndmask_b64 instruction
for sext. A reversed value can be further simplified and folded into
its parent comparison if possible.

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

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

7 years ago[Hexagon] Update kills in hexagon-nvj even more properly than before
Krzysztof Parzyszek [Tue, 27 Jun 2017 18:37:16 +0000 (18:37 +0000)]
[Hexagon] Update kills in hexagon-nvj even more properly than before

Account for the fact that both, the feeder and the compare can be moved
over instructions that kill registers.

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

7 years agoRenameIndependentSubregs: Fix infinite loop
Matt Arsenault [Tue, 27 Jun 2017 18:28:10 +0000 (18:28 +0000)]
RenameIndependentSubregs: Fix infinite loop

Apparently this replacement can really be substituting the
same as the original register. Avoid restarting the loop
when there's been no change in the register uses.

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

7 years ago[SROA] Fix APInt size when alloca address space is not 0
Yaxun Liu [Tue, 27 Jun 2017 18:26:06 +0000 (18:26 +0000)]
[SROA] Fix APInt size when alloca address space is not 0

SROA assumes alloca address space is 0, which causes assertion. This patch fixes that.

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

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

7 years ago[AMDGPU] Combine and x, (sext cc from i1) => select cc, x, 0
Stanislav Mekhanoshin [Tue, 27 Jun 2017 18:25:26 +0000 (18:25 +0000)]
[AMDGPU] Combine and x, (sext cc from i1) => select cc, x, 0

Also factored out function to check if a boolean is an already
deserialized value which does not require v_cndmask_b32 to be
loaded. Added binary logical operators to its check.

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

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

7 years ago[CGP] add an IR builder to memcmp expansion class instead of recreating it; NFCI
Sanjay Patel [Tue, 27 Jun 2017 18:18:42 +0000 (18:18 +0000)]
[CGP] add an IR builder to memcmp expansion class instead of recreating it; NFCI

This was a clean-up suggestion from:
https://reviews.llvm.org/D34005

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

7 years ago[Dominators] Use Semi-NCA instead of SLT to calculate dominators
Jakub Kuderski [Tue, 27 Jun 2017 18:08:53 +0000 (18:08 +0000)]
[Dominators] Use Semi-NCA instead of SLT to calculate dominators

Summary:
This patch makes GenericDomTreeConstruction use the Semi-NCA algorithm instead of Simple Lengauer-Tarjan.

As described in `RFC: Dynamic dominators`, Semi-NCA offers slightly better performance than SLT. What's more important, it can be extended to perform incremental updates on already constructed dominator trees.

The patch passes check-all, llvm test suite and is able to boostrap clang. I also wasn't able to observe any compilation time regressions.

Reviewers: sanjoy, dberlin, chandlerc, grosser

Reviewed By: dberlin

Subscribers: llvm-commits

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

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

7 years agoLiveRangeCalc: Slightly improve map usage; NFC
Matthias Braun [Tue, 27 Jun 2017 18:05:26 +0000 (18:05 +0000)]
LiveRangeCalc: Slightly improve map usage; NFC

- DenseMap should be faster than std::map
- Use the `InsertRes = insert() if (!InsertRes.inserted)` pattern rather
  than the `if (!X.contains(...)) { X.insert(...); }` to save one map
  lookup.

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

7 years ago[InstCombine] canonicalize icmp predicate feeding select
Sanjay Patel [Tue, 27 Jun 2017 17:53:22 +0000 (17:53 +0000)]
[InstCombine] canonicalize icmp predicate feeding select

This canonicalization was suggested in D33172 as a way to make InstCombine behavior more uniform.
We have this transform for icmp+br, so unless there's some reason that icmp+select should be
treated differently, we should do the same thing here.

The benefit comes from increasing the chances of creating identical instructions. This is shown in
the tests in logical-select.ll (PR32791). InstCombine doesn't fold those directly, but EarlyCSE
can simplify the identical cmps, and then InstCombine can fold the selects together.

The possible regression for the tests in select.ll raises questions about poison/undef:
http://lists.llvm.org/pipermail/llvm-dev/2017-May/113261.html

...but that transform is just as likely to be triggered by this canonicalization as it is to be
missed, so we're just pointing out a commutation deficiency in the pattern matching:
https://reviews.llvm.org/rL228409

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

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

7 years agoEnable ICP for AutoFDO.
Dehao Chen [Tue, 27 Jun 2017 17:23:33 +0000 (17:23 +0000)]
Enable ICP for AutoFDO.

Summary: AutoFDO should have ICP enabled.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: sanjoy, mehdi_amini, llvm-commits

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

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

7 years ago[ProfData] Make the method threadsafe
Xinliang David Li [Tue, 27 Jun 2017 17:21:51 +0000 (17:21 +0000)]
[ProfData] Make the method threadsafe

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

7 years ago[InstCombine] Add test case demonstrating that we don't propagate nsw flag when conve...
Craig Topper [Tue, 27 Jun 2017 17:16:03 +0000 (17:16 +0000)]
[InstCombine] Add test case demonstrating that we don't propagate nsw flag when converting mul by pow2 to shl when the type is larger than 64-bits. NFC

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

7 years ago[InstCombine] Add test cases to show that we don't propagate 'nsw' flags when convert...
Craig Topper [Tue, 27 Jun 2017 17:16:01 +0000 (17:16 +0000)]
[InstCombine] Add test cases to show that we don't propagate 'nsw' flags when converting mul by pow2 constant to shl for splat vectors. NFC

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

7 years ago[X86][AsmParser][MS-compatability] Binary/Unary operators enhancements
Coby Tayree [Tue, 27 Jun 2017 16:58:27 +0000 (16:58 +0000)]
[X86][AsmParser][MS-compatability] Binary/Unary operators enhancements

Introducing MOD binary operator
https://msdn.microsoft.com/en-us/library/hha180wt.aspx

Enhancing unary operators NEG and NOT, to support more complex patterns

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

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

7 years agoFix incorrect comment in machine-scheduler
Javed Absar [Tue, 27 Jun 2017 16:49:45 +0000 (16:49 +0000)]
Fix incorrect comment in machine-scheduler

The example code incorrectly invokes ScheduleDAGMI wherein from context
it is clear it intends to invoke ScheduleDAGMILive actually.

Reviewed by: Andrew Trick
Differential Revision: https://reviews.llvm.org/D34675

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

7 years ago[opt-viewer] Python 3 support in opt-diff.py
Brian Gesiak [Tue, 27 Jun 2017 16:46:50 +0000 (16:46 +0000)]
[opt-viewer] Python 3 support in opt-diff.py

Summary:
The `file()` builtin is not available in Python 3; use `open()` instead.
https://docs.python.org/3.0/whatsnew/3.0.html#builtins

Reviewers: anemet, davidxl, davide

Reviewed By: davide

Subscribers: davide, fhahn, llvm-commits

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

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

7 years agoChange sort function used in tblgen to be strict weak ordering
David Green [Tue, 27 Jun 2017 16:28:44 +0000 (16:28 +0000)]
Change sort function used in tblgen to be strict weak ordering

The windows debug is failing as the sort function is not strict
weak ordering, so switch a >= to a >.

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

7 years agoAnother test commit
Chih-Hung Hsieh [Tue, 27 Jun 2017 16:18:41 +0000 (16:18 +0000)]
Another test commit

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

7 years ago[DWARF] NFC: Make string-offset handling more like address-table handling;
Paul Robinson [Tue, 27 Jun 2017 15:40:18 +0000 (15:40 +0000)]
[DWARF] NFC: Make string-offset handling more like address-table handling;
do the indirection and relocation all in the same method.

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

7 years ago[PatternMatch] Remove 64-bit or less restriction from m_SpecificInt
Craig Topper [Tue, 27 Jun 2017 15:39:40 +0000 (15:39 +0000)]
[PatternMatch] Remove 64-bit or less restriction from m_SpecificInt

Not sure why this restriction existed, but it seems like we should support any size Constant here.

The particular pattern in the tests is not the only use of this matcher in the tree. There's one in CodeGenPrepare and one in InstSimplify as well.

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

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

7 years ago[JumpThreading] Add test case that was supposed to go with r306085.
Craig Topper [Tue, 27 Jun 2017 15:26:47 +0000 (15:26 +0000)]
[JumpThreading] Add test case that was supposed to go with r306085.

Looks like I forgot to 'git add' when I submitted the commit. Thanks to Chandler for noticing.

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

7 years agoUpdated and extended the information about each instruction in HSW and SNB to include...
Gadi Haber [Tue, 27 Jun 2017 15:05:13 +0000 (15:05 +0000)]
Updated and extended the information about each instruction in HSW and SNB to include the following data:
•static latency
•number of uOps from which the instructions consists
•all ports used by the instruction

Reviewers: 
 RKSimon
 zvi
aymanmus
m_zuckerman

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

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

7 years ago[AMDGPU] SDWA: several fixes for V_CVT and VOPC instructions
Sam Kolton [Tue, 27 Jun 2017 15:02:23 +0000 (15:02 +0000)]
[AMDGPU] SDWA: several fixes for V_CVT and VOPC instructions

Summary:
1. Instruction V_CVT_U32_F32 allow omod operand (see SIInstrInfo.td:1435). In fact this operand shouldn't be allowed here. This fix checks if SDWA pseudo instruction has OMod operand and then copy it.
2. There were several problems with support of VOPC instructions in SDWA peephole pass.

Reviewers: tstellar, arsenm, vpykhtin, airlied, kzhuravl

Subscribers: wdng, nhaehnle, yaxunl, dstuttard, tpr, sarnex, t-tye

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

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

7 years ago[AArch64] Update successor probabilities after ccmp-conversion
Matthew Simpson [Tue, 27 Jun 2017 15:00:22 +0000 (15:00 +0000)]
[AArch64] Update successor probabilities after ccmp-conversion

This patch modifies the conditional compares pass so that it keeps successor
probabilities up-to-date after the conversion. Previously, successor
probabilities were being normalized to a uniform distribution, even though they
may have been heavily biased prior to the conversion (e.g., if one of the edges
was the back edge of a loop). This loss of information affected passes later in
the pipeline.

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

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

7 years ago[LoopUnrollRuntime] Use SCEV exit count for calculating trip count. NFCI
Anna Thomas [Tue, 27 Jun 2017 14:14:35 +0000 (14:14 +0000)]
[LoopUnrollRuntime] Use SCEV exit count for calculating trip count. NFCI

Instead of getBackEdgeTakenCount, use getExitCount on the latch exiting block
(which is proven to be the only exiting block in the loop to be unrolled).

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

7 years ago[mips] Add instruction aliases for ds(r|l)l.
Simon Dardis [Tue, 27 Jun 2017 13:35:17 +0000 (13:35 +0000)]
[mips] Add instruction aliases for ds(r|l)l.

Add the instruction aliases for ds(r|l)l for the two operand alias
of ds(r|l)lv and the aliases ds(r|l)l with the three register operands.

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

7 years ago[SelectionDAG] set dereferenceable flag in MergeConsecutiveStores to fix assetion...
Hiroshi Inoue [Tue, 27 Jun 2017 12:43:08 +0000 (12:43 +0000)]
[SelectionDAG] set dereferenceable flag in MergeConsecutiveStores to fix assetion failure

When SelectionDAG merges consecutive stores and loads in MergeConsecutiveStores, it does not set dereferenceable flag for a created load instruction. This results in an assertion failure if SelectionDAG commonizes this load instruction with other load instructions, as well as it may miss optimization opportunities.

This patch sat dereferenceable flag for the newly created load instruction if all the load instructions to be merged are dereferenceable.

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

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

7 years agoRecommitting rL305465 after fixing bug in TableGen in rL306251 & rL306371
Ayman Musa [Tue, 27 Jun 2017 12:08:37 +0000 (12:08 +0000)]
Recommitting rL305465 after fixing bug in TableGen in rL306251 & rL306371

[X86][AVX512] Improve lowering of AVX512 compare intrinsics (remove redundant shift left+right instructions).

AVX512 compare instructions return v*i1 types.
In cases where the number of elements in the returned value are less than 8, clang adds zeroes to get a mask of v8i1 type.
Later on it's replaced with CONCAT_VECTORS, which then is lowered to many DAG nodes including insert/extract element and shift right/left nodes.
The fact that AVX512 compare instructions put the result in a k register and zeroes all its upper bits allows us to remove the extra nodes simply by copying the result to the required register class.

When lowering, identify these cases and transform them into an INSERT_SUBVECTOR node (marked legal), then catch this pattern in instructions selection phase and transform it into one avx512 cmp instruction.

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

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

7 years agoAdd missing include. Should fix modules libstdc++ builds.
Vassil Vassilev [Tue, 27 Jun 2017 11:45:26 +0000 (11:45 +0000)]
Add missing include. Should fix modules libstdc++ builds.

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

7 years agofix trivial typos, NFC
Hiroshi Inoue [Tue, 27 Jun 2017 10:35:37 +0000 (10:35 +0000)]
fix trivial typos, NFC

succesor -> successor

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

7 years ago[ARM] GlobalISel: Support G_SELECT for pointers
Diana Picus [Tue, 27 Jun 2017 10:29:50 +0000 (10:29 +0000)]
[ARM] GlobalISel: Support G_SELECT for pointers

All we need to do is mark it as legal, otherwise it's just like s32.

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

7 years ago[X86][AVX512] Regenerate avx512 arithmetic tests
Simon Pilgrim [Tue, 27 Jun 2017 10:13:56 +0000 (10:13 +0000)]
[X86][AVX512] Regenerate avx512 arithmetic tests

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

7 years ago[globalisel][tablegen] Add support for EXTRACT_SUBREG.
Daniel Sanders [Tue, 27 Jun 2017 10:11:39 +0000 (10:11 +0000)]
[globalisel][tablegen] Add support for EXTRACT_SUBREG.

Summary:
After this patch, we finally have test cases that require multiple
instruction emission.

Depends on D33590

Reviewers: ab, qcolombet, t.p.northover, rovka, kristof.beyls

Subscribers: javed.absar, llvm-commits, igorb

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

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

7 years ago[mips] Refine the condition for when to use CALL16 vs a GOT displacement.
Simon Dardis [Tue, 27 Jun 2017 10:11:11 +0000 (10:11 +0000)]
[mips] Refine the condition for when to use CALL16 vs a GOT displacement.

Borrow from the logic for 'jal' in MipsAsmParser::processInstruction
and add the extra condition of bypassing CALL16 if the destination symbol
is an ELF symbol with STB_LOCAL binding.

Patch by: John Baldwin

Reviewers: sdardis

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

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

7 years ago[ARM] GlobalISel: Support G_SELECT for i32
Diana Picus [Tue, 27 Jun 2017 09:19:51 +0000 (09:19 +0000)]
[ARM] GlobalISel: Support G_SELECT for i32

* Mark as legal for (s32, i1, s32, s32)
* Map everything into GPRs
* Select to two instructions: a CMP of the condition against 0, to set
  the flags, and a MOVCCr to select between the two inputs based on the
  flags that we've just set

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

7 years agoRecommitting 306331.
Ayal Zaks [Tue, 27 Jun 2017 08:41:19 +0000 (08:41 +0000)]
Recommitting 306331.

Undoing revert 306338 after fixed bug: add metadata to the load instead of the
reverse shuffle added to it, retaining the original ValueMap implementation.

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

7 years ago[PowerPC] fix incorrect processor name for -mcpu in a test case
Hiroshi Inoue [Tue, 27 Jun 2017 08:35:35 +0000 (08:35 +0000)]
[PowerPC] fix incorrect processor name for -mcpu in a test case

to surpress warnings. ppc970 should be 970 (or g5)

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

7 years ago[SROA] Fix PR32902 by more carefully propagating !nonnull metadata.
Chandler Carruth [Tue, 27 Jun 2017 08:32:03 +0000 (08:32 +0000)]
[SROA] Fix PR32902 by more carefully propagating !nonnull metadata.

This is based heavily on the work done ni D34285. I mostly wanted to do
test cleanup for the author to save them some time, but I had a really
hard time understanding why it was so hard to write better test cases
for these issues.

The problem is that because SROA does a second rewrite of the loads and
because we *don't* propagate !nonnull for non-pointer loads, we first
introduced invalid !nonnull metadata and then stripped it back off just
in time to avoid most ways of this PR manifesting. Moving to the more
careful utility only fixes this by changing the predicate to look at the
new load's type rather than the target type. However, that *does* fix
the bug, and the utility is much nicer including adding range metadata
to model the nonnull property after a conversion to an integer.

However, we have bigger problems because we don't actually propagate
*range* metadata, and the utility to do this extracted from instcombine
isn't really in good shape to do this currently. It *only* handles the
case of copying range metadata from an integer load to a pointer load.
It doesn't even handle the trivial cases of propagating from one integer
load to another when they are the same width! This utility will need to
be beefed up prior to using in this location to get the metadata to
fully survive.

And even then, we need to go and teach things to turn the range metadata
into an assume the way we do with nonnull so that when we *promote* an
integer we don't lose the information.

All of this will require a new test case that looks kind-of like
`preserve-nonnull.ll` does here but focuses on range metadata. It will
also likely require more testing because it needs to correctly handle
changes to the integer width, especially as SROA actively tries to
change the integer width!

Last but not least, I'm a little worried about hooking the range
metadata up here because the instcombine logic for converting from
a range metadata *to* a nonnull metadata node seems broken in the face
of non-zero address spaces where null is not mapped to the integer `0`.
So that probably needs to get fixed with test cases both in SROA and in
instcombine to cover it.

But this *does* extract the core PR fix from D34285 of preventing the
!nonnull metadata from being propagated in a broken state just long
enough to feed into promotion and crash value tracking.

On D34285 there is some discussion of zero-extend handling because it
isn't necessary. First, the new load size covers all of the non-undef
(ie, possibly initialized) bits. This may even extend past the original
alloca if loading those bits could produce valid data. The only way its
valid for us to zero-extend an integer load in SROA is if the original
code had a zero extend or those bits were undef. And we get to assume
things like undef *never* satifies nonnull, so non undef bits can
participate here. No need to special case the zero-extend handling, it
just falls out correctly.

The original credit goes to Ariel Ben-Yehuda! I'm mostly landing this to
save a few rounds of trivial edits fixing style issues and test case
formulation.

Differental Revision: D34285

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

7 years agoAdd missing forward declaraion.
Vassil Vassilev [Tue, 27 Jun 2017 08:10:28 +0000 (08:10 +0000)]
Add missing forward declaraion.

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

7 years agoAMDGPU: M0 operands to spill/restore opcodes are dead
Nicolai Haehnle [Tue, 27 Jun 2017 08:04:13 +0000 (08:04 +0000)]
AMDGPU: M0 operands to spill/restore opcodes are dead

Summary:
With scalar stores, M0 is clobbered and therefore marked as implicitly
defined. However, it is also dead.

This fixes an assertion when the Greedy Register Allocator decides to
optimize a spill/restore pair away again (via tryHintsRecoloring).

Reviewers: arsenm

Subscribers: qcolombet, kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

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

7 years ago[TableGen] Fix bug in TableGen CodeGenPatterns when adding variants of the patterns.
Ayman Musa [Tue, 27 Jun 2017 07:10:20 +0000 (07:10 +0000)]
[TableGen] Fix bug in TableGen CodeGenPatterns when adding variants of the patterns.

All patterns reside in a std::vector container, where new variants are added to it using the standard library's emplace_back function.
When calling this with a new element while there is no enough allocated space, a bigger space is allocated and all the old info in the small vector is copied to the newly allocated vector, then the old vector is freed.
The problem is that before doing this "copying", we take a reference of one of the elements in the old vector, and after the "copying" we add it to the new vector.
As the old vector is freed after the copying, the reference now does not point to a valid element.

Added new function to the API of CodeGenDAGPatterns class to return the same information as a copy in order to avoid this issue.

This was revealed in rL305465 that added many patterns and forced the reallocation of the vector which caused crashes in windows bots.

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

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

7 years ago[GlobalISel][X86] Add fp32/62 legalizer, regbank-select, selection tests for G_FADD...
Igor Breger [Tue, 27 Jun 2017 07:01:54 +0000 (07:01 +0000)]
[GlobalISel][X86] Add fp32/62 legalizer, regbank-select, selection tests for G_FADD, G_FSUB, G_FMUL, G_FDIV. NFC.

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

7 years agoFixed the warning introduced by r306289 to make ubuntu-gcc7.1-werror bot green.
Galina Kistanova [Tue, 27 Jun 2017 06:58:57 +0000 (06:58 +0000)]
Fixed the warning introduced by r306289 to make ubuntu-gcc7.1-werror bot green.

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

7 years ago[Reassociate] Make sure EraseInst sets MadeChange
Mikael Holmen [Tue, 27 Jun 2017 05:32:13 +0000 (05:32 +0000)]
[Reassociate] Make sure EraseInst sets MadeChange

Summary:
EraseInst didn't report that it made IR changes through MadeChange.

It is essential that changes to the IR are reported correctly,
since for example ReassociatePass::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().

Reviewers: craig.topper, rnk, davide

Reviewed By: rnk, davide

Subscribers: llvm-commits

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

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

7 years ago[PowerPC] set optimization level in SelectionDAGISel
Hiroshi Inoue [Tue, 27 Jun 2017 04:52:17 +0000 (04:52 +0000)]
[PowerPC] set optimization level in SelectionDAGISel

PowerPC backend does not pass the current optimization level to SelectionDAGISel and so SelectionDAGISel works with the default optimization level regardless of the current optimization level.
This patch makes the PowerPC backend set the optimization level correctly.

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

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

7 years ago[COFF, ARM64] Fix typo in COFF ARM64 Relocation Type
Mandeep Singh Grang [Tue, 27 Jun 2017 04:51:44 +0000 (04:51 +0000)]
[COFF, ARM64] Fix typo in COFF ARM64 Relocation Type

Summary:
Fixed IMAGE_REL_ARM64_PAGEBASE_REL2 ==> IMAGE_REL_ARM64_PAGEBASE_REL21
Refer: http://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx

Reviewers: zturner, rnk, ruiu

Reviewed By: ruiu

Subscribers: aemerson, kristof.beyls, llvm-commits

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

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

7 years ago[InstCombine] Add test cases demonstrating that we don't optmize select+cmp+cttz...
Craig Topper [Tue, 27 Jun 2017 04:50:47 +0000 (04:50 +0000)]
[InstCombine] Add test cases demonstrating that we don't optmize select+cmp+cttz/ctlz when the bitwidth is larger than 64 bits.

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

7 years ago[AVR] Migrate to new MCAsmBackend applyFixup and processFixupValue
Leslie Zhai [Tue, 27 Jun 2017 03:29:27 +0000 (03:29 +0000)]
[AVR] Migrate to new MCAsmBackend applyFixup and processFixupValue

Reviewers: rafael, dylanmckay, jroelofs, meadori

Reviewed By: rafael, meadori

Subscribers: meadori, llvm-commits

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

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

7 years ago[SROA] Further test cleanup and add a test for the actual propagation of
Chandler Carruth [Tue, 27 Jun 2017 03:08:45 +0000 (03:08 +0000)]
[SROA] Further test cleanup and add a test for the actual propagation of
the nonnull attribute distinct from rewriting it into an assume.

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

7 years ago[CFLAA] Move FunctionHandle to llvm::cflaa.
Davide Italiano [Tue, 27 Jun 2017 02:43:00 +0000 (02:43 +0000)]
[CFLAA] Move FunctionHandle to llvm::cflaa.

Also, while here, remove an unneeded `using namespace llvm`.
Thanks to George for the suggestion.

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

7 years ago[CFLAA] Move a common function to the header to reduce duplication.
Davide Italiano [Tue, 27 Jun 2017 02:25:06 +0000 (02:25 +0000)]
[CFLAA] Move a common function to the header to reduce duplication.

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

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

7 years ago[SROA] Clean up a test case a bit prior to adding more testing for
Chandler Carruth [Tue, 27 Jun 2017 02:23:15 +0000 (02:23 +0000)]
[SROA] Clean up a test case a bit prior to adding more testing for
nonnull as part of fixing PR32902.

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

7 years agoScheduleDAGInstrs: Fix fixupKills() adding too many kill flags.
Matthias Braun [Tue, 27 Jun 2017 00:58:48 +0000 (00:58 +0000)]
ScheduleDAGInstrs: Fix fixupKills() adding too many kill flags.

Remove invalid shortcut in fixupKills(): A register needs to be marked
live even when we are not adding a kill flag. This is because a
partially live register must not get a kill flags, but it still needs to
be fully marked live when walking backwards.

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