Commit Graph

203111 Commits

Author SHA1 Message Date
Simon Pilgrim
660c64fada [X86] Make lowerShuffleAsLanePermuteAndPermute use sublanes on AVX2
Extends lowerShuffleAsLanePermuteAndPermute to search for opportunities to use vpermq (64-bit cross-lane shuffle) and vpermd (32-bit cross-lane shuffle) to get elements into the correct lane, in addition to the 128-bit full-lane permutes it previously searched for.

This is especially helpful in cross-lane byte shuffles, where the alternative tends to be "vpshufb both lanes separately and blend them with a vpblendvb", which is very expensive, especially on Haswell where vpblendvb uses the same execution port as all the shuffles.

Addresses PR47262

Patch By: @TellowKrinkle (TellowKrinkle)

Differential Revision: https://reviews.llvm.org/D86429
2020-09-04 11:41:26 +01:00
David Green
2d71376420 [ARM] Fold predicate_cast(load) into vldr p0
This adds a simple tablegen pattern for folding predicate_cast(load)
into vldr p0, providing the alignment and offset are correct.

Differential Revision: https://reviews.llvm.org/D86702
2020-09-04 11:29:59 +01:00
Georgii Rymar
6dae2e3dea [llvm-readelf/obj] - Use RelSymbol<ELFT> instead of std::pair. NFCI.
We have the `RelSymbol<ELFT>` struct and can use it instead
of `std::pair<const Elf_Sym *, std::string>` in a few methods.
This is a bit cleaner.

Differential revision: https://reviews.llvm.org/D87092
2020-09-04 13:18:11 +03:00
Simon Pilgrim
8b766631fa MIRFormatter.h - remove MachineInstr.h include. NFC.
Use forward declarations and include the inner dependencies directly.
2020-09-04 11:17:24 +01:00
Georgii Rymar
eb861517a5 [llvm-readobj/elf] - Refine signature of print*Reloc methods.
This makes the interface cleaner and slightly improves messages
reported.

Differential revision: https://reviews.llvm.org/D87086
2020-09-04 12:53:29 +03:00
David Sherwood
4a83ce1e3c [SVE][CodeGen] Fix up warnings in sve-split-insert/extract tests
I have fixed up some more ElementCount/TypeSize related warnings in
the following tests:

  CodeGen/AArch64/sve-split-extract-elt.ll
  CodeGen/AArch64/sve-split-insert-elt.ll

In SelectionDAG::CreateStackTemporary we were relying upon the implicit
cast from TypeSize -> uint64_t when calling MachineFrameInfo::CreateStackObject.
I've fixed this by passing in the known minimum size instead, which I
believe is fine because the associated stack id indicates whether this
is a scalable object or not.

I've also fixed up a case in TargetLowering::SimplifyDemandedBits when
extracting a vector element from a scalable vector. The result is a scalar,
hence it wasn't caught at the start of the function. If the vector is
scalable we just bail out for now.

Differential Revision: https://reviews.llvm.org/D86431
2020-09-04 09:51:31 +01:00
Florian Hahn
587c7dcbfd [DSE] Remove some dead code from DSE tests.
Some tests depend on DSE removing dead instructions unrelated to any
memory optimization. That's not really DSE's job, remove it.
2020-09-04 09:39:40 +01:00
Florian Hahn
ce6e59900a [MemCpyOpt] Preserve MemorySSA.
This patch updates MemCpyOpt to preserve MemorySSA. It uses the
MemoryDef at the insertion point of the builder and inserts the new def
after that def.

In some cases, we just modify a memory instruction. In that case, get
the defining access, then remove the memory access and add a new one.
If the defining access is in a different block, insert a new def at the
beginning of the current block, otherwise after the defining access.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D86651
2020-09-04 09:05:33 +01:00
Fangrui Song
7b5b3c5b86 [SmallVector] Include stdexcept if LLVM_ENABLE_EXCEPTIONS
std::length_error needs stdexcept.
2020-09-03 18:06:08 -07:00
Matt Arsenault
83942f0eab AMDGPU: Remove code to handle tied si_else operands
This has not used tied operands for a long time.
2020-09-03 19:46:05 -04:00
Craig Topper
d55bdce789 [X86] Update stale comment. NFC
The optimization in ExpandIntOp_UINT_TO_FP was removed in D72728
in January 2020.
2020-09-03 16:19:10 -07:00
Michael Liao
414ef02710 [codegen] Ensure target flags are cleared/set properly. NFC.
- When an operand is changed into an immediate value or like, ensure their
  target flags being cleared or set properly.

Differential Revision: https://reviews.llvm.org/D87109
2020-09-03 18:37:39 -04:00
Fangrui Song
25dfeb3f99 [llvm-symbolizer] Add back --use-symbol-table=true
It is used by clusterfuzz (https://github.com/google/clusterfuzz/pull/2009/)
and having this compatibility option for a while can help they do bisection
with the latest llvm-symbolizer.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D87067
2020-09-03 14:27:06 -07:00
LLVM GN Syncbot
78fb117bf9 [gn build] Port 7fff1fbd3ce 2020-09-03 20:13:38 +00:00
Puyan Lotfi
de3532220a [MIRVRegNamer] Experimental MachineInstr stable hashing (Fowler-Noll-Vo)
This hashing scheme has been useful out of tree, and I want to start
experimenting with it. Specifically I want to experiment on the
MIRVRegNamer, MIRCanononicalizer, and eventually the MachineOutliner.

This diff is a first step, that optionally brings stable hashing to the
MIRVRegNamer (and as a result, the MIRCanonicalizer).  We've tested this
hashing scheme on a lot of MachineOperand types that llvm::hash_value
can not handle in a stable manner.

This stable hashing was also the basis for

"Global Machine Outliner for ThinLTO" in EuroLLVM 2020

http://llvm.org/devmtg/2020-04/talks.html#TechTalk_58

Credits: Kyungwoo Lee, Nikolai Tillmann

Differential Revision: https://reviews.llvm.org/D86952
2020-09-03 16:13:09 -04:00
Arthur Eubanks
9f8be8e69b [NewPM][Lint] Port -lint to NewPM
This also changes -lint from an analysis to a pass. It's similar to
-verify, and that is a normal pass, and lives in llvm/IR.

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D87057
2020-09-03 13:03:44 -07:00
Bryan Chan
c65dfd8c46 Replace CRLF with LF; NFC 2020-09-03 15:30:08 -04:00
Wenlei He
9ba54f747b SVML support for log2
Although LLVM supports vectorization of loops containing log2, it did not support using SVML implementation of it. Added support so that when clang is invoked with -fveclib=SVML now an appropriate SVML library log2 implementation will be invoked.

Follow up on: https://reviews.llvm.org/D77114

Tests:
Added unit tests to svml-calls.ll, svml-calls-finite.ll. Can be run with llvm-lint.
Created a simple c++ file that tests log2, and used clang+ to build it, and output final assembly.

Reviewed By: wenlei, craig.topper

Differential Revision: https://reviews.llvm.org/D86730
2020-09-03 11:52:29 -07:00
Jamie Schmeiser
b707c16b9c Revert "Add new hidden option -print-changed which only reports changes to IR"
This reverts commit 7bc9924cb2fbd9f3ae53577607822ace267a04e6 due to
failure caused by missing a space between trailing >>, required by some
versions of C++:wq.
2020-09-03 18:41:20 +00:00
Amy Huang
63a262cd97 [DebugInfo] Make DWARF ignore sizes on forward declared class types.
Make sure the sizes for forward declared classes aren't emitted in
DWARF.

This comes before https://reviews.llvm.org/D87062, which adds sizes to
all classes with definitions.

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

Differential Revision: https://reviews.llvm.org/D87070
2020-09-03 11:01:49 -07:00
Simon Pilgrim
6f6a13c34a SelectionDAG.h - remove unnecessary FunctionLoweringInfo.h include. NFCI.
Use forward declarations and move the include down to dependent files that actually use it.

This also exposes a number of implicit dependencies on KnownBits.h
2020-09-03 18:33:25 +01:00
David Green
1eb2adee6c [ARM] Extra predicate load tests. NFC 2020-09-03 17:52:37 +01:00
Simon Pilgrim
be8dc8c2bc WebAssemblyUtilities.h - reduce unnecessary includes to forward declarations. NFCI. 2020-09-03 17:43:35 +01:00
Simon Pilgrim
1e90a5257c PHIEliminationUtils.cpp - remove unnecessary MachineBasicBlock.h include. NFCI.
This is already included in PHIEliminationUtils.h
2020-09-03 17:43:34 +01:00
Simon Pilgrim
ef97cc5632 Fix Wdocumentation trailing comments warnings. NFCI. 2020-09-03 17:43:34 +01:00
Simon Pilgrim
7b5b71b340 Fix Wdocumentation warning. NFCI.
Remove \returns tag from a void function
2020-09-03 17:43:34 +01:00
Sanjay Patel
421259677f [InstCombine] canonicalize all commutative intrinsics with constant arg 2020-09-03 12:42:04 -04:00
Sanjay Patel
f122d1d01f [InstCombine] add tests for commutative intrinsics; NFC 2020-09-03 12:42:04 -04:00
Dimitry Andric
79876868be Eliminate the sizing template parameter N from CoalescingBitVector
Since the parameter is not used anywhere, and the default size of 16
apparently causes PR47359, remove it. This ensures that IntervalMap will
automatically determine the optimal size, using its NodeSizer struct.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D87044
2020-09-03 18:15:41 +02:00
Jamie Schmeiser
60c5153584 Add new hidden option -print-changed which only reports changes to IR
A new hidden option -print-changed is added along with code to support
printing the IR as it passes through the opt pipeline in the new pass
manager. Only those passes that change the IR are reported, with others
only having the banner reported, indicating that they did not change the
IR, were filtered out or ignored. Filtering of output via the
-filter-print-funcs is supported and a new supporting hidden option
-filter-passes is added. The latter takes a comma separated list of pass
names and filters the output to only show those passes in the list that
change the IR. The output can also be modified via the -print-module-scope
function.

The code introduces a template base class that generalizes the comparison
of IRs that takes an IR representation as template parameter. The
constructor takes a series of lambdas that provide an event based API
for generalized reporting of IRs as they are changed in the opt pipeline
through the new pass manager.

The first of several instantiations is provided that prints the IR
in a form similar to that produced by -print-after-all with the above
mentioned filtering capabilities. This version, and the others to
follow will be introduced at the upcoming developer's conference.
See https://hotcrp.llvm.org/usllvm2020/paper/29 for more information.

Reviewed By: yrouban (Yevgeny Rouban)

Differential Revision: https://reviews.llvm.org/D86360
2020-09-03 15:52:35 +00:00
JF Bastien
5da192d70b Step down from security group
Propose Ahmed as a replacement. He's fixed many security issues in LLVM for Apple in the last few years, as such he'll fit the "Individual contributors" description.

Differential Revision: https://reviews.llvm.org/D86742
2020-09-03 08:44:27 -07:00
Simon Pilgrim
2fae2eeab3 GlobalISel/Utils.h - remove unused includes. NFCI.
Twine is unused, and TargetLowering can be reduced to a forward declaration and moved to Utils.cpp
2020-09-03 15:59:12 +01:00
Simon Pilgrim
68ee51d4af X86/X86TargetObjectFile.cpp - remove unused headers. NFCI. 2020-09-03 15:17:44 +01:00
Simon Pilgrim
daa72b752e Fix spelling mistake. NFC. 2020-09-03 15:17:44 +01:00
Sanjay Patel
80dc8a6aaa [IR][GVN] add/allow commutative intrinsics with >2 args
Follow-up to D86798 and rGe25449f.
2020-09-03 10:14:53 -04:00
Sanjay Patel
97f39fdd17 [GVN] add tests for >2 arg commutable intrinsics; NFC 2020-09-03 10:14:52 -04:00
Simon Pilgrim
c930434d89 LowerEmuTLS.cpp - remove unused TargetLowering.h include. NFC.
We only needed llvm/IR/Constants.h.
2020-09-03 14:40:09 +01:00
Simon Pilgrim
3eb0540946 [X86] Avoid llvm-qualified-auto warning by not using auto. NFC.
Try to consistently use the actual type name in the file.
2020-09-03 14:21:17 +01:00
Simon Pilgrim
6b5f070c8c [X86] Fix llvm-qualified-auto warning by using auto*. NFC. 2020-09-03 14:21:17 +01:00
Simon Pilgrim
caf5291b3a [X86] Fix llvm-qualified-auto warning by using const auto*. NFC. 2020-09-03 14:21:17 +01:00
Sanjay Patel
63cee4c52d [EarlyCSE] add tests for fma/fmuladd; NFC 2020-09-03 09:11:54 -04:00
Florian Hahn
402961396d [PassManager] Move load/store motion pass after DSE in LTO pipeline.
As far as I am aware, the placement of MergedLoadStoreMotion in the
pipeline is not heavily tuned currently. It seems to not matter much if
we do it after DSE in the LTO pipeline (no binary changes for -O3 -flto
on MultiSource/SPEC2000/SPEC2006). Moving it after DSE however has a
major benefit: MemorySSA is constructed by LICM and is consumed by DSE,
so if MergedLoadStoreMotion happens after DSE, we do not need to
preserve MemorySSA in it.

If there are any concerns with this move, I can also update
MergedLoadStoreMotion to preserve MemorySSA.

This patch together with D86651 (preserve MemSSA in MemCpyOpt) and
D86534 (preserve MemSSA in GVN) are the remaining patches to bring down
compile-time for DSE + MemorySSA to the levels outlined in
http://lists.llvm.org/pipermail/llvm-dev/2020-August/144417.html

Once they land, we should be able to start with flipping the switch on
enabling DSE + MmeorySSA.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D86967
2020-09-03 13:47:50 +01:00
Simon Pilgrim
130df564ec [X86][SSE] Fold select(X > -1, A, B) -> select(0 > X, B, A) (PR47404)
Help PBLENDVB peek through to the sign bit source of the selection mask by swapping the select condition and inputs.
2020-09-03 13:02:08 +01:00
Ben Shi
608af302ca [NFC][RISCV] Simplify pass arg of RISCVMergeBaseOffsetOpt
Reviewed By: lenary, asb

Differential Revision: https://reviews.llvm.org/D87069
2020-09-03 20:01:23 +08:00
Max Kazantsev
247b72ded4 [Test] Add test showing some simple cases that IndVarSimplify does not cover 2020-09-03 18:35:26 +07:00
Florian Hahn
dc272f692f [GVN] Preserve MemorySSA if it is available.
Preserve MemorySSA if it is available before running GVN.

DSE with MemorySSA will run closely after GVN. If GVN and 2 other
passes preserve MemorySSA, DSE can re-use MemorySSA used by LICM
when doing LTO.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D86534
2020-09-03 12:28:13 +01:00
Simon Pilgrim
f989621aaf [X86][SSE] Add PR47404 test case 2020-09-03 12:06:19 +01:00
Simon Pilgrim
eb4c00bbbd [X86][AVX] Test SSE41 BLENDV combines on AVX targets as well
Show up any differences due to SSE41 variant being locked to use xmm0
2020-09-03 12:06:19 +01:00
David Green
eaf32d18ab [MemCpyOptimizer] Change required analysis order for BasicAA/PhiValuesAnalysis
This is a followup to 1ccfb52a61748, which made a number of changes
including the apparently innocuous reordering of required passes in
MemCpyOptimizer. This however altered the creation order of BasicAA vs
Phi Values analysis, meaning BasicAA did not pick up PhiValues as a
cached result. Instead if we require MemoryDependence first it will
require PhiValuesAnalysis allowing BasicAA to use it for better results.

I don't claim this is an excellent design, but it fixes a nasty little
regressions where a query later in JumpThreading was getting worse
results.

Differential Revision: https://reviews.llvm.org/D87027
2020-09-03 12:01:51 +01:00
Stefan Pintilie
1ae7d50edf [PowerPC] Fix missing TLS symbol type.
Previous implementations for the TLS models General Dynamic and Initial Exec
were missing the ELF::STT_TLS type on symbols that required the type. This patch
adds the type.

Reviewed By: sfertile, MaskRay

Differential Revision: https://reviews.llvm.org/D86777
2020-09-03 05:57:04 -05:00