]> granicus.if.org Git - llvm/log
llvm
5 years ago[NFC] Remove LLVM_ALIGNAS
JF Bastien [Wed, 31 Jul 2019 03:22:08 +0000 (03:22 +0000)]
[NFC] Remove LLVM_ALIGNAS

Summary: The minimum compilers support all have alignas, and we don't use LLVM_ALIGNAS anywhere anymore. This also removes an MSVC diagnostic which, according to the comment above, isn't relevant anymore.

Reviewers: rnk

Subscribers: mgorny, jkorous, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[PowerPC] Eliminate loads/swap feeding swap/store for vector type by using big-endian...
Zi Xuan Wu [Wed, 31 Jul 2019 02:56:00 +0000 (02:56 +0000)]
[PowerPC] Eliminate loads/swap feeding swap/store for vector type by using big-endian load/store

In PowerPC, there is instruction to load vector in big endian element order when it's in little endian target.
So we can combine vector load + reverse into big endian load to eliminate the swap instruction.
Also combine vector reverse + store into big endian store.

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

5 years ago[AMDGPU] Fix high occupancy calculation and print it
Stanislav Mekhanoshin [Wed, 31 Jul 2019 01:07:10 +0000 (01:07 +0000)]
[AMDGPU] Fix high occupancy calculation and print it

We had couple places which still return 10 as a maximum
occupancy. Fixed.

Also print comment about occupancy as compiler see it.

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

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

5 years agoGlobalISel: Replace artifact combiner checks with assert
Matt Arsenault [Wed, 31 Jul 2019 00:30:37 +0000 (00:30 +0000)]
GlobalISel: Replace artifact combiner checks with assert

It has bothered me for a while that these guard against cases that
should never happene, so replace these with asserts.

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

5 years ago[MS] Emit S_HEAPALLOCSITE debug info in SelectionDAG
Amy Huang [Wed, 31 Jul 2019 00:16:13 +0000 (00:16 +0000)]
[MS] Emit S_HEAPALLOCSITE debug info in SelectionDAG

Summary: This emits labels around heapallocsite calls in SelectionDAG.

Reviewers: rnk

Subscribers: MatzeB, aprantl, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoTableGen: Add MinAlignment predicate
Matt Arsenault [Wed, 31 Jul 2019 00:14:43 +0000 (00:14 +0000)]
TableGen: Add MinAlignment predicate

AMDGPU uses some custom code predicates for testing alignments.

I'm still having trouble comprehending the behavior of predicate bits
in the PatFrag hierarchy. Any attempt to abstract these properties
unexpectdly fails to apply them.

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

5 years agoReland: [Remarks] Add an LLVM-bitstream-based remark serializer
Francis Visoiu Mistrih [Wed, 31 Jul 2019 00:13:51 +0000 (00:13 +0000)]
Reland: [Remarks] Add an LLVM-bitstream-based remark serializer

Add a new serializer, using a binary format based on the LLVM bitstream
format.

This format provides a way to serialize the remarks in two modes:

1) Separate mode: the metadata is separate from the remark entries.
2) Standalone mode: the metadata and the remark entries are in the same
file.

The format contains:

* a meta block: container version, container type, string table,
external file path, remark version
* a remark block: type, remark name, pass name, function name, debug
file, debug line, debug column, hotness, arguments (key, value, debug
file, debug line, debug column)

A string table is required for this format, which will be dumped in the
meta block to be consumed before parsing the remark blocks.

On clang itself, we noticed a size reduction of 13.4x compared to YAML,
and a compile-time reduction of between 1.7% and 3.5% on CTMark.

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

Original llvm-svn: 367364
Revert llvm-svn: 367370

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

5 years agoRevert "[Remarks] Add an LLVM-bitstream-based remark serializer"
Francis Visoiu Mistrih [Wed, 31 Jul 2019 00:01:34 +0000 (00:01 +0000)]
Revert "[Remarks] Add an LLVM-bitstream-based remark serializer"

This reverts commit r367364.

Breaks some bots: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-gn/builds/3161/steps/annotate/logs/stdio

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

5 years agoGlobalISel: Add G_ATOMICRMW_{FADD|FSUB}
Matt Arsenault [Tue, 30 Jul 2019 23:56:30 +0000 (23:56 +0000)]
GlobalISel: Add G_ATOMICRMW_{FADD|FSUB}

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

5 years agogn build: Merge r367364
Nico Weber [Tue, 30 Jul 2019 23:38:09 +0000 (23:38 +0000)]
gn build: Merge r367364

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

5 years ago[DAGCombiner] Add an option to control whether or not to enable store merging.
Wei Mi [Tue, 30 Jul 2019 23:14:56 +0000 (23:14 +0000)]
[DAGCombiner] Add an option to control whether or not to enable store merging.

Add an option to control whether or not to enable store merging in dag combiner
so we can workaround some bugs more easily.

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

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

5 years ago[Remarks] Add an LLVM-bitstream-based remark serializer
Francis Visoiu Mistrih [Tue, 30 Jul 2019 23:11:57 +0000 (23:11 +0000)]
[Remarks] Add an LLVM-bitstream-based remark serializer

Add a new serializer, using a binary format based on the LLVM bitstream
format.

This format provides a way to serialize the remarks in two modes:

1) Separate mode: the metadata is separate from the remark entries.
2) Standalone mode: the metadata and the remark entries are in the same
file.

The format contains:

* a meta block: container version, container type, string table,
external file path, remark version
* a remark block: type, remark name, pass name, function name, debug
file, debug line, debug column, hotness, arguments (key, value, debug
file, debug line, debug column)

A string table is required for this format, which will be dumped in the
meta block to be consumed before parsing the remark blocks.

On clang itself, we noticed a size reduction of 13.4x compared to YAML,
and a compile-time reduction of between 1.7% and 3.5% on CTMark.

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

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

5 years agoRemove cmake checks for MSVC 1900 / VS 2013
Reid Kleckner [Tue, 30 Jul 2019 22:49:11 +0000 (22:49 +0000)]
Remove cmake checks for MSVC 1900 / VS 2013

Our minimum Visual C++ version is 19.10 from Visual Studio 2017.

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

5 years ago[NFC] Improve cmake diagnostic when checking atomics
JF Bastien [Tue, 30 Jul 2019 22:08:38 +0000 (22:08 +0000)]
[NFC] Improve cmake diagnostic when checking atomics

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

5 years ago[X86] Fix mistake in comment. NFC
Craig Topper [Tue, 30 Jul 2019 21:00:24 +0000 (21:00 +0000)]
[X86] Fix mistake in comment. NFC

The code is matching sext not zext.

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

5 years ago[benchmark] Fix win32 link on case-sensitive fs
Roman Lebedev [Tue, 30 Jul 2019 20:47:59 +0000 (20:47 +0000)]
[benchmark] Fix win32 link on case-sensitive fs

Summary: This fixes cross-builds with MinGW from case-sensitive file-systems (on Linux)

This is a cherry-pick from
https://github.com/google/benchmark/pull/840
https://github.com/google/benchmark/commit/8e48105d465c586068dd8e248fe75a8971c6ba3a

Original patch by: @jschueller (Julien Schueller) !

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

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

5 years ago[AMDGPU] Print register pressure for agpr and vgpr separately
Stanislav Mekhanoshin [Tue, 30 Jul 2019 20:45:15 +0000 (20:45 +0000)]
[AMDGPU] Print register pressure for agpr and vgpr separately

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

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

5 years ago[MemorySSA] Extend allowed behavior for simplified instructions.
Alina Sbirlea [Tue, 30 Jul 2019 20:10:33 +0000 (20:10 +0000)]
[MemorySSA] Extend allowed behavior for simplified instructions.

Summary:
LoopRotate may simplify instructions, leading to the new instructions not having memory accesses created for them.
Allow this behavior, by allowing the new access to be null when the template is null, and looking upwards for the proper defined access when dealing with simplified instructions.

Reviewers: george.burgess.iv

Subscribers: jlebar, Prazek, llvm-commits

Tags: #llvm

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

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

5 years ago[NVPTX] Fix PR41651
Michael Liao [Tue, 30 Jul 2019 19:52:01 +0000 (19:52 +0000)]
[NVPTX] Fix PR41651

Summary:
- Use the passed `DL` directly as retrieving data layout from CS by
  checking the called function is not reliable. Under indirect function
  call, there is no called function.

Subscribers: jholewinski, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[dsymutil] Pass LinkOptions by value instead of const ref.
Jonas Devlieghere [Tue, 30 Jul 2019 19:34:26 +0000 (19:34 +0000)]
[dsymutil] Pass LinkOptions by value instead of const ref.

When looping over the difference architectures in a fat binary, we
modify the link options before dispatching the link step to a different
thread. Passing the options by cont reference is not thread safe, as we
might modify its fields before the whole sturct is copied over.

Given that the link options are already stored in the DwarfLinker, we
can easily fix this by passing a copy of the link options instead of a
reference, which would just get copied later on.

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

5 years ago[AMDGPU] Reserve all AGPRs on targets which do not have them
Stanislav Mekhanoshin [Tue, 30 Jul 2019 19:29:33 +0000 (19:29 +0000)]
[AMDGPU] Reserve all AGPRs on targets which do not have them

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

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

5 years ago[AMDGPU/GlobalISel] Add llvm.amdgcn.fdiv.fast legalization.
Austin Kerbow [Tue, 30 Jul 2019 18:49:16 +0000 (18:49 +0000)]
[AMDGPU/GlobalISel] Add llvm.amdgcn.fdiv.fast legalization.

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: volkan, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, dstuttard, tpr, t-tye, hiraditya, Petar.Avramovic, llvm-commits

Tags: #llvm

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

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

5 years ago[FunctionAttrs] Annotate "willreturn" for AssumeLikeInst
Hideto Ueno [Tue, 30 Jul 2019 18:35:29 +0000 (18:35 +0000)]
[FunctionAttrs] Annotate "willreturn" for AssumeLikeInst

Summary:
In D37215, AssumeLikeInstruction are regarded as `willreturn`. In this patch, annotation is added to those which don't have `willreturn` now(`sideeffect, object_size, experimental_widenable_condition`).

Reviewers: jdoerfert, nikic, sstefan1

Reviewed By: nikic

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agogn build: Update comment I failed to update in r367340 / D65462
Nico Weber [Tue, 30 Jul 2019 18:19:13 +0000 (18:19 +0000)]
gn build: Update comment I failed to update in r367340 / D65462

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

5 years agogn build: Fix check-clang-tools after r362702.
Nico Weber [Tue, 30 Jul 2019 18:16:55 +0000 (18:16 +0000)]
gn build: Fix check-clang-tools after r362702.

r362702 added a test that requires clang-tidy to be linked
into libclang, so add that to the gn build.

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

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

5 years ago[WebAssembly] Do not emit tail calls with return type mismatch
Thomas Lively [Tue, 30 Jul 2019 18:08:39 +0000 (18:08 +0000)]
[WebAssembly] Do not emit tail calls with return type mismatch

Summary:
return_call and return_call_indirect are only valid if the return
types of the callee and caller match. We were previously not enforcing
that, which was producing invalid modules.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

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

5 years ago[NFC] remove obsolete comment
JF Bastien [Tue, 30 Jul 2019 17:21:30 +0000 (17:21 +0000)]
[NFC] remove obsolete comment

LLVM_ALIGNAS was removed from this class in http://llvm.org/r338099 but the comment was left there. The class is still sommewhat relevant despite the comment, let's keep it there with its one use.

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

5 years agoRevert [GVN] Preserve loop related analysis/canonical forms.
Florian Hahn [Tue, 30 Jul 2019 17:04:58 +0000 (17:04 +0000)]
Revert [GVN] Preserve loop related analysis/canonical forms.

This reverts r367332 (git commit 2d7227ec3ac91f36fc32b1c21e72e2f1f5d030ad)

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

5 years ago[Docs] Fix sphinx warning in OCamlLangImpl5.rst
Francis Visoiu Mistrih [Tue, 30 Jul 2019 16:56:45 +0000 (16:56 +0000)]
[Docs] Fix sphinx warning in OCamlLangImpl5.rst

The path to the image was outdated.

http://lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/33865/steps/docs-llvm-html/logs/stdio

llvm/docs/tutorial/OCamlLangImpl5.rst:173: WARNING: image file not readable: tutorial/LangImpl05-cfg.png

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

5 years ago[GVN] Preserve loop related analysis/canonical forms.
Florian Hahn [Tue, 30 Jul 2019 16:43:39 +0000 (16:43 +0000)]
[GVN] Preserve loop related analysis/canonical forms.

LoopInfo can be easily preserved by passing it to the functions that
modify the CFG (SplitCriticalEdge and MergeBlockIntoPredecessor.
SplitCriticalEdge also preserves LoopSimplify and LCSSA form when when passing in
LoopInfo. The test case shows that we preserve LoopSimplify and
LoopInfo. Adding addPreservedID(LCSSAID) did not preserve LCSSA for some
reason.

Also I am not sure if it is possible to preserve those in the new pass
manager, as they aren't analysis passes.

Reviewers: reames, hfinkel, davide, jdoerfert

Reviewed By: jdoerfert

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

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

5 years ago[NFC] Remove uses of LLVM_ALIGNAS
JF Bastien [Tue, 30 Jul 2019 16:31:06 +0000 (16:31 +0000)]
[NFC] Remove uses of LLVM_ALIGNAS

It's not useful anymore: we mandate C++11, and already use alignas in a bunch of places.

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

5 years ago[Support] Workaround a GCC 4.8 bug on constant expression evaluation.
Michael Liao [Tue, 30 Jul 2019 16:11:48 +0000 (16:11 +0000)]
[Support] Workaround a GCC 4.8 bug on constant expression evaluation.

Summary:
- The following stripped code trigger a gcc-4.8 bug. To work that
  around, move the alignment evaluation into template parameter.

```
// https://godbolt.org/z/58p5_X
//

enum { aligned = 0, unaligned = 1 };

template <typename T, int alignment> struct PickAlignment {
  enum { value = alignment == 0 ? alignof(T) : alignment };
};

template <typename ValueType, std::size_t Alignment> struct packed {
private:
  struct {
    alignas(
        PickAlignment<ValueType, Alignment>::value) char buffer[sizeof(int)];
  } Value;
};

using ule16_t = packed<uint16_t, unaligned>;

ule16_t x;
```

- Also, replace `alignas` with `LLVMALIGN_AS` to improve the compiler
  compatibility.

Reviewers: jfb

Subscribers: dexonsmith, llvm-commits

Tags: #llvm

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

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

5 years ago[Remarks] Add two serialization modes for remarks: separate and standalone
Francis Visoiu Mistrih [Tue, 30 Jul 2019 16:01:40 +0000 (16:01 +0000)]
[Remarks] Add two serialization modes for remarks: separate and standalone

The default mode is separate, where the metadata is serialized
separately from the remarks.

Another mode is the standalone mode, where the metadata is serialized
before the remarks, on the same stream.

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

5 years ago[LoopFusion] Extend use of OptimizationRemarkEmitter
Kit Barton [Tue, 30 Jul 2019 15:58:43 +0000 (15:58 +0000)]
[LoopFusion] Extend use of OptimizationRemarkEmitter

Summary:
This patch extends the use of the OptimizationRemarkEmitter to provide
information about loops that are not fused, and loops that are not eligible for
fusion. In particular, it uses the OptimizationRemarkAnalysis to identify loops
that are not eligible for fusion and the OptimizationRemarkMissed to identify
loops that cannot be fused.

It also reuses the statistics to provide the messages used in the
OptimizationRemarks. This provides common message strings between the
optimization remarks and the statistics.

I would like feedback on this approach, in general. If people are OK with this,
I will flesh out additional remarks in subsequent commits.

Subscribers: hiraditya, jsji, llvm-commits

Tags: #llvm

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

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

5 years agoAMDGPU: Avoid emitting "true" predicates
Matt Arsenault [Tue, 30 Jul 2019 15:56:43 +0000 (15:56 +0000)]
AMDGPU: Avoid emitting "true" predicates

Empty condition strings are considerde always true. This removes a lot
of clutter from the generated matcher tables.

This shrinks the source size of AMDGPUGenDAGISel.inc from 7.3M to
6.1M.

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

5 years ago[DivRemPairs] Add srem-of-srem tests (PR42823, D65298, D65451)
Roman Lebedev [Tue, 30 Jul 2019 15:46:03 +0000 (15:46 +0000)]
[DivRemPairs] Add srem-of-srem tests (PR42823, D65298, D65451)

The @srem_of_srem_expanded case exposed a RAUW pitfall in D65298.
Right now these don't appear to fail verification,
so it should be safe to precommit them.

https://reviews.llvm.org/D65298
https://bugs.llvm.org/show_bug.cgi?id=42823
https://reviews.llvm.org/D65451

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

5 years agoAddress post commit review comments on revision 366727.
Sean Fertile [Tue, 30 Jul 2019 15:37:01 +0000 (15:37 +0000)]
Address post commit review comments on revision 366727.

Addresses number of comment made on D64652 after commiting:

- Reorders function decls in the TargetLoweringObjectFileXCOFF class.
- Fix comment in MCSectionXCOFF to include description of external reference
  csects.
- Convert several llvm_unreachables to report_fatal_error
- Convert several dyn_casts to casts as they are expected not to fail.
- Avoid copying DataLayout object.

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

5 years ago[InstCombine] Fold "x ?% y ==/!= 0" to "x & (y-1) ==/!= 0" iff y is power-of-two
Roman Lebedev [Tue, 30 Jul 2019 15:28:22 +0000 (15:28 +0000)]
[InstCombine] Fold "x ?% y ==/!= 0" to  "x & (y-1) ==/!= 0" iff y is power-of-two

Summary:
I have stumbled into this by accident while preparing to extend backend `x s% C ==/!= 0` handling.

While we did happen to handle this fold in most of the cases,
the folding is indirect - we fold `x u% y` to `x & (y-1)` (iff `y` is power-of-two),
or first turn `x s% -y` to `x u% y`; that does handle most of the cases.
But we can't turn `x s% INT_MIN` to `x u% -INT_MIN`,
and thus we end up being stuck with `(x s% INT_MIN) == 0`.

There is no such restriction for the more general fold:
https://rise4fun.com/Alive/IIeS

To be noted, the fold does not enforce that `y` is a constant,
so it may indeed increase instruction count.
This is consistent with what `x u% y`->`x & (y-1)` already does.
I think it makes sense, it's at most one (simple) extra instruction,
while `rem`ainder is really much more un-simple (and likely **very** costly).

Reviewers: spatel, RKSimon, nikic, xbolva00, craig.topper

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoAsk confirmation when `git llvm push` will push multiple commits
Mehdi Amini [Tue, 30 Jul 2019 15:25:14 +0000 (15:25 +0000)]
Ask confirmation when `git llvm push` will push multiple commits

This can reduce unexpectedly pushing more than expected by the user.

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

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

5 years agoFix `git llvm` script when no arguments are supplied on Python 3
Mehdi Amini [Tue, 30 Jul 2019 15:25:11 +0000 (15:25 +0000)]
Fix `git llvm` script when no arguments are supplied on Python 3

Instead of displaying a help message, it was issuing an error message:

  AttributeError: 'Namespace' object has no attribute 'func'

https://bugs.python.org/issue16308 has more information on the bug.

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

5 years ago[X86] SimplifyDemandedVectorEltsForTargetNode should be calling resolveTargetShuffleI...
Simon Pilgrim [Tue, 30 Jul 2019 15:06:09 +0000 (15:06 +0000)]
[X86] SimplifyDemandedVectorEltsForTargetNode should be calling resolveTargetShuffleInputs not getTargetShuffleMask

Add TODO comment.

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

5 years agogn build: Use rebase_path on filename args to libcxx/utils/gen_link_script.py
Hans Wennborg [Tue, 30 Jul 2019 14:17:58 +0000 (14:17 +0000)]
gn build: Use rebase_path on filename args to libcxx/utils/gen_link_script.py

  $ ninja -j800
  [1/5] ACTION //libcxx/src:cxx_linker_script(//llvm/utils/gn/build/toolchain:stage2_unix)
  FAILED: lib/libc++.so
  python ../libcxx/utils/gen_link_script.py --input //build.gn/lib/libc++.so.0 --output //build.gn/lib/libc++.so c++abi unwind
  GENERATING SCRIPT: 'INPUT(libc++.so.0 -lc++abi -lunwind)' as file //build.gn/lib/libc++.so
  Traceback (most recent call last):
    File "../libcxx/utils/gen_link_script.py", line 57, in <module>
      sys.exit(main())
    File "../libcxx/utils/gen_link_script.py", line 50, in main
      with open(args.output, 'w') as f:
  IOError: [Errno 2] No such file or directory: '//build.gn/lib/libc++.so'
  ninja: build stopped: subcommand failed.

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

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

5 years ago[RISCV] Attempt to make rv{32,64}i-aliases-invalid.s less flaky
Sam Elliott [Tue, 30 Jul 2019 13:40:51 +0000 (13:40 +0000)]
[RISCV] Attempt to make rv{32,64}i-aliases-invalid.s less flaky

These tests have been disabled on Linux and Windows due to failing
there. I think that could be down to a race condition between stdout
and stderr, so I have disabled output to stdout.

For the moment, only re-enable on linux, because I don't have a windows
machine to test on.

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

5 years ago[llvm-objcopy] - Stop using Inputs/alloc-symtab.o
George Rimar [Tue, 30 Jul 2019 13:37:02 +0000 (13:37 +0000)]
[llvm-objcopy] - Stop using Inputs/alloc-symtab.o

Initially Inputs/alloc-symtab.o was added in D42222.
It contains an allocatable .symtab section. Today
we are able to create such sections using yaml2obj.

Later people started using this input for no solid reason in their tests.
Now multiple of tests are using it.
(And those tests do not need such a specific case actually).

In this patch I removed this binary and rewrote the few tests.

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

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

5 years ago[X86][AVX] SimplifyDemandedVectorElts - handle extraction from X86ISD::SUBV_BROADCAST...
Simon Pilgrim [Tue, 30 Jul 2019 11:35:13 +0000 (11:35 +0000)]
[X86][AVX] SimplifyDemandedVectorElts - handle extraction from X86ISD::SUBV_BROADCAST source (PR42819)

PR42819 showed an issue that we couldn't handle the case where we demanded a 'sub-sub-vector' of the SUBV_BROADCAST 'sub-vector' source.

This patch recognizes these cases and extracts the sub-sub-vector instead of trying to broadcast to a type smaller than the 'sub-vector' source.

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

5 years ago[CMake] Define _FILE_OFFSET_BITS=64 on Solaris
Rainer Orth [Tue, 30 Jul 2019 10:33:20 +0000 (10:33 +0000)]
[CMake] Define _FILE_OFFSET_BITS=64 on Solaris

This is the compantion patch to https://reviews.llvm.org/D64482, needed to ensure
that builds with host compilers that don't yet predefine _FILE_OFFSET_BITS=64 on
Solaris succeed by always making the host and freshly built clang consistent.

Tested on x86_64-pc-solaris2.11.

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

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

5 years ago[ARM][LowOverheadLoops] Enable by default
Sam Parker [Tue, 30 Jul 2019 08:14:28 +0000 (08:14 +0000)]
[ARM][LowOverheadLoops] Enable by default

The code is now in a good enough state to pass the bunch of tests that
I have run (after fixing the bugs), so let's enable it by default.

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

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

5 years ago[ARM][LowOverheadLoops] Revert non-header LE target
Sam Parker [Tue, 30 Jul 2019 08:08:44 +0000 (08:08 +0000)]
[ARM][LowOverheadLoops] Revert non-header LE target

Revert the hardware loop upon finding a LoopEnd that doesn't target
the loop header, instead of asserting a failure.

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

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

5 years ago[NFC][X86][AArch64] Revisit test coverage for X s% C == 0 fold - add tests for negati...
Roman Lebedev [Tue, 30 Jul 2019 08:00:49 +0000 (08:00 +0000)]
[NFC][X86][AArch64] Revisit test coverage for X s% C == 0 fold - add tests for negative divisors, INT_MIN divisors

As discussed in the review, that fold is only valid for positive
divisors, so while we can negate negative divisors,
we have to special-case INT_MIN.

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

5 years ago[AArch64][AsmParser] Remove SVE and SVE2 from ARMTargetParser
Cullen Rhodes [Tue, 30 Jul 2019 07:47:48 +0000 (07:47 +0000)]
[AArch64][AsmParser] Remove SVE and SVE2 from ARMTargetParser

Summary:
Patch removes SVE and SVE2 features from ARMTargetParser as these
features are not supported on ARM.

Reviewed By: rengolin

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

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

5 years agoRevert "[DivRemPairs] Handling for expanded-form rem - recomposition (PR42673)"
Roman Lebedev [Tue, 30 Jul 2019 07:44:58 +0000 (07:44 +0000)]
Revert "[DivRemPairs] Handling for expanded-form rem - recomposition (PR42673)"

test-suite/MultiSource/Benchmarks/DOE-ProxyApps-C/miniGMG broke:

Only PHI nodes may reference their own value!
  %sub33 = srem i32 %sub33, %ranks_in_i

This reverts commit r367288.

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

5 years ago[DivRemPairs] Handling for expanded-form rem - recomposition (PR42673)
Roman Lebedev [Tue, 30 Jul 2019 07:10:00 +0000 (07:10 +0000)]
[DivRemPairs] Handling for expanded-form rem - recomposition (PR42673)

Summary:
While `-div-rem-pairs` pass can decompose rem in div+rem pair when div-rem pair
is unsupported by target, nothing performs the opposite fold.
We can't do that in InstCombine or DAGCombine since neither of those has access to TTI.
So it makes most sense to teach `-div-rem-pairs` about it.

If we matched rem in expanded form, we know we will be able to place div-rem pair
next to each other so we won't regress the situation.
Also, we shouldn't decompose rem if we matched already-decomposed form.
This is surprisingly straight-forward otherwise.

https://bugs.llvm.org/show_bug.cgi?id=42673

Reviewers: spatel, RKSimon, efriedma, ZaMaZaN4iK, bogner

Reviewed By: bogner

Subscribers: bogner, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[APInt] Introduce clearLowBits()
Roman Lebedev [Tue, 30 Jul 2019 07:09:41 +0000 (07:09 +0000)]
[APInt] Introduce clearLowBits()

Summary: Equivalent to `x & -2^K`.

Reviewers: RKSimon, craig.topper

Reviewed By: RKSimon, craig.topper

Subscribers: dexonsmith, llvm-commits

Tags: #llvm

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

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

5 years agoRevert "[llvm-objdump] Add warning messages if disassembly + source for problematic...
Michael Pozulp [Tue, 30 Jul 2019 07:05:27 +0000 (07:05 +0000)]
Revert "[llvm-objdump] Add warning messages if disassembly + source for problematic inputs"

This reverts r367284 (git commit b1cbe51bdf44098c74f5c74b7bcd8c041a7c6772).
My changes to LLVMSymbolizer caused a test to fail:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/29488

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

5 years ago[llvm-objdump] Add warning messages if disassembly + source for problematic inputs
Michael Pozulp [Tue, 30 Jul 2019 05:28:26 +0000 (05:28 +0000)]
[llvm-objdump] Add warning messages if disassembly + source for problematic inputs

Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=41905

Reviewers: jhenderson, rupprecht, grimar

Reviewed By: jhenderson, grimar

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[NFC][PowerPC] Add test case for D65063
Zi Xuan Wu [Tue, 30 Jul 2019 05:22:03 +0000 (05:22 +0000)]
[NFC][PowerPC] Add test case for D65063

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

5 years ago[NFC] use C++11 in AlignOf.h, remove AlignedCharArray
JF Bastien [Tue, 30 Jul 2019 04:03:33 +0000 (04:03 +0000)]
[NFC] use C++11 in AlignOf.h, remove AlignedCharArray

I removed all uses of AlignedCharArray since the minimum MSVC version can handle
alignas on char arrays correctly. We can therefore remove AlignedCharArray.

This patch also updates AlignedCharArrayUnion to use C++11.

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

5 years ago[FileCollector] test: disable the directory entry collection checks on windows
Alex Lorenz [Tue, 30 Jul 2019 00:27:33 +0000 (00:27 +0000)]
[FileCollector] test: disable the directory entry collection checks on windows

Looks like one of the entries isn't found on windows. I'm investigating why.
In the meantime, I'll disable this part of the test on windows.

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

5 years ago[FileCollector] Add a VFS that records FS accesses using the FileCollector
Alex Lorenz [Mon, 29 Jul 2019 23:38:30 +0000 (23:38 +0000)]
[FileCollector] Add a VFS that records FS accesses using the FileCollector

This patch adds a VFS that can be overlaid on top of another VFS
to record file system accesses using the FileCollector.
This can help to gather files that are needed for reproducers.

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

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

5 years ago[NFC] avoid AlignedCharArray in LLVM
JF Bastien [Mon, 29 Jul 2019 23:37:48 +0000 (23:37 +0000)]
[NFC] avoid AlignedCharArray in LLVM

As discussed in D65249, don't use AlignedCharArray or std::aligned_storage. Just use alignas(X) char Buf[Size];. This will allow me to remove AlignedCharArray entirely, and works on the current minimum version of Visual Studio.

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

5 years ago[llvm-lipo] Fix test on Windows
Anusha Basana [Mon, 29 Jul 2019 22:27:27 +0000 (22:27 +0000)]
[llvm-lipo] Fix test on Windows

Error message outputs with lowercase on Windows.
Made test work on Widnows.

For example:
llvm-lipo: error: 'i386': no such file or directory

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

5 years ago[clang-tidy]: Google: new check 'google-upgrade-googletest-case'
Eric Fiselier [Mon, 29 Jul 2019 21:38:56 +0000 (21:38 +0000)]
[clang-tidy]: Google: new check 'google-upgrade-googletest-case'

Introduce a new check to upgrade user code based on API changes in Googletest.

The check finds uses of old Googletest APIs with "case" in their name and replaces them with the new APIs named with "suite".

Patch by Alex Strelnikov (strel@google.com)
Reviewed as D62977.

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

5 years agogit-llvm: Restore compatibility with git 1.8.3.
James Y Knight [Mon, 29 Jul 2019 21:01:11 +0000 (21:01 +0000)]
git-llvm: Restore compatibility with git 1.8.3.

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

5 years ago[IR] Consolidate fixed metadata kind definitions (NFC)
Vedant Kumar [Mon, 29 Jul 2019 20:24:20 +0000 (20:24 +0000)]
[IR] Consolidate fixed metadata kind definitions (NFC)

Put the list of fixed metadata kinds in one place.

Testing: check-llvm with+without LLVM_ENABLE_MODULES=On

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

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

5 years ago[PowerPC][NFC]Fix a typo in comment.
Jinsong Ji [Mon, 29 Jul 2019 19:27:54 +0000 (19:27 +0000)]
[PowerPC][NFC]Fix a typo in comment.

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

5 years ago[X86] Fix typo in comment. We're looking at a right shift not a left shift. NFC
Craig Topper [Mon, 29 Jul 2019 19:22:51 +0000 (19:22 +0000)]
[X86] Fix typo in comment. We're looking at a right shift not a left shift. NFC

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

5 years ago[llvm-lipo] Implement -replace
Anusha Basana [Mon, 29 Jul 2019 18:46:34 +0000 (18:46 +0000)]
[llvm-lipo] Implement -replace

Replaces specified architecture in universal binary input file with
slice from the file_name argument passed into the replace command.

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

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

5 years agogn build: Merge r367071
Vitaly Buka [Mon, 29 Jul 2019 17:48:02 +0000 (17:48 +0000)]
gn build: Merge r367071

llvm-svn: 366289

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

5 years ago[UpdateTestChecks] Emit warning when invalid value for -check-prefix(es) option
David Bolvansky [Mon, 29 Jul 2019 17:41:00 +0000 (17:41 +0000)]
[UpdateTestChecks] Emit warning when invalid value for -check-prefix(es) option

Summary:
The script is silent for the following issue:
FileCheck %s -check-prefix=CHECK,POPCOUNT

FileCheck will catch it later, but I think we can warn here too.

Now it warns:
 ./update_llc_test_checks.py file.ll
WARNING: Supplied prefix 'CHECK,POPCOUNT' is invalid. Prefix must contain only alphanumeric characters, hyphens and underscores. Did you mean --check-prefixes=CHECK,POPCOUNT?

Reviewers: lebedev.ri, spatel, RKSimon, craig.topper, nikic, gbedwell

Reviewed By: RKSimon

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[Remarks] Update error message format string
Francis Visoiu Mistrih [Mon, 29 Jul 2019 17:40:34 +0000 (17:40 +0000)]
[Remarks] Update error message format string

All the clang-cmake-armv{7,8} bots are failing this test. This is an
attempt to fix this.

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

5 years agoThinLTOBitcodeWriter: Include globals associated with type metadata globals in the...
Peter Collingbourne [Mon, 29 Jul 2019 17:22:40 +0000 (17:22 +0000)]
ThinLTOBitcodeWriter: Include globals associated with type metadata globals in the merged module.

Globals that are associated with globals with type metadata need to appear
in the merged module because they will reference the global's section directly.

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

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

5 years ago[X86] resolveTargetShuffleInputs - add depth to limit recursion.
Simon Pilgrim [Mon, 29 Jul 2019 17:17:58 +0000 (17:17 +0000)]
[X86] resolveTargetShuffleInputs - add depth to limit recursion.

Avoids slow downs from calls to ComputeNumSignBits/computeKnownBits going too deep.

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

5 years agoAMDGPU/LoadStoreOptimizer: combine MMOs when merging instructions
Tom Stellard [Mon, 29 Jul 2019 16:40:58 +0000 (16:40 +0000)]
AMDGPU/LoadStoreOptimizer: combine MMOs when merging instructions

Summary:
The LoadStoreOptimizer was creating instructions with 2
MachineMemOperands, which meant they were assumed to alias with all other instructions,
because MachineInstr:mayAlias() returns true when an instruction has multiple
MachineMemOperands.

This was preventing these instructions from being merged again, and was
giving the scheduler less freedom to reorder them.

Reviewers: arsenm, nhaehnle

Reviewed By: arsenm

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

Tags: #llvm

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

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

5 years ago[llvm-objcopy] Improve --add-section argument string parsing
Sergey Dmitriev [Mon, 29 Jul 2019 16:22:40 +0000 (16:22 +0000)]
[llvm-objcopy] Improve --add-section argument string parsing

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

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

5 years ago[AMDGPU] Fix typo in error message
Jay Foad [Mon, 29 Jul 2019 16:17:13 +0000 (16:17 +0000)]
[AMDGPU] Fix typo in error message

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

5 years ago[NFC][FPEnv] Pre-commit tests for canonicalize negated operand of fdiv.
Cameron McInally [Mon, 29 Jul 2019 16:09:56 +0000 (16:09 +0000)]
[NFC][FPEnv] Pre-commit tests for canonicalize negated operand of fdiv.

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

5 years ago[X86] combineX86ShufflesRecursively - start recursion at depth = 0. NFCI.
Simon Pilgrim [Mon, 29 Jul 2019 15:57:06 +0000 (15:57 +0000)]
[X86] combineX86ShufflesRecursively - start recursion at depth = 0. NFCI.

As discussed on rL367171, we have a problem where the depth recursion used in combineX86ShufflesRecursively was subtly different to computeKnownBits etc. - it starts at Depth=1 instead of Depth=0 like the others and has a different maximum recursion depth.

This NFC patch fixes the recursion depth to start at 0, so we can more easily reuse depth values in calls from combineX86ShufflesRecursively and its helper functions in computeKnownBits etc.

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

5 years ago[RISCV] Fix uninitialized variable after call to evaluateConstantImm
Francis Visoiu Mistrih [Mon, 29 Jul 2019 15:52:13 +0000 (15:52 +0000)]
[RISCV] Fix uninitialized variable after call to evaluateConstantImm

For llvm/test/MC/RISCV/rv64i-aliases-invalid.s, UBSan reports:

lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:371:9: runtime error:
load of value 3879186881, which is not a valid value for type
'RISCVMCExpr::VariantKind'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:371:9 in

It turns out that evaluateConstantImm does not set `VK` and it remains
unitialized when doing comparisons in `isImmXLenLI()`.

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

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

5 years ago[InstCombine] fold fadd+fneg with fdiv/fmul betweena
Sanjay Patel [Mon, 29 Jul 2019 13:50:25 +0000 (13:50 +0000)]
[InstCombine] fold fadd+fneg with fdiv/fmul betweena

The backend already does this via isNegatibleForFree(),
but we may want to alter the fneg IR canonicalizations
that currently exist, so we need to try harder to fold
fneg in IR to avoid regressions.

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

5 years ago[ValueTracking] Remove volatile check in isGuaranteedToTransferExecutionToSuccessor
Hideto Ueno [Mon, 29 Jul 2019 13:35:34 +0000 (13:35 +0000)]
[ValueTracking] Remove volatile check in isGuaranteedToTransferExecutionToSuccessor

Summary: As clarified in D53184, volatile load and store do not trap. Therefore, we should remove volatile checks for instructions in  `isGuaranteedToTransferExecutionToSuccessor`.

Reviewers: jdoerfert, efriedma, nikic

Reviewed By: nikic

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine] reduce code for fadd with fneg operand; NFC
Sanjay Patel [Mon, 29 Jul 2019 13:20:46 +0000 (13:20 +0000)]
[InstCombine] reduce code for fadd with fneg operand; NFC

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

5 years ago[InstCombine] add tests for fadd with negated operand; NFC
Sanjay Patel [Mon, 29 Jul 2019 12:49:36 +0000 (12:49 +0000)]
[InstCombine] add tests for fadd with negated operand; NFC

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

5 years ago[AMDGPU] Add amdgpu_kernel for consistency with other tests
Jay Foad [Mon, 29 Jul 2019 11:48:17 +0000 (11:48 +0000)]
[AMDGPU] Add amdgpu_kernel for consistency with other tests

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

5 years ago[DAGCombine] narrowInsertExtractVectorBinOp - early out for binops that change value...
Simon Pilgrim [Mon, 29 Jul 2019 11:34:45 +0000 (11:34 +0000)]
[DAGCombine] narrowInsertExtractVectorBinOp - early out for binops that change value type. NFCI.

This is implicit in the value type checks in getSubVectorSrc - this just makes it upfront and obvious.

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

5 years ago[DivergenceAnalysis] Add methods for querying divergence at use
Jay Foad [Mon, 29 Jul 2019 10:22:09 +0000 (10:22 +0000)]
[DivergenceAnalysis] Add methods for querying divergence at use

Summary:
The existing isDivergent(Value) methods query whether a value is
divergent at its definition. However even if a value is uniform at its
definition, a use of it in another basic block can be divergent because
of divergent control flow between the def and the use.

This patch adds new isDivergent(Use) methods to DivergenceAnalysis,
LegacyDivergenceAnalysis and GPUDivergenceAnalysis.

This might allow D63953 or other similar workarounds to be removed.

Reviewers: alex-t, nhaehnle, arsenm, rtaylor, rampitec, simoll, jingyue

Reviewed By: nhaehnle

Subscribers: jfb, jvesely, wdng, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[SystemZ] Regenerate <8 x i31> store test
Simon Pilgrim [Mon, 29 Jul 2019 09:49:23 +0000 (09:49 +0000)]
[SystemZ] Regenerate <8 x i31> store test

To help show the diffs from an upcoming SimplifyDemandedBits patch.

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

5 years agoMark test/MC/RISCV/rv{32,64}i-aliases-invalid.s unsupported also on Windows
Hans Wennborg [Mon, 29 Jul 2019 09:49:04 +0000 (09:49 +0000)]
Mark test/MC/RISCV/rv{32,64}i-aliases-invalid.s unsupported also on Windows

Because they fail there too.

FAIL: LLVM :: MC/RISCV/rv32i-aliases-invalid.s (24397 of 32659)
******************** TEST 'LLVM :: MC/RISCV/rv32i-aliases-invalid.s' FAILED ********************
Script:
--
: 'RUN: at line 2';   not c:\src\llvm.monorepo\build.release2\bin\llvm-mc.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s -triple=riscv32 -riscv-no-aliases 2>&1 | c:\src\llvm.monorepo\build.release2\bin\filecheck.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s
: 'RUN: at line 3';   not c:\src\llvm.monorepo\build.release2\bin\llvm-mc.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s -triple=riscv32 2>&1 | c:\src\llvm.monorepo\build.release2\bin\filecheck.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s
--
Exit Code: 1

Command Output (stdout):
--
$ ":" "RUN: at line 2"
$ "not" "c:\src\llvm.monorepo\build.release2\bin\llvm-mc.exe" "C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s" "-triple=riscv32" "-riscv-no-aliases"
$ "c:\src\llvm.monorepo\build.release2\bin\filecheck.exe" "C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s"
C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv32i-aliases-invalid.s:10:21: error: CHECK: expected string not found in input
li t4, foo # CHECK: :[[@LINE]]:8: error: immediate must be an integer in the range [-21474836484294967295]
                    ^
<stdin>:5:1: note: scanning from here
li x0, -2147483649 # CHECK: :[[@LINE]]:8: error: immediate must be an integer in the range [-21474836484294967295]
^
<stdin>:5:1: note: with "@LINE" equal to "10"
li x0, -2147483649 # CHECK: :[[@LINE]]:8: error: immediate must be an integer in the range [-21474836484294967295]
^
<stdin>:5:38: note: possible intended match here
li x0, -2147483649 # CHECK: :[[@LINE]]:8: error: immediate must be an integer in the range [-21474836484294967295]
                                     ^

error: command failed with exit status: 1

--

--
********************
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70
FAIL: LLVM :: MC/RISCV/rv64i-aliases-invalid.s (24416 of 32659)
******************** TEST 'LLVM :: MC/RISCV/rv64i-aliases-invalid.s' FAILED ********************
Script:
--
: 'RUN: at line 2';   not c:\src\llvm.monorepo\build.release2\bin\llvm-mc.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s -triple=riscv64 -riscv-no-aliases 2>&1 | c:\src\llvm.monorepo\build.release2\bin\filecheck.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s
: 'RUN: at line 3';   not c:\src\llvm.monorepo\build.release2\bin\llvm-mc.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s -triple=riscv64 2>&1 | c:\src\llvm.monorepo\build.release2\bin\filecheck.exe C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s
--
Exit Code: 1

Command Output (stdout):
--
$ ":" "RUN: at line 2"
$ "not" "c:\src\llvm.monorepo\build.release2\bin\llvm-mc.exe" "C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s" "-triple=riscv64" "-riscv-no-aliases"
$ "c:\src\llvm.monorepo\build.release2\bin\filecheck.exe" "C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s"
C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s:6:21: error: CHECK: expected string not found in input
li t4, foo # CHECK: :[[@LINE]]:8: error: operand must be a constant 64-bit integer
                    ^
<stdin>:2:1: note: scanning from here
li t5, 0x10000000000000000 # CHECK: :[[@LINE]]:8: error: unknown operand
^
<stdin>:2:1: note: with "@LINE" equal to "6"
li t5, 0x10000000000000000 # CHECK: :[[@LINE]]:8: error: unknown operand
^
<stdin>:13:67: note: possible intended match here
C:\src\llvm.monorepo\llvm\test\MC\RISCV\rv64i-aliases-invalid.s:12:13: error: immediate must be an integer in the range [0, 63]
                                                                  ^

error: command failed with exit status: 1

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

5 years ago[ARM] Regenerate rotation tests
Simon Pilgrim [Mon, 29 Jul 2019 09:48:07 +0000 (09:48 +0000)]
[ARM] Regenerate rotation tests

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

5 years ago[AMDGPU] Regenerate v2i16 insertelement tests.
Simon Pilgrim [Mon, 29 Jul 2019 09:47:07 +0000 (09:47 +0000)]
[AMDGPU] Regenerate v2i16 insertelement tests.

To help show the diffs from an upcoming SimplifyDemandedBits patch.

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

5 years ago[NFC][ARM[ParallelDSP] Cleanup of BinOpChain
Sam Parker [Mon, 29 Jul 2019 08:41:51 +0000 (08:41 +0000)]
[NFC][ARM[ParallelDSP] Cleanup of BinOpChain

- Remove some unused typedefs.
- Rename BinOpChain struct to MulCandidate.
- Remove the size method of MulCandidate.
- Store only the first input of the ValueList provided to
  MulCandidate, as it's the only value we care about. This means we
  don't have to perform any ugly (and unnecessary) iterations of the
  list later on.

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

5 years ago[AMDGPU] Enable v4f16 and above for v_pk_fma instructions
David Stuttard [Mon, 29 Jul 2019 08:15:10 +0000 (08:15 +0000)]
[AMDGPU] Enable v4f16 and above for v_pk_fma instructions

Summary:
If isel is presented with <2 x half> vectors then it will correctly select
v_pk_fma style instructions.
If isel is presented with e.g. <4 x half> vectors it will scalarize, unlike for
other instruction types (such as fadd, fmul etc.)

Added extra support to enable this. Updated one of the tests to include a test
for this (as well as extending the test to GFX9)

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, llvm-commits

Tags: #llvm

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

Change-Id: I50a4577a3f8223fb53992af3b7d26121f65b71ee

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

5 years ago[NFC][ARM][ParallelDSP] Remove AreSymmetrical
Sam Parker [Mon, 29 Jul 2019 08:12:24 +0000 (08:12 +0000)]
[NFC][ARM][ParallelDSP] Remove AreSymmetrical

We explicitly search for a parallel mac and we only care about its
inputs, checking for symmetry doesn't add anything here.

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

5 years ago[NFC][ARM][ParallelDSP] Remove PopulateLoads
Sam Parker [Mon, 29 Jul 2019 08:07:23 +0000 (08:07 +0000)]
[NFC][ARM][ParallelDSP] Remove PopulateLoads

We no longer have to check what loads are used, all this
is performed at the start of the transform, so it's not
doing anything now.

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

5 years ago[obj2yaml] - Report a error when unable to resolve a sh_link reference properly.
George Rimar [Mon, 29 Jul 2019 07:58:29 +0000 (07:58 +0000)]
[obj2yaml] - Report a error when unable to resolve a sh_link reference properly.

Because of a bug we did not report a error in the case
shown in the test. With this patch we do.

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

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

5 years ago[llvm-objcopy] - Reimplement strip-dwo-groups.test to stop using the precompiled...
George Rimar [Mon, 29 Jul 2019 07:55:39 +0000 (07:55 +0000)]
[llvm-objcopy] - Reimplement strip-dwo-groups.test to stop using the precompiled object.

When llvm-copy removes .dwo sections the index of symbol table,
the indices of the symbols and the indices of the sections which go
after the removed ones changes. That affects on SHT_GROUP sections,
which needs to be updated.

Initially this test used a precompiled object, I rewrote it to use YAML
and improved a bit.

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

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

5 years ago[X86] Don't use PMADDWD for vector add reductions of multiplies if the mul inputs...
Craig Topper [Mon, 29 Jul 2019 01:36:58 +0000 (01:36 +0000)]
[X86] Don't use PMADDWD for vector add reductions of multiplies if the mul inputs have an additional user.

The pmaddwd inserts a truncate, if that truncate would end up
creating additional instructions instead of making a zext
narrower, then we shouldn't do it.

I've restricted this to only sse4.1 targets since on prior
targets the zext will be done in stages. So the truncate will
probably not create additional instructions. Might need some
more investigation of mul shrinking and the other pmaddwd
transform to be sure this is the right decision.

There might be a slight regression on AVX1 targets due to add
splitting. Hard to say for sure. Maybe we need to look into
using the vector reduction flag to use 2 narrow loads and a
blend instead of extracting and inserting.

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

5 years ago[X86] Add test cases to show missing one use check in combineLoopMAddPattern.
Craig Topper [Mon, 29 Jul 2019 01:36:54 +0000 (01:36 +0000)]
[X86] Add test cases to show missing one use check in combineLoopMAddPattern.

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

5 years ago[NFC][InstCombine] Revisit tests in shift-amount-reassociation-with-truncation-shl.ll
Roman Lebedev [Sun, 28 Jul 2019 21:31:58 +0000 (21:31 +0000)]
[NFC][InstCombine] Revisit tests in shift-amount-reassociation-with-truncation-shl.ll

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

5 years ago[X86] In combineLoopMAddPattern and combineLoopSADPattern, preserve the vector reduct...
Craig Topper [Sun, 28 Jul 2019 18:45:42 +0000 (18:45 +0000)]
[X86] In combineLoopMAddPattern and combineLoopSADPattern, preserve the vector reduction flag on the final add. Handle unrolled loops by letting DAG combine revisit.

This reverts r340478 and r340631 and replaces them with a simpler
method of just letting DAG combine revisit the nodes to handle
the other operand.

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

5 years ago[InstCombine] fold fsub+fneg with fdiv/fmul between
Sanjay Patel [Sun, 28 Jul 2019 17:10:06 +0000 (17:10 +0000)]
[InstCombine] fold fsub+fneg with fdiv/fmul between

The backend already does this via isNegatibleForFree(),
but we may want to alter the fneg IR canonicalizations
that currently exist, so we need to try harder to fold
fneg in IR to avoid regressions.

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