Commit Graph

356180 Commits

Author SHA1 Message Date
Jay Foad 9ce0f7eed6 [AMDGPU] Introduce new sched classes for transcendental instructions
This is in preparation for scheduling them slightly differently on
gfx10. NFC.

Differential Revision: https://reviews.llvm.org/D81011
2020-06-04 10:29:32 +01:00
Kazushi (Jam) Marukawa 52ed34deeb [VE] Clean SDNodeXForm stuff
Summary:
Gather definitions of SDNodeXForm and change them to call C functions
instead of copying C expressions in td files.  Doing this solved some
bugs in mimm detections.

Differential Revision: https://reviews.llvm.org/D81132
2020-06-04 11:28:24 +02:00
Georgii Rymar 2ad0ef6ef1 [llvm-readelf] - Do not try to read past the end of the file when dumping the the SHT_GNU_HASH.
We have unobvious issue in the condition that is used to check
that we do not read past the EOF.

The problem is that the result of "GnuHashTable->nbuckets * 4" expression is uint32.
Because of that it was still possible to overflow it and pass the check.

There was no such problem with the "GnuHashTable->maskwords * sizeof(typename ELFT::Off)"
condition, because of `sizeof` on the right (which gives 64-bits value on x64),
but I've added an explicit conversion to 64-bit value for `GnuHashTable->maskwords` too.

Differential revision: https://reviews.llvm.org/D81103
2020-06-04 12:00:44 +03:00
Dmitri Gribenko 06cf7adcc8 Make syntax tree test print the line number when it fails
Summary:
The syntax tree test uses a helper function that executes all testing
assertions. When an assertion fails, the only line number that gets
printed to the log refers to the helper function. After this change, we
would also get the line number of the EXPECT_TRUE macro invocation
(unfortunately, the line number of the last token of it, not the first
one, but there's not much I can do about it).

Reviewers: hlopko, eduucaldas

Reviewed By: hlopko, eduucaldas

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D81107
2020-06-04 10:42:44 +02:00
Qiu Chaofan 7a001a2d92 [PowerPC] Require nsz flag for c-a*b to FNMSUB
On PowerPC, FNMSUB (both VSX and non-VSX version) means -(a*b-c). But
the backend used to generate these instructions regardless whether nsz
flag exists or not. If a*b-c==0, such transformation changes sign of
zero.

This patch introduces PPC specific FNMSUB ISD opcode, which may help
improving combined FMA code sequence.

Reviewed By: steven.zhang

Differential Revision: https://reviews.llvm.org/D76585
2020-06-04 16:41:27 +08:00
Yevgeny Rouban dcfa78a4cc Extend InvokeInst !prof branch_weights metadata to unwind branches
Allow InvokeInst to have the second optional prof branch weight for
its unwind branch. InvokeInst is a terminator with two successors.
It might have its unwind branch taken many times. If so
the BranchProbabilityInfo unwind branch heuristic can be inaccurate.
This patch allows a higher accuracy calculated with both branch
weights set.

Changes:
 - A new section about InvokeInst is added to
   the BranchWeightMetadata page. It states the old information that
   missed in the doc and adds new about the second branch weight.
 - Verifier is changed to allow either 1 or 2 branch weights
   for InvokeInst.
 - A new test is written for BranchProbabilityInfo to demonstrate
   the main improvement of the simple fix in calcMetadataWeights().
 - Several new testcases are created for Inliner. Those check that
    both weights are accounted for invoke instruction weight
    calculation.
 - PGOUseFunc::setBranchWeights() is fixed to be applicable to
   InvokeInst.

Reviewers: davidxl, reames, xur, yamauchi
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80618
2020-06-04 15:37:15 +07:00
Raphael Isemann 2ebe30c6e4 [lldb][NFC] Address some review feedback for D80775 ('command script delete' completion)
In the similar review D81128, Jonas pointed out some style errors that also
apply to D80775 (which is already committed). Also applying the changes
suggested there to this code.
2020-06-04 10:30:27 +02:00
Jan Korous 30949926f9 Relands "[YAMLVFSWriter][Test][NFC] Add couple tests" vol. 2
This reverts commit e4e3e41905.

Fixed dangling StringRef in test.
2020-06-04 01:26:12 -07:00
Gongyu Deng 2e8f304f5e [lldb] tab completion for `command script delete'
Summary: Added the tab completion for `command script delete`.

Reviewers: teemperor, JDevlieghere

Reviewed By: teemperor

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D80775
2020-06-04 10:19:03 +02:00
Jan Korous 0c1b88ec21 [Support][NFC] Tests for root_name(), root_directory() and root_path()
It's literally just doc comments converted to unittests.
2020-06-04 01:13:35 -07:00
Yevgeny Rouban 417bcb8827 [Instruction] Remove setProfWeight()
Remove the function Instruction::setProfWeight() and make
use of Instruction::copyMetadata(.., {LLVMContext::MD_prof}).
This is correct for all use cases of setProfWeight() as it
is applied to CallBase instructions only.
This change results in prof metadata copied intact even if
the source has "VP". The old pair of calls
extractProfTotalWeight() + setProfWeight() resulted in
setting branch_weights if the source had "VP" data.

Reviewers: yamauchi, davidxl
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80987
2020-06-04 15:10:55 +07:00
Mikael Holmen 2f671c4225 [WebAssembly] Fix gcc warning [NFC]
gcc 7.4 complained with
../lib/Target/WebAssembly/WebAssemblyFixBrTableDefaults.cpp:125:23: warning: extra ';' [-Wpedantic]
                 false);
                       ^
2020-06-04 10:03:13 +02:00
Sam Parker 6f24ebc4ba [NFCI][CostModel][AMDGPU] Simplify getUserCost
Casts and intrinsics are now handled by the default implementation
of getUserCost, so remove them from the backends switch statement.

https://reviews.llvm.org/D80994
2020-06-04 08:51:28 +01:00
Jean Perier 62b127eef6 [flang] Fix IsConstantExpr for division expressions
Summary:
Fortran::evaluate::IsConstantExpr did not check that the numerator
was a constant expression. This patch fixes the issue.

Reviewers: DavidTruby, klausler, schweitz, PeteSteinfeld, jdoerfert, sscalpone

Reviewed By: klausler, PeteSteinfeld, sscalpone

Subscribers: llvm-commits

Tags: #llvm, #flang

Differential Revision: https://reviews.llvm.org/D81096
2020-06-04 09:44:44 +02:00
Kazu Hirata 347a599e5f [Inlining] Introduce -enable-npm-pgo-inline-deferral
Summary:
Experiments show that inline deferral past pre-inlining slightly
pessimizes the performance.

This patch introduces an option to control inline deferral during PGO.
The option defaults to true for now (that is, NFC).

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: eraman, hiraditya, haicheng, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80776
2020-06-04 00:40:58 -07:00
Craig Topper 7eff1a7136 [X86] Remove (V)MOVHPDrm patterns that involve bitcast+scalar_to_vec+loadi64.
I think these are left over from when we used to type legalize
v2f32 loads using bitcast+scalar_to_vec+loadi64 on 64-bit targets.
These days we use loadf64. If this becomes a problem a better
solution would be a DAG combine to turn it into scalar_to_vec+loadf64.
2020-06-04 00:31:47 -07:00
Kazushi (Jam) Marukawa 6b461ba459 [VE] Change to use EXTRACT_SUBREG instead of COPY_TO_REGCLASS
Summary:
Change to use EXTRACT_SUBREG instead of COPY_TO_REGCLASS in order to
remove unnecessary copy instructions.

Differential Revision: https://reviews.llvm.org/D81129
2020-06-04 09:05:36 +02:00
David Sherwood a3e3986be1 [SVE] Fix ubsan issues in DecodeIITType
In an earlier patch I removed the need for
IITDescriptor::ScalableVecArgument, which involved changing
DecodeIITType to pull out the last IIT_Info from the list. However,
it turns out this is unsafe and causes ubsan failures. I've tried to
fix this a different way by simply passing the last IIT_Info as an
additional argument to DecodeIITType.

Differential Revision: https://reviews.llvm.org/D81057
2020-06-04 07:58:24 +01:00
Martin Boehme 8d74de9de6 [clang] Always allow including builtin headers in [no_undeclared_headers] modules.
Previously, this would fail if the builtin headers had been "claimed" by
a different module that wraps these builtin headers. libc++ does this,
for example.

This change adds a test demonstrating this situation; the test fails
without the fix.
2020-06-04 08:33:39 +02:00
Madhur Amilkanthwar b3cff3c720 Utility to dump .dot representation of SelectionDAG without firing viewer
Summary:
This patch adds support for dumping .dot
representation of SelectionDAG. It is inspired from the fact that,
a developer may want to just dump the graph at
a predictable path with a simple name to compare.
The exisitng utility (i.e. viewGraph) are overkill
for this motive hence this patch adds the requires support
while using the core routines from GraphWriter.

Example usage: DAG.dumpDotGraph("/tmp/graph.dot", "MyGraph")
will create /tmp/graph.dot file when DAG is an
object of SelectionDAG class.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D80711
2020-06-04 11:51:48 +05:30
Siva Chandra Reddy b28167928d [libc][NFC] Add ceil[f], floor[f] and trunc[f] to the spec and config files. 2020-06-03 22:39:34 -07:00
Fangrui Song 1a2d4bf34e [gcov] Don't error 'unexpected end of memory buffe' 2020-06-03 22:05:15 -07:00
Fangrui Song 904b971aac [gcov] Make `Creating 'filename'` compatible with gcov
And clean up llvm-cov.test a bit
2020-06-03 21:48:01 -07:00
Philip Reames ab6779bbd8 [Statepoint] Remove last of old ImmutableStatepoint code
To do so, I had to sink the old school inline operand handling into GCStatepointInst which is non ideal.  This code should be removed shortly and I was able to at least clean it up a bunch.
2020-06-03 20:31:17 -07:00
Philip Reames 91dd2f2536 [Statepoint] Delete more dead code from old wrappers
The verify() routine duplicates IR/Verifier.cpp checks, so while not technically dead it doesn't add any value either.
2020-06-03 20:10:30 -07:00
Philip Reames b9983c18fc [Statepoint] Start the process of removing old interfaces
We introduced the GCStatepointInst class and have migrated almost all users of Statepoint/ImmutableStatepoint to the new API.  Given downstream consumers have had a week to migrate, remove code which is now dead.
2020-06-03 20:00:52 -07:00
Eric Christopher 8c9badf61d Replace integer usage with enumeration. 2020-06-03 20:00:28 -07:00
Fangrui Song c1ea672ddb [gcov] Delete XFAIL: host-byteorder-big-endian
Add two to function-numbering.ll and exit-block.ll
2020-06-03 19:58:28 -07:00
Fangrui Song 01899bb4e4 [gcov] Improve .gcno compatibility with gcov and use DataExtractor
llvm-cov.test and many Inputs/test* files contain wrong tests.
This patch rewrites a large portion of these files.
The pre-canned .gcno & .gcda are replaced by binaries produced by
clang --coverage (compatible with gcov 4.8~7)
(after some GCDAProfiling.c bugs were fixed by my previous commits).

Also make llvm-cov gcov on a little-endian host capable to parse big-endian .gcno and .gcda,
and make llvm-cov gcov on big-endian host capable to parse little-endian .gcno and .gcda
2020-06-03 19:29:21 -07:00
Yaxun (Sam) Liu 049d860707 [CUDA][HIP] Fix constexpr variables for C++17
constexpr variables are compile time constants and implicitly const, therefore
they are safe to emit on both device and host side. Besides, in many cases
they are intended for both device and host, therefore it makes sense
to emit them on both device and host sides if necessary.

In most cases constexpr variables are used as rvalue and the variables
themselves do not need to be emitted. However if their address is taken,
then they need to be emitted.

For C++14, clang is able to handle that since clang emits them with
available_externally linkage together with the initializer.

However for C++17, the constexpr static data member of a class or template class
become inline variables implicitly. Therefore they become definitions with
linkonce_odr or weak_odr linkages. As such, they can not have available_externally
linkage.

This patch fixes that by adding implicit constant attribute to
file scope constexpr variables and constexpr static data members
in device compilation.

Differential Revision: https://reviews.llvm.org/D79237
2020-06-03 21:56:52 -04:00
Xing GUO b6020c330d [ObjectYAML][ELF] Let the endianness of DWARF sections be inferred from FileHeader.
This patch helps infer the endianness of DWARF sections from `FileHeader`.

Reviewed By: jhenderson, grimar

Differential Revision: https://reviews.llvm.org/D81051
2020-06-04 09:26:05 +08:00
Xing GUO a50f4eb2e9 [ObjectYAML][DWARF] Support emitting the .debug_aranges section in ELFYAML.
This patch enables yaml2obj to emit the .debug_aranges section in ELFYAML.

Known issues:
- The current implementation of `debug_aranges` doesn't support emitting `segment` in the `(segment, address, length)` tuple. I will fix it in a follow-up patch.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D80972
2020-06-04 08:56:00 +08:00
Julian Lettner e9f556526e [Darwin] Add tests for OS version checking
Extract ParseVersion helper function for testing.

Reviewed By: delcypher

Differential Revision: https://reviews.llvm.org/D80761
2020-06-03 17:51:23 -07:00
Matt Arsenault ed5017e153 GlobalISel: Start defining strict FP instructions
The AMDGPU lowering for unconstrained G_FDIV sometimes needs to
introduce a mode switch in the middle, so it's helpful to have
constrained instructions available to legalize this. Right now nothing
is preventing reordering of the mode switch with the other
instructions in the expansion.
2020-06-03 20:46:37 -04:00
Quentin Colombet ccb3c8e861 [RegisterCoalescer] Update empty subranges when rematerializing
When we rematerialize a value as part of the coalescing, we may
widen the register class of the destination register.
When this happens, updateRegDefUses may create additional subranges
to account for the wider register class.
The created subranges are empty and if they are not defined by
the rematerialized instruction we clean them up.
However, if they are defined by the rematerialized instruction but
unused, we failed to flag them as dead definition and would leave
them as empty live-range.
This is wrong because empty live-ranges don't interfere with anything,
thus if we don't fix them, we would fail to account that the
rematerialized instruction clobbers some lanes.

E.g., let us consider the following pseudo code:
def.lane_low64:reg128 = ldimm
newdef:reg32 = COPY def.lane_low64_low32

When rematerialization happens for newdef, we end up with:
newdef.lane_low64:reg128 = ldimm
 = use newdef.lane_low64_low32

Let's look at the live interval of newdef.
Before rematerialization, we would get:
newdef [defIdx, useIdx:0) 0@defIdx

Right after updateRegDefUses, newdef register class is widen to reg128
and the subrange definitions will be augmented to fill the subreg that
is used at the definition point, here lane_low64.
The resulting live interval would be:
newdef [newDefIdx, useIdx:0) 0@newDefIdx
 * lane_low64_high32 EMPTY
 * lane_low64_low32 [newDefIdx, useIdx:0)

Before this patch this would be the final status of the live interval.
Therefore we miss that lane_low64_high32 is actually live on the
definition point of newdef.

With this patch, after rematerializing, we check all the added subranges
and for the ones that are defined but empty, we flag them as dead def.
Thus, in that case, newdef would look like this:
newdef [newDefIdx, useIdx:0) 0@newDefIdx
 * lane_low64_high32 [newDefIdx, newDefIdxDead) ; <-- instead of EMPTY
 * lane_low64_low32 [newDefIdx, useIdx:0)

This fixes https://www.llvm.org/PR46154
2020-06-03 17:10:55 -07:00
Julian Lettner eb9ca9da3e Make linter happy
Fixup for ba6b1b4353.
2020-06-03 17:00:33 -07:00
Eric Christopher 21a7b8a77d consitfy and auto -> auto * a few places to clean up uses. 2020-06-03 17:00:08 -07:00
Matt Arsenault 9cdc27ffac AArch64/GlobalISel: Fix assert on call returning 0 sized type
I don't know why this is considered valid IR, but it probably should
not be.
2020-06-03 19:56:07 -04:00
Matt Arsenault a1a93ca48a AMDGPU/GlobalISel: Handle uniform G_DYN_STACKALLOC 2020-06-03 19:56:07 -04:00
Matt Arsenault 3866e0a563 GlobalISel: Fail expansion of G_DYN_STACKALLOC for StackGrowsUp 2020-06-03 19:56:07 -04:00
Saleem Abdulrasool 116e38fd8b lld: add basic static library search
This is a very basic static library search addition. This is the pre-Xcode4
behaviour of searching all paths for the shared version before searching for
the static version of the library. This behaviour is supposed to be inverted
with `-search_paths_first` being the default. This adds the library search
with the intention of providing the setup to merge the paths into one path
and making it controllable by `OPT_search_paths_first`.
2020-06-03 23:32:05 +00:00
Vitaly Buka 291dabefde [StackSafety,NFC] Add statistic counters 2020-06-03 16:12:08 -07:00
Vitaly Buka 5477cf06d6 Fix "Statistics are disabled"
There is no -DLLVM_ENABLE_STATS, only
-DLLVM_FORCE_ENABLE_STATS.
It was renamed by 6cf299cf01
2020-06-03 16:10:09 -07:00
Eric Christopher 053fce9a02 Fix typo in filename comment. 2020-06-03 16:01:36 -07:00
Philip Reames 382b3023cb [Statepoints][CGP] Minor parameter type cleanup 2020-06-03 16:00:38 -07:00
Jessica Paquette 06ae439110 [AArch64][NFC] Regenerate arm64-rev.ll
Test had some GISel stuff in it which was changed by 969d2d1ea9.
2020-06-03 15:49:51 -07:00
Thomas Lively 25af2126f9 [WebAssembly] Fix ISel crash in SIGN_EXTEND_INREG lowering
Summary:
The code previously assumed that the index of a vector extract was
constant, but this was not always true. This patch fixes the problem
by bailing out of the lowering if the index is nonconstant and also
replaces `static_cast`s in the lowering function with `cast`s because
the latter contain type-checking asserts that would make similar
issues easier to find and debug.

Reviewers: aheejin

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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81025
2020-06-03 15:36:44 -07:00
Jessica Paquette 969d2d1ea9 [AArch64][GlobalISel] Add selection support for rev16, rev32, and rev64
This does three things:

1) Adds G_REV16, G_REV32, and G_REV64. These are equivalent to AArch64rev16,
   AArch64rev32, and AArch64rev64 respectively.

2) Adds support for producing G_REV64 in the postlegalizer combiner.
   We don't legalize any of the shuffles which could give us a G_REV32 or
   G_REV16 yet. Since the function for detecting the rev mask is lifted from
   AArch64ISelLowering, it should work for G_REV32 and G_REV16 when we get
   there.

3) Adds a selection test for a good portion of the patterns imported for the rev
   family. The only ones which are not tested are the ones with bitconvert.

This also does a little cleanup, and adds a struct for shuffle vector pseudo
matchdata. This lets us still use `applyShuffleVectorPseudo` rather than adding
a new function.

It should also make it a bit easier to port some of the other masks from
AArch64ISelLowering. (e.g. `isZIP_v_undef_Mask` and friends)

Differential Revision: https://reviews.llvm.org/D81112
2020-06-03 15:30:30 -07:00
Julian Lettner cab4b3b8e3 Fix bug in newly added VersionBase::operator>=
Fixup for ba6b1b4353.
2020-06-03 15:26:36 -07:00
Philip Reames ff529e0f27 [Statepoint] Fix signed vs unsigned in index handling
As noted in a comment on D80937, all of these are specified as unsigned values, but the verifier code was using signed.  Given the practical values involved, the different in range didn't matter, but we might as well clean it up.
2020-06-03 15:10:20 -07:00