]> granicus.if.org Git - llvm/log
llvm
5 years ago[Attributor] Further cut down on non-determinism
Johannes Doerfert [Mon, 26 Aug 2019 17:51:23 +0000 (17:51 +0000)]
[Attributor] Further cut down on non-determinism

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

5 years ago[Attributor] Allow explicit dependence tracking
Johannes Doerfert [Mon, 26 Aug 2019 17:48:05 +0000 (17:48 +0000)]
[Attributor] Allow explicit dependence tracking

By default, the Attributor tracks potential dependences between abstract
attributes based on the issued Attributor::getAAFor queries. This
simplifies the development of new abstract attributes but it can also
lead to spurious dependences that might increase compile time and make
internalization harder (D63312). With this patch, abstract attributes
can opt-out of implicit dependence tracking and instead register
dependences explicitly. It is up to the implementation to make sure all
existing dependences are registered.

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

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

5 years ago[DAGCombiner] Remove a bunch of redundant AddToWorklist calls.
Amaury Sechet [Mon, 26 Aug 2019 17:02:12 +0000 (17:02 +0000)]
[DAGCombiner] Remove a bunch of redundant AddToWorklist calls.

Summary:
This comes as a first step toward processing the DAG nodes in topological orders. Doing so ensure that arguments of a node are combined before the node itself is combined, which exposes ore opportunities for optimization and/or reduce the amount of patterns a node has to match for.

DAGCombiner adding nodes to the worklist is various places causes the nodes to be in a different order from what is expected. In addition, this is reduant because these nodes end up being added to the worklist anyways due to the machinery at line 1621.

Reviewers: craig.topper, efriedma, RKSimon, lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[PowerPC] add tests for fma with negated ops; NFC
Sanjay Patel [Mon, 26 Aug 2019 16:20:09 +0000 (16:20 +0000)]
[PowerPC] add tests for fma with negated ops; NFC

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

5 years ago[SampleFDO] Extract the code calling each section reader to readOneSection.
Wei Mi [Mon, 26 Aug 2019 15:54:16 +0000 (15:54 +0000)]
[SampleFDO] Extract the code calling each section reader to readOneSection.

This is a followup of https://reviews.llvm.org/D66513. The code calling each
section reader should be put into a separate function (readOneSection), so
SampleProfileExtBinaryReader can override it. Otherwise, the base class
SampleProfileExtBinaryBaseReader will need to be aware of all different kinds
of section readers. That is not right.

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

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

5 years ago[X86] Automatically generate various tests. NFC
Amaury Sechet [Mon, 26 Aug 2019 13:53:29 +0000 (13:53 +0000)]
[X86] Automatically generate various tests. NFC

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

5 years ago[NFC][cmake] Build fix in tools/llvm-config/CMakeLists.txt
Gabor Buella [Mon, 26 Aug 2019 09:42:30 +0000 (09:42 +0000)]
[NFC][cmake] Build fix in tools/llvm-config/CMakeLists.txt

To avoid the following error message (using cmake version 3.13.4) :

```
CMake Error at tools/llvm-config/CMakeLists.txt:37 (string):
Syntax error in cmake code  when parsing string-std=[^ ]\+Invalid escape sequence \+
```

Reviewed By: mgorny

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

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

5 years ago[LoopUnroll] Handle certain PHIs in full unrolling properly
Bjorn Pettersson [Mon, 26 Aug 2019 09:29:53 +0000 (09:29 +0000)]
[LoopUnroll] Handle certain PHIs in full unrolling properly

Summary:
When reconstructing the CFG of the loop after unrolling,
LoopUnroll could in some cases remove the phi operands of
loop-carried values instead of preserving them, resulting
in undef phi values after loop unrolling.

When doing this reconstruction, avoid removing incoming
phi values for phis in the successor blocks if the successor
is the block we are jumping to anyway.

Patch-by: ebevhan
Reviewers: fhahn, efriedma

Reviewed By: fhahn

Subscribers: bjope, lebedev.ri, zzheng, dmgreen, llvm-commits

Tags: #llvm

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

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

5 years ago[NFC][Regalloc] Add testcases for D66576
Zi Xuan Wu [Mon, 26 Aug 2019 05:06:30 +0000 (05:06 +0000)]
[NFC][Regalloc] Add testcases for D66576

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

5 years ago[X86] Automatically generate stack folding tests. NFC
Amaury Sechet [Sun, 25 Aug 2019 20:48:14 +0000 (20:48 +0000)]
[X86] Automatically generate stack folding tests. NFC

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

5 years ago[Hexagon] remove noise from tests; NFC
Sanjay Patel [Sun, 25 Aug 2019 18:34:07 +0000 (18:34 +0000)]
[Hexagon] remove noise from tests; NFC

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

5 years ago[Hexagon][x86] add tests for bit-test; NFC
Sanjay Patel [Sun, 25 Aug 2019 18:25:22 +0000 (18:25 +0000)]
[Hexagon][x86] add tests for bit-test; NFC

More coverage for D66687
(assuming we make this a generic combine with TLI hook).

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

5 years ago[X86][DAGCombiner] Teach narrowShuffle to use concat_vectors instead of inserting...
Craig Topper [Sun, 25 Aug 2019 17:59:49 +0000 (17:59 +0000)]
[X86][DAGCombiner] Teach narrowShuffle to use concat_vectors instead of inserting into undef

Summary:
Concat_vectors is more canonical during early DAG combine. For example, its what's used by SelectionDAGBuilder when converting IR shuffles into SelectionDAG shuffles when element counts between inputs and mask don't match. We also have combines in DAGCombiner than can pull concat_vectors through a shuffle. See partitionShuffleOfConcats. So it seems like concat_vectors is a better operation to use here. I had to teach DAGCombiner's SimplifyVBinOp to also handle concat_vectors with undef. I haven't checked yet if we can remove the INSERT_SUBVECTOR version in there or not.

I didn't want to mess with the other caller of getShuffleHalfVectors that's used during shuffle lowering where insert_subvector probably is what we want to produce so I've enabled this via a boolean passed to the function.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Add test case for inserting/extracting from two shuffled vectors. NFC
Amaury Sechet [Sun, 25 Aug 2019 15:49:29 +0000 (15:49 +0000)]
[X86] Add test case for inserting/extracting from two shuffled vectors. NFC

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

5 years ago[X86] Add test case for inserting/extracting from shuffled vectors. NFC
Amaury Sechet [Sun, 25 Aug 2019 15:19:20 +0000 (15:19 +0000)]
[X86] Add test case for inserting/extracting from shuffled vectors. NFC

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

5 years ago[PowerPC][AIX] Adds support for writing the .data section in assembly files
Xing Xue [Sun, 25 Aug 2019 15:17:25 +0000 (15:17 +0000)]
[PowerPC][AIX] Adds support for writing the .data section in assembly files

Summary:
Adds support for generating the .data section in assembly files for global variables with a non-zero initialization. The support for writing the .data section in XCOFF object files will be added in a follow-on patch. Any relocations are not included in this patch.

Reviewers: hubert.reinterpretcast, sfertile, jasonliu, daltenty, Xiangling_L

Reviewed by: hubert.reinterpretcast

Subscribers: nemanjai, hiraditya, kbarton, MaskRay, jsji, wuzish, shchenz, DiggerLin, llvm-commits

Tags: #llvm

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

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

5 years ago[AMDGPU] Downgrade from StringLiteral to const char* in an attempt to make GCC 5...
Benjamin Kramer [Sun, 25 Aug 2019 12:47:31 +0000 (12:47 +0000)]
[AMDGPU] Downgrade from StringLiteral to const char* in an attempt to make GCC 5 happy

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

5 years agoFixup in test/DebugInfo/X86/live-debug-vars-discard-invalid.mir
Bjorn Pettersson [Sun, 25 Aug 2019 10:54:44 +0000 (10:54 +0000)]
Fixup in test/DebugInfo/X86/live-debug-vars-discard-invalid.mir

The test case used invalid source operands as input
to BTS64rr instructions (feeding register operands with
immediates). This patch changes those instruction into
using BTS64ri8 instead, which seems to better match the
operand types.

Fixes problems seen in https://reviews.llvm.org/D63973.

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

5 years ago[TableGen] Correct comments for end of namespace. NFC
Bjorn Pettersson [Sun, 25 Aug 2019 10:47:30 +0000 (10:47 +0000)]
[TableGen] Correct comments for end of namespace. NFC

Summary:
Update end-of-namespace comments generated by
tablegen emitters to fulfill the rules setup by
clang-tidy's llvm-namespace-comment checker.

Fixed a few end-of-namespace comments in the
tablegen source code as well.

Reviewers: craig.topper

Reviewed By: craig.topper

Subscribers: craig.topper, stoklund, dschuff, sbc100, jgravelle-google, aheejin, llvm-commits

Tags: #llvm

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

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

5 years ago[SDAG] Fold umul_lohi with 0 or 1 multiplicand
Nikita Popov [Sun, 25 Aug 2019 08:04:22 +0000 (08:04 +0000)]
[SDAG] Fold umul_lohi with 0 or 1 multiplicand

These can turn up during multiplication legalization. In principle
these should also apply to smul_lohi, but I wasn't able to figure
out how to produce those with the necessary operands.

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

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

5 years ago[X86] Teach -Os immediate sharing code to not count constant uses that will become...
Craig Topper [Sun, 25 Aug 2019 05:22:40 +0000 (05:22 +0000)]
[X86] Teach -Os immediate sharing code to not count constant uses that will become INC/DEC.

INC/DEC don't use an immediate so we don't need to count it. We
also shouldn't use the custom isel for it.

Fixes PR42998.

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

5 years ago[X86] Add test cases for PR42998. NFC
Craig Topper [Sun, 25 Aug 2019 05:22:36 +0000 (05:22 +0000)]
[X86] Add test cases for PR42998. NFC

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

5 years agoRemoving block comments from CodeView records in assembly files & related code cleanup
Nilanjana Basu [Sun, 25 Aug 2019 01:09:11 +0000 (01:09 +0000)]
Removing block comments from CodeView records in assembly files & related code cleanup

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

5 years ago[X86] Add isel patterns to match vpdpwssd avx512vnni instruction from add+pmaddwd...
Craig Topper [Sat, 24 Aug 2019 23:14:57 +0000 (23:14 +0000)]
[X86] Add isel patterns to match vpdpwssd avx512vnni instruction from add+pmaddwd nodes.

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

5 years agoAMDGPU: Add baseline test for mul24 ordering issues
Matt Arsenault [Sat, 24 Aug 2019 22:22:38 +0000 (22:22 +0000)]
AMDGPU: Add baseline test for mul24 ordering issues

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

5 years agoAMDGPU: Preserve value name when inserting mul24 intrinsic
Matt Arsenault [Sat, 24 Aug 2019 22:17:10 +0000 (22:17 +0000)]
AMDGPU: Preserve value name when inserting mul24 intrinsic

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

5 years agoAMDGPU: Introduce a flag to disable mul24 intrinsic formation
Matt Arsenault [Sat, 24 Aug 2019 22:14:41 +0000 (22:14 +0000)]
AMDGPU: Introduce a flag to disable mul24 intrinsic formation

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

5 years agoAMDGPU: Generate check lines
Matt Arsenault [Sat, 24 Aug 2019 22:14:37 +0000 (22:14 +0000)]
AMDGPU: Generate check lines

Checking all the instructions will help catch LICM changes when passes
are reordered. Also switch to using gfx9 since global stores make the
relevant instructions more obvious.

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

5 years ago[TLI] Simplify code. NFCI.
Benjamin Kramer [Sat, 24 Aug 2019 17:30:12 +0000 (17:30 +0000)]
[TLI] Simplify code. NFCI.

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

5 years agoHack around a GCC ICE that was fixed in GCC 6.2
Benjamin Kramer [Sat, 24 Aug 2019 16:19:32 +0000 (16:19 +0000)]
Hack around a GCC ICE that was fixed in GCC 6.2

lib/Target/X86/AsmParser/X86AsmParser.cpp: In member function ‘void {anonymous}::X86AsmParser::SwitchMode(unsigned int)’:
lib/Target/X86/AsmParser/X86AsmParser.cpp:927:76:   in constexpr expansion of ‘AllModes.llvm::FeatureBitset::FeatureBitset(std::initializer_list<unsigned int>{((const unsigned int*)(& ._157)), 3u})’
include/llvm/MC/SubtargetFeature.h:56:12:   in constexpr expansion of ‘llvm::FeatureBitset::set(I)’
lib/Target/X86/AsmParser/X86AsmParser.cpp:927:76: internal compiler error: in fold_binary_loc, at fold-const.c:9921
     FeatureBitset AllModes({X86::Mode64Bit, X86::Mode32Bit, X86::Mode16Bit});
                                                                            ^

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

5 years agoTry to make MSVC 2017 happy.
Benjamin Kramer [Sat, 24 Aug 2019 15:46:49 +0000 (15:46 +0000)]
Try to make MSVC 2017 happy.

AArch64BaseInfo.h(316): error C3615: constexpr function 'llvm::SysAlias::SysAlias' cannot result in a constant expression
AArch64BaseInfo.h(316): note: failure was caused by call of undefined function or one not declared 'constexpr'
AArch64BaseInfo.h(316): note: see usage of 'llvm::FeatureBitset::FeatureBitset'

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

5 years agoFix some accidental global initializers by using StringLiteral instead of StringRef
Benjamin Kramer [Sat, 24 Aug 2019 15:24:25 +0000 (15:24 +0000)]
Fix some accidental global initializers by using StringLiteral instead of StringRef

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

5 years agoUpdate tablegen test after r369847.
Benjamin Kramer [Sat, 24 Aug 2019 15:11:41 +0000 (15:11 +0000)]
Update tablegen test after r369847.

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

5 years ago[llvm-reduce] Silence -Wdocumentation
Benjamin Kramer [Sat, 24 Aug 2019 15:04:33 +0000 (15:04 +0000)]
[llvm-reduce] Silence -Wdocumentation

ReduceGlobalVars.cpp:17:6: warning: '@returns' command used in a comment that is attached to a function returning void

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

5 years agoUse a bit of relaxed constexpr to make FeatureBitset costant intializable
Benjamin Kramer [Sat, 24 Aug 2019 15:02:44 +0000 (15:02 +0000)]
Use a bit of relaxed constexpr to make FeatureBitset costant intializable

This requires std::intializer_list to be a literal type, which it is
starting with C++14. The downside is that std::bitset is still not
constexpr-friendly so this change contains a re-implementation of most
of it.

Shrinks clang by ~60k.

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

5 years ago[Constant] Add 'isElementWiseEqual()' method
Roman Lebedev [Sat, 24 Aug 2019 06:49:51 +0000 (06:49 +0000)]
[Constant] Add 'isElementWiseEqual()' method

Promoting it from InstCombine's tryToReuseConstantFromSelectInComparison().

Return true if this constant and a constant 'Y' are element-wise equal.
This is identical to just comparing the pointers, with the exception that
for vectors, if only one of the constants has an `undef` element in some
lane, the constants still match.

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

5 years ago[InstCombine] matchThreeWayIntCompare(): commutativity awareness
Roman Lebedev [Sat, 24 Aug 2019 06:49:36 +0000 (06:49 +0000)]
[InstCombine] matchThreeWayIntCompare(): commutativity awareness

Summary:
`matchThreeWayIntCompare()` looks for
```
   select i1 (a == b),
          i32 Equal,
          i32 (select i1 (a < b), i32 Less, i32 Greater)
```
but both of these selects/compares can be in it's commuted form,
so out of 8 variants, only the two most basic ones is handled.
This fixes regression being introduced in D66232.

Reviewers: spatel, nikic, efriedma, xbolva00

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine] Try to reuse constant from select in leading comparison
Roman Lebedev [Sat, 24 Aug 2019 06:49:25 +0000 (06:49 +0000)]
[InstCombine] Try to reuse constant from select in leading comparison

Summary:
If we have e.g.:
```
  %t = icmp ult i32 %x, 65536
  %r = select i1 %t, i32 %y, i32 65535
```
the constants `65535` and `65536` are suspiciously close.
We could perform a transformation to deduplicate them:
```
Name: ult
%t = icmp ult i32 %x, 65536
%r = select i1 %t, i32 %y, i32 65535
  =>
%t.inv = icmp ugt i32 %x, 65535
%r = select i1 %t.inv, i32 65535, i32 %y
```
https://rise4fun.com/Alive/avb

While this may seem esoteric, this should certainly be good for vectors
(less constant pool usage) and for opt-for-size - need to have only one constant.

But the real fun part here is that it allows further transformation,
in particular it finishes cleaning up the `clamp` folding,
see e.g. `canonicalize-clamp-with-select-of-constant-threshold-pattern.ll`.
We start with e.g.
```
  %dont_need_to_clamp_positive = icmp sle i32 %X, 32767
  %dont_need_to_clamp_negative = icmp sge i32 %X, -32768
  %clamp_limit = select i1 %dont_need_to_clamp_positive, i32 -32768, i32 32767
  %dont_need_to_clamp = and i1 %dont_need_to_clamp_positive, %dont_need_to_clamp_negative
  %R = select i1 %dont_need_to_clamp, i32 %X, i32 %clamp_limit
```
without this patch we currently produce
```
  %1 = icmp slt i32 %X, 32768
  %2 = icmp sgt i32 %X, -32768
  %3 = select i1 %2, i32 %X, i32 -32768
  %R = select i1 %1, i32 %3, i32 32767
```
which isn't really a `clamp` - both comparisons are performed on the original value,
this patch changes it into
```
  %1.inv = icmp sgt i32 %X, 32767
  %2 = icmp sgt i32 %X, -32768
  %3 = select i1 %2, i32 %X, i32 -32768
  %R = select i1 %1.inv, i32 32767, i32 %3
```
and then the magic happens! Some further transform finishes polishing it and we finally get:
```
  %t1 = icmp sgt i32 %X, -32768
  %t2 = select i1 %t1, i32 %X, i32 -32768
  %t3 = icmp slt i32 %t2, 32767
  %R = select i1 %t3, i32 %t2, i32 32767
```
which is beautiful and just what we want.

Proofs for `getFlippedStrictnessPredicateAndConstant()` for de-canonicalization:
https://rise4fun.com/Alive/THl
Proofs for the fold itself: https://rise4fun.com/Alive/THl

Reviewers: spatel, dmgreen, nikic, xbolva00

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine][NFC] reuse-constant-from-select-in-icmp.ll - revisit tests
Roman Lebedev [Sat, 24 Aug 2019 06:49:11 +0000 (06:49 +0000)]
[InstCombine][NFC] reuse-constant-from-select-in-icmp.ll - revisit tests

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

5 years ago[X86] Add an assert to mark more code that needs to be removed when the vector wideni...
Craig Topper [Sat, 24 Aug 2019 05:59:46 +0000 (05:59 +0000)]
[X86] Add an assert to mark more code that needs to be removed when the vector widening legalization switch is removed again.

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

5 years ago[LoopFusion] Fix -Wunused-function in -DLLVM_ENABLE_ASSERTIONS=off build
Fangrui Song [Sat, 24 Aug 2019 02:50:42 +0000 (02:50 +0000)]
[LoopFusion] Fix -Wunused-function in -DLLVM_ENABLE_ASSERTIONS=off build

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

5 years agoRemove unnecessary REQUIRES from a test.
Amara Emerson [Sat, 24 Aug 2019 02:39:51 +0000 (02:39 +0000)]
Remove unnecessary REQUIRES from a test.

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

5 years ago[GlobalISel] Introduce a G_DYN_STACKALLOC opcode to represent dynamic allocas.
Amara Emerson [Sat, 24 Aug 2019 02:25:56 +0000 (02:25 +0000)]
[GlobalISel] Introduce a G_DYN_STACKALLOC opcode to represent dynamic allocas.

This just adds the opcode and verifier, it will be used to replace existing
dynamic alloca handling in a subsequent patch.

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

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

5 years agoNFC: Rename lifetime-asan.ll -> lifetime-sanitizer.ll
Vitaly Buka [Sat, 24 Aug 2019 01:44:39 +0000 (01:44 +0000)]
NFC: Rename lifetime-asan.ll -> lifetime-sanitizer.ll

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

5 years ago[LLVM][NFC] Removing unused functions
Guillaume Chatelet [Fri, 23 Aug 2019 23:19:25 +0000 (23:19 +0000)]
[LLVM][NFC] Removing unused functions

Summary: Removes a not so useful function from DataLayout and cleans up Support/MathExtras.h

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[AMDGPU] Check for immediate SrcC in mfma in AsmParser
Stanislav Mekhanoshin [Fri, 23 Aug 2019 22:22:49 +0000 (22:22 +0000)]
[AMDGPU] Check for immediate SrcC in mfma in AsmParser

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

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

5 years ago[AMDGPU] w/a for gfx908 mfma SrcC literal HW bug
Stanislav Mekhanoshin [Fri, 23 Aug 2019 22:22:29 +0000 (22:22 +0000)]
[AMDGPU] w/a for gfx908 mfma SrcC literal HW bug

gfx908 ignores an mfma if SrcC is a literal.

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

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

5 years ago[AMDGPU] w/a for gfx908 mfma SrcC literal HW bug
Stanislav Mekhanoshin [Fri, 23 Aug 2019 22:09:58 +0000 (22:09 +0000)]
[AMDGPU] w/a for gfx908 mfma SrcC literal HW bug

gfx908 ignores an mfma if SrcC is a literal.

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

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

5 years agohwasan: Fix use of uninitialized memory.
Peter Collingbourne [Fri, 23 Aug 2019 21:37:20 +0000 (21:37 +0000)]
hwasan: Fix use of uninitialized memory.

Reported by e.g.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/23071/steps/build%20with%20ninja/logs/stdio

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

5 years ago[x86] add tests for bt/test; NFC
Sanjay Patel [Fri, 23 Aug 2019 21:15:27 +0000 (21:15 +0000)]
[x86] add tests for bt/test; NFC

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

5 years ago[LLVM][NFC] remove unused fields
Guillaume Chatelet [Fri, 23 Aug 2019 20:49:06 +0000 (20:49 +0000)]
[LLVM][NFC] remove unused fields

Summary:
Here is the commit introducing the fields
https://github.com/llvm/llvm-project/commit/cf6749e4c091

It dates back from 2006 and was used by AArch64 backend.
There is no more reference to these fields in the whole codebase so I think it's fine.

Reviewers: courbet

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

Tags: #llvm

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

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

5 years ago[ORC] Remove query dependencies when symbols are resolved.
Lang Hames [Fri, 23 Aug 2019 20:37:32 +0000 (20:37 +0000)]
[ORC] Remove query dependencies when symbols are resolved.

If the dependencies are not removed then a late failure (one symbol covered by
the query failing after others have already been resolved) can result in an
attempt to detach the query from already finalized symbol, resulting in an
assert/crash. This patch fixes the issue by removing query dependencies in
JITDylib::resolve for symbols that meet the required state.

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

5 years ago[ORC] Fix a FIXME: Propagate errors to dependencies.
Lang Hames [Fri, 23 Aug 2019 20:37:31 +0000 (20:37 +0000)]
[ORC] Fix a FIXME: Propagate errors to dependencies.

When symbols are failed (via MaterializationResponsibility::failMaterialization)
any symbols depending on them will now be moved to an error state. Attempting
to resolve or emit a symbol in the error state (via the notifyResolved or
notifyEmitted methods on MaterializationResponsibility) will result in an error.
If notifyResolved or notifyEmitted return an error due to failure of a
dependence then the caller should log or discard the error and call
failMaterialization to propagate the failure to any queries waiting on the
symbols being resolved/emitted (plus their dependencies).

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

5 years ago[ORC] Fix an incorrect comment.
Lang Hames [Fri, 23 Aug 2019 20:37:26 +0000 (20:37 +0000)]
[ORC] Fix an incorrect comment.

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

5 years ago[AArch64][GlobalISel] Import XRO load/store patterns instead of custom selection
Jessica Paquette [Fri, 23 Aug 2019 20:31:34 +0000 (20:31 +0000)]
[AArch64][GlobalISel] Import XRO load/store patterns instead of custom selection

Instead of using custom C++ in `earlySelect` for loads and stores, just import
the patterns.

Remove `earlySelectLoad`, since we can just import the work it's doing.

Some minor changes to how `ComplexRendererFns` are returned for the XRO
addressing modes. If you add immediates in two steps, sometimes they are not
imported properly and you only end up with one immediate. I'm not sure if this
is intentional.

- Update load-addressing-modes.mir to include the instructions we can now
  import.

- Add a similar test, store-addressing-modes.mir to show which store opcodes we
  currently import, and show that we can pull in shifts etc.

- Update arm64-fastisel-gep-promote-before-add.ll to use FastISel instead of
  GISel. This test failed with GISel because GISel folds the gep into the load.
  The test checks that FastISel doesn't fold non-pointer-width adds into loads.
  GISel on the other hand, produces a G_CONSTANT of -128 for the add, and then
  a G_GEP, which must be pointer-width.

Note that we don't get STRBRoX right now. It seems like the importer can't
handle `FPR8Op:{ *:[Untyped] }:$Rt` source operands. So, those are not currently
supported.

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

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

5 years ago[GlobalISel] Legalizer: Retry combining illegal artifacts as long as there new artifacts
Volkan Keles [Fri, 23 Aug 2019 20:30:35 +0000 (20:30 +0000)]
[GlobalISel] Legalizer: Retry combining illegal artifacts as long as there new artifacts

Summary:
Currently, Legalizer aborts if it’s unable to legalize artifacts. However, it’s
possible to combine them after processing the rest of the instruction because
the legalization is likely to generate more artifacts that allow ArtifactCombiner
to combine away them.

Instead, move illegal artifacts to another list called RetryList and wait until all of the
instruction in InstList are legalized. After that, check if there is any new artifacts and
try to combine them again if that’s the case. If not, abort. The idea is similar to D59339,
but the approach is a bit different.

This patch fixes the issue described above, but the legalizer still may be unable to handle
some cases depending on when to legalize artifacts. So, in the long run, we probably need
a different legalization strategy that handles this dependency in a better way.

Reviewers: dsanders, aditya_nandakumar, qcolombet, arsenm, aemerson, paquette

Reviewed By: dsanders

Subscribers: jvesely, wdng, nhaehnle, rovka, javed.absar, hiraditya, Petar.Avramovic, llvm-commits

Tags: #llvm

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

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

5 years ago[Attributor] Manifest alignment in load and store instructions
Johannes Doerfert [Fri, 23 Aug 2019 20:20:10 +0000 (20:20 +0000)]
[Attributor] Manifest alignment in load and store instructions

Summary:
We can now manifest alignment information in load/store instructions if
the pointer is known to have a better alignment.

Reviewers: uenoku, sstefan1, lebedev.ri

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years agoDo a sweep of symbol internalization. NFC.
Benjamin Kramer [Fri, 23 Aug 2019 19:59:23 +0000 (19:59 +0000)]
Do a sweep of symbol internalization. NFC.

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

5 years ago[X86] Move a transform out of combineConcatVectorOps so we don't prematurely turn...
Craig Topper [Fri, 23 Aug 2019 19:52:24 +0000 (19:52 +0000)]
[X86] Move a transform out of combineConcatVectorOps so we don't prematurely turn CONCAT_VECTORS into INSERT_SUBVECTORS.

CONCAT_VECTORS and INSERT_SUBVECTORS can both call combineConcatVectorOps,
but we shouldn't produce INSERT_SUBVECTORS from there. We should
keep CONCAT_VECTORS until vector legalization.

Noticed while looking at the madd_quad_reduction test from madd.ll

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

5 years agoFix some warnings introduced by r369798.
Wei Mi [Fri, 23 Aug 2019 19:39:12 +0000 (19:39 +0000)]
Fix some warnings introduced by r369798.

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

5 years ago[SampleFDO] Add ExtBinary format to support extension of binary profile.
Wei Mi [Fri, 23 Aug 2019 19:05:30 +0000 (19:05 +0000)]
[SampleFDO] Add ExtBinary format to support extension of binary profile.

This is a patch split from https://reviews.llvm.org/D66374. It tries to add
a new format of profile called ExtBinary. The format adds a section header
table to the profile and organize the profile in sections, so the future
extension like adding a new section or extending an existing section will be
easier while keeping backward compatiblity feasible.

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

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

5 years ago[PowerPC] Expand v1i128 smin
Roland Froese [Fri, 23 Aug 2019 19:04:47 +0000 (19:04 +0000)]
[PowerPC] Expand v1i128 smin

The smin opcode and friends for v1i128 are incorrectly marked as legal for PPC.
Change them to expand.

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

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

5 years agoFix a bug in just submitted rL369789
Philip Reames [Fri, 23 Aug 2019 18:27:57 +0000 (18:27 +0000)]
Fix a bug in just submitted rL369789

Started implementing the vector case and realized the scalar case hadn't handled the GEP producing a different type than the base correctly.  It's entertaining seeing what slips through review when we're focused on the 'hard' parts.  :(

Also adding an extra vector test as it happened to be in workspace and wasn't worth separating.

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

5 years agoRegScavenger: Use Register
Matt Arsenault [Fri, 23 Aug 2019 18:25:34 +0000 (18:25 +0000)]
RegScavenger: Use Register

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

5 years ago[X86] Automatically generate load-local-v3i1.ll . NFC
Amaury Sechet [Fri, 23 Aug 2019 18:12:33 +0000 (18:12 +0000)]
[X86] Automatically generate load-local-v3i1.ll . NFC

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

5 years ago[X86] Mark VPDPWSSD and VPDPWSSDS as commutable. Add stack folding tests.
Craig Topper [Fri, 23 Aug 2019 18:05:37 +0000 (18:05 +0000)]
[X86] Mark VPDPWSSD and VPDPWSSDS as commutable. Add stack folding tests.

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

5 years agoRevert r369233.
Manoj Gupta [Fri, 23 Aug 2019 18:01:13 +0000 (18:01 +0000)]
Revert r369233.

This breaks building of some projects like libfuse and alsa-lib
that now fail when linking.
Error details in PR43092.

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

5 years ago[InstCombine] icmp eq/ne (gep inbounds P, Idx..), null -> icmp eq/ne P, null
Philip Reames [Fri, 23 Aug 2019 17:58:58 +0000 (17:58 +0000)]
[InstCombine] icmp eq/ne (gep inbounds P, Idx..), null -> icmp eq/ne P, null

This generalizes the isGEPKnownNonNull rule from ValueTracking to apply when we do not know if the base is non-null, and thus need to replace one condition with another.

The core notion is that since an inbounds GEP can only form null if the base pointer is null and the offset is zero. However, if the offset is non-zero, the the "inbounds" marker makes the result poison. Thus, we're free to ignore the case where the offset is non-zero. Similarly, there's no case under which a non-null base can result in a null result without generating poison.

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

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

5 years ago[AMDGPU] Automatically generate various tests. NFC
Amaury Sechet [Fri, 23 Aug 2019 17:58:49 +0000 (17:58 +0000)]
[AMDGPU] Automatically generate various tests. NFC

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

5 years ago[BasicAA] Use dereferenceability to reason about aliasing
Johannes Doerfert [Fri, 23 Aug 2019 17:56:10 +0000 (17:56 +0000)]
[BasicAA] Use dereferenceability to reason about aliasing

Summary:
We already use the fact that an object with known size X does not alias
another objection of size Y > X before. With this commit, we use
dereferenceability information to determine a lower bound for Y and not
only rely on the user provided query size.

The result for @global_and_deref_arg_2() and @local_and_deref_ret_2()
in test/Analysis/BasicAA/dereferenceable.ll improved with this patch.

Reviewers: asbirlea, chandlerc, hfinkel, sanjoy

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years ago[Attributor] Manifest constant return values
Johannes Doerfert [Fri, 23 Aug 2019 17:41:37 +0000 (17:41 +0000)]
[Attributor] Manifest constant return values

Summary:
If the unique return value is a constant we now replace call uses with
that constant.

Reviewers: sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years ago[Attributor] Deal with shrinking dereferenceability in a loop
Johannes Doerfert [Fri, 23 Aug 2019 17:29:23 +0000 (17:29 +0000)]
[Attributor] Deal with shrinking dereferenceability in a loop

Summary:
If we have a loop in which the dereferenceability of a pointer decreases
we did slowly decrease it iteration by iteration, leading to a timeout.
With this patch we detect such circular reasoning and indicate a
fixpoint early.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years agoAllow Compiler.h to be included in C files and fix fallthrough warnings
Nathan Huckleberry [Fri, 23 Aug 2019 17:25:21 +0000 (17:25 +0000)]
Allow Compiler.h to be included in C files and fix fallthrough warnings

Summary:
Since clang does not support comment style fallthrough annotations
these should be switched to macros defined in Compiler.h. This
requires some fixing to Compiler.h.

Original patch: https://reviews.llvm.org/D66487

Reviewers: nickdesaulniers, aaron.ballman, xbolva00, rsmith

Reviewed By: nickdesaulniers, aaron.ballman, rsmith

Subscribers: rsmith, sfertile, ormris, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoDebug Info: Support for DW_AT_export_symbols for anonymous structs
Shafik Yaghmour [Fri, 23 Aug 2019 17:19:21 +0000 (17:19 +0000)]
Debug Info: Support for DW_AT_export_symbols for anonymous structs

This implements the DWARF 5 feature described in:

http://dwarfstd.org/ShowIssue.php?issue=141212.1

To support recognizing anonymous structs:

  struct A {
    struct { // Anonymous struct
        int y;
    };
  }   a;

This patch adds a new (DI)flag to LLVM metadata:

ExportSymbols

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

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

5 years ago[SelectionDAG][X86] Enable iX SimplifyDemandedBits to vXi1 SimplifyDemandedVectorElts...
Craig Topper [Fri, 23 Aug 2019 17:14:58 +0000 (17:14 +0000)]
[SelectionDAG][X86] Enable iX SimplifyDemandedBits to vXi1 SimplifyDemandedVectorElts simplification. Add a hack to X86 to avoid a regression

Patch showing the effect of enabling bool vector oversimplification.

Non-VLX builds can simplify a kshift shuffle, but VLX builds simplify:

insert_subvector v8i zeroinitializer, v2i --> insert_subvector v8i undef, v2i

Preventing the removal of the AND to clear the upper bits of result

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

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

5 years ago[DebugInfo] Remove invalidated locations during LiveDebugValues
Jeremy Morse [Fri, 23 Aug 2019 16:33:42 +0000 (16:33 +0000)]
[DebugInfo] Remove invalidated locations during LiveDebugValues

LiveDebugValues gives variable locations to blocks, but it should also take
away. There are various circumstances where a variable location is known
until a loop backedge with a different location is detected. In those
circumstances, where there's no agreement on the variable location, it
should be undef / removed, otherwise we end up picking a location that's
valid on some loop iterations but not others.

However, LiveDebugValues doesn't currently do this, see the new testcase
attached. Without this patch, the location of !3 is assumed to be %bar
through the loop. Once it's added to the In-Locations list, it's never
removed, even though the later dbg.value(0... of !3 makes the location
un-knowable.

This patch checks during block-location-joining to see whether any
previously-present locations have been removed in a predecessor. If they
have, the live-ins have changed, and the block needs reprocessing.
Similarly, in transferTerminator, assign rather than |= the Out-Locations
after processing a block, as we may have deleted some previously valid
locations. This will mean that LiveDebugValues performs more propagation
 -- but that's necessary for it being correct.

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

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

5 years ago[SLP] use range-for loops, fix formatting; NFC
Sanjay Patel [Fri, 23 Aug 2019 16:22:32 +0000 (16:22 +0000)]
[SLP] use range-for loops, fix formatting; NFC

These are part of D57059, but that patch doesn't apply cleanly to trunk
at this point, so we might as well remove some of the noise.

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

5 years agoFix target for new X86 test
Teresa Johnson [Fri, 23 Aug 2019 16:02:25 +0000 (16:02 +0000)]
Fix target for new X86 test

Test added in r369766 had the wrong target arch for the X86 directory,
leading to some bot failures. Fix it to have the appropriate target.

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

5 years ago[Reassoc] Small fix to support unary FNeg in NegateValue(...)
Cameron McInally [Fri, 23 Aug 2019 15:49:38 +0000 (15:49 +0000)]
[Reassoc] Small fix to support unary FNeg in NegateValue(...)

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

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

5 years ago[Attributor][Fix] Deal with "growing" dereferenceability
Johannes Doerfert [Fri, 23 Aug 2019 15:45:46 +0000 (15:45 +0000)]
[Attributor][Fix] Deal with "growing" dereferenceability

Summary:
If we have a negative inbounds offset dereferenceabily "grows". However,
until we do not handle the overflow that can occur in the
dereferenceable bytes and the problem with loops, we simply do not grow
the state.

Reviewers: sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years ago[Attributor][NFCI] Avoid lookups when resolving returned values
Johannes Doerfert [Fri, 23 Aug 2019 15:42:19 +0000 (15:42 +0000)]
[Attributor][NFCI] Avoid lookups when resolving returned values

If the number of potentially returned values not change since the last
traversal we do not need to visit the returned values again. This works
as we only add values to the returned values set now.

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

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

5 years ago[SLP] fix formatting; NFC
Sanjay Patel [Fri, 23 Aug 2019 15:26:12 +0000 (15:26 +0000)]
[SLP] fix formatting; NFC

These are part of D57059, but that patch doesn't apply cleanly to trunk
at this point, so we might as well remove some of the noise.

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

5 years ago[Attributor] FIX: Treat new attributes as changed ones
Johannes Doerfert [Fri, 23 Aug 2019 15:24:57 +0000 (15:24 +0000)]
[Attributor] FIX: Treat new attributes as changed ones

Summary:
When we have new attributes and we end the fixpoint iteration because
the iteration limit is reached, we need to treat the new ones as if they
changed in the last iteration, as they might have.

This adds a test for which we should not derive anything regardless of
the iteration limit, e.g., if we abort there should not be any
attributes manifested in the IR.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years ago[Attributor][NFCI] Try to avoid potential non-deterministic behavior
Johannes Doerfert [Fri, 23 Aug 2019 15:23:49 +0000 (15:23 +0000)]
[Attributor][NFCI] Try to avoid potential non-deterministic behavior

This commit replaces sets with set vectors in an effort to make the
behavior of the Attributor deterministic.

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

5 years ago[ThinLTO] Fix handling of weak interposable symbols
Teresa Johnson [Fri, 23 Aug 2019 15:18:58 +0000 (15:18 +0000)]
[ThinLTO] Fix handling of weak interposable symbols

Summary:
Keep aliasees alive if their alias is live, otherwise we end up with an
alias to a declaration, which is invalid. This can happen when the
aliasee is weak and non-prevailing.

This fix exposed the fact that we were then attempting to internalize
the weak symbol, which was not exported as it was not prevailing. We
should not internalize interposable symbols in general, unless this is
the prevailing copy, since it can lead to incorrect inlining and other
optimizations. Most of the changes in this patch are due to the
restructuring required to pass down the prevailing callback.

Finally, while implementing the test cases, I found that in the case of
a weak aliasee that is still marked not live because its alias isn't
live, after dropping the definition we incorrectly marked the
declaration with weak linkage when resolving prevailing symbols in the
module. This was due to some special case handling for symbols marked
WeakLinkage in the summary located before instead of after a subsequent
check for the symbol being a declaration. It turns out that we don't
actually need this special case handling any more (looking back at the
history, when that was added the code was structured quite differently)
- we will correctly mark with weak linkage further below when the
definition hasn't been dropped.

Fixes PR42542.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, dang, llvm-commits

Tags: #llvm

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

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

5 years ago[MustExec] Add a generic "must-be-executed-context" explorer
Johannes Doerfert [Fri, 23 Aug 2019 15:17:27 +0000 (15:17 +0000)]
[MustExec] Add a generic "must-be-executed-context" explorer

Given an instruction I, the MustBeExecutedContextExplorer allows to
easily traverse instructions that are guaranteed to be executed whenever
I is. For now, these instruction have to be statically "after" I, in
the same or different basic blocks.

This patch also adds a pass which prints the must-be-executed-context
for each instruction in a module. It is used to test the
MustBeExecutedContextExplorer, for now on the examples given in the
class comment of the MustBeExecutedIterator.

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

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

5 years ago[llvm-objcopy] Strip debug sections when running with --strip-unneeded.
Jordan Rupprecht [Fri, 23 Aug 2019 14:28:58 +0000 (14:28 +0000)]
[llvm-objcopy] Strip debug sections when running with --strip-unneeded.

Summary:
GNU --strip-unneeded strips debugging sections as well. Do that for llvm-objcopy as well.

Additionally, add a test that verifies we keep the .gnu_debuglink section. This apparently was not always the case, and I'm not sure which commit fixed it, but there doesn't appear to be any test coverage to make sure we continue to do so.

This fixes PR41043.

Reviewers: jhenderson, jakehehrlich, espindola, alexshap

Subscribers: emaste, arichardson, MaskRay, abrachet, seiya, llvm-commits

Tags: #llvm

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

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

5 years ago[mips] Reduce number of instructions used for loading a global symbol's value
Simon Atanasyan [Fri, 23 Aug 2019 13:36:24 +0000 (13:36 +0000)]
[mips] Reduce number of instructions used for loading a global symbol's value

Now `lw/sw $reg, sym+offset` pseudo instructions for global symbol `sym`
are lowering into the following three instructions.
```
lw     $reg, %got(symbol)($gp)
addiu  $reg, $reg, offset
lw/sw  $reg, 0($reg)
```

It's possible to reduce the number of instructions by taking the offset
in account in the final `lw/sw` command. This patch implements that
optimization.
```
lw     $reg, %got(symbol)($gp)
lw/sw  $reg, offset($reg)
```

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

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

5 years ago[mips] Do not include offset into `%got` expression for global symbols
Simon Atanasyan [Fri, 23 Aug 2019 13:36:14 +0000 (13:36 +0000)]
[mips] Do not include offset into `%got` expression for global symbols

Now pseudo instruction `la $6, symbol+8($6)` is expanding into the following
chain of commands:
```
lw    $1, %got(symbol+8)($gp)
addiu $1, $1, 8
addu  $6, $1, $6
```

This is incorrect. When a linker handles the `R_MIPS_GOT16` relocation,
it does not expect to get any addend and breaks on assertion. Otherwise
it has to create new GOT entry for each unique "sym + offset" pair.
Offset for a global symbol should be added to result of loading GOT
entry by a separate `add` command.

The patch fixes the problem by stripping off an offset from the expression
passed to the `%got`. That's interesting that even current code inserts
a separate `add` command.

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

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

5 years ago[PowerPC] Automatically generate various tests. NFC
Amaury Sechet [Fri, 23 Aug 2019 13:30:45 +0000 (13:30 +0000)]
[PowerPC] Automatically generate various tests. NFC

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

5 years agoUse VT::getHalfNumVectorElementsVT helpers in a few places. NFCI.
Simon Pilgrim [Fri, 23 Aug 2019 12:37:09 +0000 (12:37 +0000)]
Use VT::getHalfNumVectorElementsVT helpers in a few places. NFCI.

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

5 years ago[X86][BtVer2] Add a read-advance to every implicit register use of CMPXCHG8B/16B.
Andrea Di Biagio [Fri, 23 Aug 2019 12:19:45 +0000 (12:19 +0000)]
[X86][BtVer2] Add a read-advance to every implicit register use of CMPXCHG8B/16B.

This is a follow up of r369642.

This patch assigns a ReadAfterLd to every implicit register use of instruction
CMPXCHG8B and instruction CMPXCHG16B. Perf micro-benchmarks show that implicit
registers are read after 3cy from the start of execution.

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

5 years ago[X86][BtVer2] Fix latency of ALU RMW instructions.
Andrea Di Biagio [Fri, 23 Aug 2019 11:34:10 +0000 (11:34 +0000)]
[X86][BtVer2] Fix latency of ALU RMW instructions.

Excluding ADC/SBB and the bit-test instructions (BTR/BTS/BTC), the observed
latency of all other RMW integer arithmetic/logic instructions is 6cy and not
5cy.

Example (ADD):

```
addb $0, (%rsp)            # Latency: 6cy
addb $7, (%rsp)            # Latency: 6cy
addb %sil, (%rsp)          # Latency: 6cy

addw $0, (%rsp)            # Latency: 6cy
addw $511, (%rsp)          # Latency: 6cy
addw %si, (%rsp)           # Latency: 6cy

addl $0, (%rsp)            # Latency: 6cy
addl $511, (%rsp)          # Latency: 6cy
addl %esi, (%rsp)          # Latency: 6cy

addq $0, (%rsp)            # Latency: 6cy
addq $511, (%rsp)          # Latency: 6cy
addq %rsi, (%rsp)          # Latency: 6cy
```

The same latency profile applies to SUB/AND/OR/XOR/INC/DEC.

The observed latency of ADC/SBB is 7-8cy. So we need a different write to model
those.  Latency of BTS/BTR/BTC is not fixed by this patch (they are much slower
than what the model for btver2 currently reports).

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

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

5 years ago[llvm-dlltool] Make sure to strip decorations from ExtName for renamed exports
Martin Storsjo [Fri, 23 Aug 2019 11:18:11 +0000 (11:18 +0000)]
[llvm-dlltool] Make sure to strip decorations from ExtName for renamed exports

ExtName should not be decorated, just like Name.

This avoids double decoration on symbols in import libraries
that use = for renaming functions. (Weak aliases, which use ==,
worked fine with respect to decoration.)

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

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

5 years ago[DAGCombine] GetNegatedExpression - add FMA\FMAD support
Simon Pilgrim [Fri, 23 Aug 2019 10:49:46 +0000 (10:49 +0000)]
[DAGCombine] GetNegatedExpression - add FMA\FMAD support

If the accumulator and either of the multiply operands are negatable then we can we negate the entire expression.

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

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

5 years ago[AMDGPU] gfx10 atomic optimizer changes.
Jay Foad [Fri, 23 Aug 2019 10:07:43 +0000 (10:07 +0000)]
[AMDGPU] gfx10 atomic optimizer changes.

Summary:
Add support for gfx10, where all DPP operations are confined to work
within a single row of 16 lanes, and wave32.

Reviewers: arsenm, sheredom, critson, rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, t-tye, hiraditya, jfb, dstuttard, tpr, llvm-commits

Tags: #llvm

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

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

5 years ago[yaml2obj] - Allow setting the symbol st_other field to any integer.
George Rimar [Fri, 23 Aug 2019 09:31:07 +0000 (09:31 +0000)]
[yaml2obj] - Allow setting the symbol st_other field to any integer.

st_other field of a symbol usually contains its visibility.
Other bits are usually 0, though some targets, like
MIPS can set them using the named bit field values.

Problem is that there is no way to set an arbitrary value now,
though that might be useful for our test cases.

In this patch I introduced a way to set st_other to any numeric
value using the new StOther field.
I added a test and simplified the existent one to show the effect/benefit

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

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

5 years ago[X86] Add a further unrolled madd reduction test case that shows several deficiencies.
Craig Topper [Fri, 23 Aug 2019 07:38:25 +0000 (07:38 +0000)]
[X86] Add a further unrolled madd reduction test case that shows several deficiencies.

The AVX2 check lines show two issues. An ADD that became an OR
because we knew the input was disjoint, but really it was zero
so we should have just removed the ADD/OR all together.

Relatedly we use 128-bit VPMADDWD instructions followed by
256-bit VPADDD operations. We should be able to narrow these
VPADDDs.

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

5 years ago[X86] Make combineLoopSADPattern use CONCAT_VECTORS instead of INSERT_SUBVECTORS...
Craig Topper [Fri, 23 Aug 2019 06:08:33 +0000 (06:08 +0000)]
[X86] Make combineLoopSADPattern use CONCAT_VECTORS instead of INSERT_SUBVECTORS for widening with zeros.

CONCAT_VECTORS is more canonical for the early DAG combine runs
until we start getting into the op legalization phases.

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

5 years ago[X86] Improve lowering of v2i32 SAD handling in combineLoopSADPattern.
Craig Topper [Fri, 23 Aug 2019 05:33:27 +0000 (05:33 +0000)]
[X86] Improve lowering of v2i32 SAD handling in combineLoopSADPattern.

For v2i32 we only feed 2 i8 elements into the psadbw instructions
with 0s in the other 14 bytes. The resulting psadbw instruction
will produce zeros in bits [127:16] of the output. We need to take
the result and feed it to a v2i32 add where the first element
includes bits [15:0] of the sad result. The other element should
be zero.

Prior to this patch we were using a truncate to take 0 from
bits 95:64 of the psadbw. This results in a pshufd to move those
bits to 63:32. But since we also have zeroes in bits 63:32 of
the psadbw output, we should just take those bits.

The previous code probably worked better with promoting legalization,
but now we use widening legalization. I've preserved the old
behavior if -x86-experimental-vector-widening-legalization=false
until we get that option removed.

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