Craig Topper [Tue, 28 Jul 2020 17:46:04 +0000 (10:46 -0700)]
[X86] Simplify some code in emitMemModRMByte. NFCI
Craig Topper [Tue, 28 Jul 2020 16:53:42 +0000 (09:53 -0700)]
[X86] Merge disp8 and cdisp8 handling into a single helper function to reduce some code.
We currently handle EVEX and non-EVEX separately in two places. By sinking the EVEX
check into the existing helper for CDisp8 we can simplify these two places.
Differential Revision: https://reviews.llvm.org/D84730
Yitzhak Mandelbaum [Tue, 28 Jul 2020 17:26:12 +0000 (17:26 +0000)]
[libTooling] Add a `between` range-selector combinator.
Adds the `between` combinator and registers it with the parser. As a driveby, updates some deprecated names to their current versions.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D84315
Juneyoung Lee [Tue, 28 Jul 2020 17:16:34 +0000 (02:16 +0900)]
[JumpThreading] Add tests that have a cast of freeze and vice versa
Nicolas Vasilache [Tue, 28 Jul 2020 13:58:44 +0000 (09:58 -0400)]
[mlir][Vector] Drop declarative transforms
For the purpose of vector transforms, the Tablegen-based infra is subsumed by simple C++ pattern application. Deprecate declarative transforms whose complexity does not pay for itself.
Differential Revision: https://reviews.llvm.org/D84753
Louis Dionne [Tue, 28 Jul 2020 17:09:32 +0000 (13:09 -0400)]
NFC: Add whitespace changing revisions to .git-blame-ignore-revs
Jez Ng [Tue, 28 Jul 2020 16:56:55 +0000 (09:56 -0700)]
[lld-macho] Fix segment filesize calculation
The previous approach of adding up the file sizes of the
component sections ignored the fact that the sections did not have to be
contiguous in the file. As such, it was underestimating the true size.
I discovered this issue because `codesign` checks whether `__LINKEDIT`
extends to the end of the file. Since we were underestimating segment
sizes, this check failed.
Reviewed By: #lld-macho, compnerd
Differential Revision: https://reviews.llvm.org/D84574
Jez Ng [Tue, 28 Jul 2020 16:56:50 +0000 (09:56 -0700)]
[lld-macho] Support -filelist
XCode passes files in using this flag
Reviewed By: #lld-macho, compnerd
Differential Revision: https://reviews.llvm.org/D84486
Vince Bridgers [Thu, 16 Jul 2020 22:46:48 +0000 (17:46 -0500)]
[ASTImporter] Add Visitor for TypedefNameDecl's
We found a case where Typedef Name Declarations were not being added
correctly when importing builtin types. This exposed the need for a
TypedefNameDecl visitor so these types can be added by RecordDecl and
fields.
This code is covered by the ASTImporterTest cases that use the implicit
struct __NSConstantString_tag definitions.
Thanks to @martong for the debugging assist!
Depends on D83970.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D83992
Julian Lettner [Tue, 28 Jul 2020 16:44:02 +0000 (09:44 -0700)]
[Darwin] Cleanup code via improved GetMacosAlignedVersion()
Checking the OS version via `GetMacosAlignedVersion()` now works in
simulators [1]. Let's use it to simplify `DyldNeedsEnvVariable()`.
[1]
3fb0de820796cc6e322c8378713d375d9870a353
Reviewed By: delcypher
Differential Revision: https://reviews.llvm.org/D81197
Christy Lee [Tue, 28 Jul 2020 16:41:27 +0000 (09:41 -0700)]
[ELF] --reproduce should include lto sample profile
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D84569
Anna Welker [Tue, 28 Jul 2020 16:28:19 +0000 (17:28 +0100)]
[ARM][MVE] Teach MVEGatherScatterLowering to merge successive getelementpointers
A patch following up on the introduction of pointer induction variables, adding
a preprocessing step to the address optimisation in the MVEGatherScatterLowering
pass. If the getelementpointer that is the address is itself using a
getelementpointer as base, they will be merged into one by summing up the
offsets, after checking that this will not cause an overflow (this can be
repeated recursively).
Differential Revision: https://reviews.llvm.org/D84027
Julian Lettner [Fri, 24 Jul 2020 18:24:34 +0000 (11:24 -0700)]
[Darwin] Fix OS version checks inside simulators
compiler-rt checks OS versions by querying the Darwin kernel version.
This is not necessarily correct inside the simulators if the simulator
runtime is not aligned with the host macOS. Let's instead check the
`SIMULATOR_RUNTIME_VERSION` env var.
rdar://
63031937
Reviewed By: delcypher
Differential Revision: https://reviews.llvm.org/D83977
Arthur Eubanks [Thu, 23 Jul 2020 21:17:37 +0000 (14:17 -0700)]
[CompilerRT] Don't pass global compile test flags in non-standalone build
In a build with -DLLVM_ENABLE_LTO=Thin:
$ ninja TSanitizer-x86_64-Test-Nolibc
[1/1] Generating Sanitizer-x86_64-Test-Nolibc
FAILED: projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-x86_64-Test-Nolibc
sanitizer_nolibc_test_main.x86_64.o: file not recognized: file format not recognized
because -flto=thin is getting passed to the clang_compile step.
For non-standalone builds, global compilation flags shouldn't be passed to compiler-rt tests, only the flags the test specifies.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D84466
Wei Wang [Tue, 28 Jul 2020 16:12:31 +0000 (09:12 -0700)]
[FIX] Resolve test failure in polly/test/ScopInfo/memcpy-raw-source.ll
scoped-noalias -> scoped-noalias-aa
reference: https://reviews.llvm.org/D84542
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D84720
Arthur Eubanks [Mon, 27 Jul 2020 18:31:34 +0000 (11:31 -0700)]
[NewPM][Sancov] Pin RUN lines with -sancov to legacy PM
Since the NPM pass is named sancov-module, not sancov.
This makes all tests under Instrumentation/SanitizerCoverage pass when
-enable-new-pm is on by default.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D84687
Arthur Eubanks [Tue, 28 Jul 2020 16:08:08 +0000 (09:08 -0700)]
[FunctionAttrs] Rename functionattrs -> function-attrs
To match NewPM pass name, and also for readability.
Also rename rpo-functionattrs -> rpo-function-attrs while we're here.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D84694
Jon Roelofs [Mon, 27 Jul 2020 18:34:36 +0000 (12:34 -0600)]
[OldPM] Print out a bit more when passes lie about changing IR
https://reviews.llvm.org/D84686
Matt Arsenault [Sat, 25 Jul 2020 20:58:15 +0000 (16:58 -0400)]
GlobalISel: Translate llvm.convert.{to|from}.fp16 intrinsics
I think these were added as a workaround for SelectionDAG lacking half
legalization support in the past. I think they should probably be
removed from the IR, but clang does still have a target control to
emit these instead of the native half fpext/fptrunc.
Matt Arsenault [Sun, 26 Jul 2020 14:52:51 +0000 (10:52 -0400)]
AMDGPU/GlobalISel: Mark GlobalISel classes as final
Matt Arsenault [Sun, 26 Jul 2020 16:20:29 +0000 (12:20 -0400)]
AMDGPU/GlobalISel: Merge identical select cases
Frederik Gossen [Tue, 28 Jul 2020 15:39:49 +0000 (15:39 +0000)]
[MLIR][Shape] Lower `shape.const_shape` to `tensor_from_elements`
Differential Revision: https://reviews.llvm.org/D82848
Matt Arsenault [Sun, 12 Jul 2020 18:16:36 +0000 (14:16 -0400)]
AMDGPU/GlobalISel: Use clamp modifier for [us]addsat/[us]subsat
We also have never handled this for SelectionDAG, which needs
additional work.
Florian Hahn [Sun, 12 Jul 2020 22:05:43 +0000 (23:05 +0100)]
[SCEV] Add additional tests.
Increase test coverage for upcoming changes to how SCEV deals with LCSSA
phis.
Camille Coti [Mon, 27 Jul 2020 22:58:39 +0000 (16:58 -0600)]
Order of libraries and source files in the f18 frontend
When the f18 frontend calls the link editor, put the libraries and object files in the correct order.
Fixes the issues reported here https://github.com/flang-compiler/flang/issues/897
Reviewed By: sscalpone, AlexisPerry
Differential Revision: https://reviews.llvm.org/D84340
Xing GUO [Tue, 28 Jul 2020 14:20:10 +0000 (22:20 +0800)]
[DWARFYAML] Rename checkListEntryOperands() to checkOperandCount(). NFC.
This patch renames checkListEntryOperands() to checkOperandCount(), so
that we are able to check DWARF expression operands using the same
function.
Reviewed By: jhenderson, labath
Differential Revision: https://reviews.llvm.org/D84624
Sander de Smalen [Tue, 28 Jul 2020 11:11:09 +0000 (12:11 +0100)]
[AArch64][SVE] Fix epilogue for SVE when the stack is realigned.
While deallocating the stackframe, the offset used to reload the
callee-saved registers was not pointing to the SVE callee-saves,
but rather to the whole SVE area.
+--------------+
| GRP callee |
| saves |
+--------------+ <- FP
| SVE callee |
| saves |
+--------------+ <- Should restore SVE callee saves from here
| SVE Spills |
| and Locals |
+--------------+ <- instead of from here.
| |
: :
| |
+--------------+ <- SP
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D84539
Sander de Smalen [Mon, 27 Jul 2020 13:16:55 +0000 (14:16 +0100)]
[AArch64][SVE] Don't align the last SVE callee save.
Instead of aligning the last callee-saved-register slot to the stack
alignment (16 bytes), just align the SVE callee-saved block. This also
simplifies the code that allocates space for the callee-saves.
This change is needed to make sure the offset to which the callee-saved
register is spilled, corresponds to the offset used for e.g. unwind call
frame instructions.
Reviewers: efriedma, paulwalker-arm, david-arm, rengolin
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D84042
Sander de Smalen [Mon, 27 Jul 2020 11:57:41 +0000 (12:57 +0100)]
[AArch64][SVE] Don't support fixedStack for SVE objects.
Fixed stack objects are preallocated and defined to be allocated before
any of the regular stack objects. These are normally used to model stack
arguments.
The AAPCS does not support passing SVE registers on the stack by value
(only by reference). The current layout also doesn't place them before
all stack objects, but rather before all SVE objects. Removing this
simplifies the code that emits the allocation/deallocation
around callee-saved registers (D84042).
This patch also removes all uses of fixedStack from from
framelayout-sve.mir, where this was used purely for testing purposes.
Reviewers: paulwalker-arm, efriedma, rengolin
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D84538
Bruno Ricci [Tue, 28 Jul 2020 14:39:17 +0000 (15:39 +0100)]
[clang][NFC] Add some documentation about the use of NamedDecl::getDeclName in diagnostics.
As explained in
eb10b065f2a870b425dcc2040b9955e0eee464b4, sending a NamedDecl*
in a diagnostic should generally be preferred over sending the DeclarationName
from getDeclName(). Let's document that.
Bruno Ricci [Tue, 28 Jul 2020 14:35:31 +0000 (15:35 +0100)]
[Support][NFC] Fix a Wdocumentation warning in FileSystem.h
Christian Sigg [Tue, 28 Jul 2020 14:29:29 +0000 (16:29 +0200)]
Clean up cuda-runtime-wrappers API.
Do not return error code, instead return created resource handles or void. Error reporting is done by the library function.
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D84660
Xing GUO [Tue, 28 Jul 2020 14:10:44 +0000 (22:10 +0800)]
[DWARFYAML] Add support for emitting custom range list content.
This patch adds support for emitting custom range list content.
We are able to handcraft a custom range list via the following syntax.
```
debug_rnglists:
- Lists:
- Entries:
- Operator: DW_RLE_startx_endx
Values: [ 0x1234, 0x1234 ]
- Content: '
1234567890abcdef'
- Content: '
abcdef1234567890'
```
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D84618
Jinsong Ji [Tue, 28 Jul 2020 03:02:20 +0000 (03:02 +0000)]
Re-land "[PowerPC] Remove QPX/A2Q BGQ/BGP CNK support"
This reverts commit
bf544fa1c3cb80f24d85e84559fb11193846259f.
Fixed the typo in PPCInstrInfo.cpp.
Nathan James [Tue, 28 Jul 2020 13:52:32 +0000 (14:52 +0100)]
[clang-tidy][NFC] Make OptionsView methods as const where missing
Georgii Rymar [Tue, 28 Jul 2020 09:53:06 +0000 (12:53 +0300)]
[yaml2obj] - Add a way to override sh_type section field.
This adds the `ShType` key similar to others `Sh*` keys we have.
My use case is the following. Imagine we have a `SHT_SYMTAB_SHNDX`
section and want to hide it from a dumper. The natural way would be to
do something like:
```
- Name: .symtab_shndx
Type: [[TYPE=SHT_SYMTAB_SHNDX]]
Entries: [ 0, 1 ]
```
and then change the TYPE from `SHT_SYMTAB_SHNDX` to something else,
for example to `SHT_PROGBITS`.
But we have a problem: regular sections does not have `Entries` key,
so yaml2obj will be unable to produce a section.
The solution is to introduce a `ShType` key to override the final type.
This is not the first time I am facing the need to change the type. I
was able to invent workarounds or solved issues differently in the past,
but finally came to conclusion that we just should support the `ShType`.
Differential revision: https://reviews.llvm.org/D84738
Joel E. Denny [Tue, 28 Jul 2020 12:57:03 +0000 (08:57 -0400)]
[OpenMP] Fix libomptarget negative tests to expect abort
On runtime failures, D83963 causes the runtime to abort instead of
merely exiting with a non-zero value, but many tests in the
libomptarget test suite still expect the former behavior. This patch
updates the test suite and was discussed in post-commit comments on
D83963 and D84557.
Evgeniy Brevnov [Tue, 28 Jul 2020 12:50:40 +0000 (19:50 +0700)]
[BPI] Fix memory leak reported by sanitizer bots
There is a silly mistake where release() is used instead of reset() for free resources of unique pointer.
Reviewed By: ebrevnov
Differential Revision: https://reviews.llvm.org/D84747
Tim Northover [Mon, 27 Jul 2020 13:37:14 +0000 (14:37 +0100)]
ARM: make Thumb1 instructions non-flag-setting in IT block.
Many Thumb1 instructions are defined to set CPSR if executed outside an IT
block, but leave it alone from inside one. In MachineIR this is represented by
whether an optional register is CPSR or NoReg (0), and affects how the
instructions are printed.
This sets the instruction to the appropriate form during if-conversion.
Stephan Herhut [Tue, 28 Jul 2020 11:09:45 +0000 (13:09 +0200)]
[MLIR][Shape] Support transforming shape.num_elements on tensors
The current transformation to shape.reduce does not support tensor values.
This adds the required changes to make that work, including fixing the builder
for shape.reduce.
Differential Revision: https://reviews.llvm.org/D84744
Anirudh Prasad [Tue, 28 Jul 2020 10:40:47 +0000 (06:40 -0400)]
[Support] Use InitLLVM in llvm-stress, sancov and TableGen
This patch refactors the llvm tools namely, llvm-stress and sancov,
as well as the llvm TableGen utility, to use the new InitLLVM
interface which encapsulates PrettyStackTrace.
This is from https://reviews.llvm.org/D70702, but only for LLVM.
Reviewed-by: Kai
Differential Revision: https://reviews.llvm.org/D83484
Luofan Chen [Tue, 28 Jul 2020 11:19:23 +0000 (19:19 +0800)]
[Attributor] Add override keyword to the print function of AA
The print() function in the `AbstractAttribute` structure overrides
the function in the `AADepGraphNode`, so we need to mark it as
override.
This should fix a buildbot failure introduced by 5ee07dc.
Rainer Orth [Tue, 28 Jul 2020 11:21:36 +0000 (13:21 +0200)]
[compiler-rt][cmake] Don't pass --version-script to Illumos ld
Neither the Illumos `ld` nor the Solaris 11.3 one support the `--version-script` and
`z gnu-linker-script-compat` options, which breaks the `compiler-rt` build.
This patch checks for both options instead of hardcoding their use.
Tested on `amd-pc-solaris2.11` (all of Solaris 11.4, 11.3, and Illumos).
Differential Revision: https://reviews.llvm.org/D84559
Stefan Pintilie [Mon, 27 Jul 2020 17:27:30 +0000 (12:27 -0500)]
[PowerPC] Split s34imm into two types
Currently the instruction paddi always takes s34imm as the type for the
34 bit immediate. However, the PC Relative form of the instruction should
not produce the same fixup as the non PC Relative form.
This patch splits the s34imm type into s34imm and s34imm_pcrel so that two
different fixups can be emitted.
Reviewed By: nemanjai, #powerpc, kamaub
Differential Revision: https://reviews.llvm.org/D83255
Evgeniy Brevnov [Fri, 24 Jul 2020 11:57:10 +0000 (18:57 +0700)]
[BPI][NFC] Consolidate code to deal with SCCs under a dedicated data structure.
In order to facilitate review of D79485 here is a small NFC change which restructures code around handling of SCCs in BPI.
Reviewed By: davidxl
Differential Revision: https://reviews.llvm.org/D84514
Kai Nacke [Thu, 2 Jul 2020 12:43:42 +0000 (14:43 +0200)]
[SystemZ/ZOS] Implement setLastAccessAndModificationTime()
The function setLastAccessAndModificationTime() uses function
futimens() or futimes() by default. Both functions are not
available in z/OS, therefore functionality is implemented using
__fchattr() on z/OS.
Reviews by: abhina.sreeskantharajan
Differential Revision: https://reviews.llvm.org/D83945
lorenzo chelini [Tue, 28 Jul 2020 10:29:54 +0000 (12:29 +0200)]
[MLIR][Linalg] Retire C++ DotOp in favor of a linalg-ods-gen'd op
- replace DotOp, now that DRR rules have been dropped.
- Capture arguments mismatch in the parser. The number of parsed arguments must
equal the number of expected arguments.
Reviewed By: ftynse, nicolasvasilache
Differential Revision: https://reviews.llvm.org/D82952
Hans Wennborg [Tue, 28 Jul 2020 10:26:37 +0000 (12:26 +0200)]
Avoid use of std::make_unique in compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
make_unique is a C++14 feature, and this prevents us from building on
Ubuntu Trusty. While we do use a C++14 compatible toolchain for building
in general, we fall back to the system toolchain for building the
compiler-rt tests.
The reason is that those tests get cross-compiled for e.g. 32-bit and
64-bit x86, and while the toolchain provides libstdc++ in those
flavours, the resulting compiler-rt test binaries don't get RPATH set
and so won't start if they're linked with that toolchain.
We've tried linking the test binaries against libstdc++ statically, by
passing COMPILER_RT_TEST_COMPILER_CFLAGS=-static-libstdc++. That mostly
works, but some test targets append -lstdc++ to the compiler invocation.
So, after spending way too much time on this, let's just avoid C++14
here for now.
Georgii Rymar [Tue, 28 Jul 2020 10:31:13 +0000 (13:31 +0300)]
[llvm-readobj] - Add comments and formatting to mips-options-sec.test and mips-reginfo.test. NFCI.
This will allow to extend them (needed for D84651).
Mikhail Kalashnikov [Tue, 28 Jul 2020 10:06:51 +0000 (13:06 +0300)]
[llvm-readelf] Symbol index in symbol table printing is not reset
Stop using static variables for keeping track of symbol indices.
Bugfix for: https://bugs.llvm.org/show_bug.cgi?id=46777
Differential revision: https://reviews.llvm.org/D84606
Haojian Wu [Tue, 28 Jul 2020 09:59:49 +0000 (11:59 +0200)]
[Concepts] Fix ast dump for immediately declared constraint.
Reviewed By: nridge
Differential Revision: https://reviews.llvm.org/D84461
Luofan Chen [Tue, 28 Jul 2020 10:02:49 +0000 (18:02 +0800)]
[Attributor] Track AA dependency using dependency graph
This patch added dependency graph to the attributor so that we can dump the dependencies between AAs more easily. We can also apply general graph algorithms to the graph, making it easier for us to create deep wrappers.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D78861
Bruno Ricci [Tue, 28 Jul 2020 09:58:34 +0000 (10:58 +0100)]
[clang-format][NFC] Fix a Wdocumentation warning in TokenAnnotator.cpp
Serge Pavlov [Wed, 22 Apr 2020 16:00:12 +0000 (23:00 +0700)]
[Support] Add file lock/unlock functions
This is recommit of
f51bc4fb60fb, reverted in
8577595e03fa, because
the function `flock` is not available on Solaris. In this variant
`flock` was replaced with `fcntl`, which is a POSIX function.
New functions `lockFile`, `tryLockFile` and `unlockFile` implement
simple file locking. They lock or unlock entire file. This must be
enough to support simulataneous writes to log files in parallel builds.
Differential Revision: https://reviews.llvm.org/D78896
Bruno Ricci [Mon, 27 Jul 2020 22:22:21 +0000 (23:22 +0100)]
[clang] Pass the NamedDecl* instead of the DeclarationName into many diagnostics.
Background:
-----------
There are two related argument types which can be sent into a diagnostic to
display the name of an entity: DeclarationName (ak_declarationname) or
NamedDecl* (ak_nameddecl) (there is also ak_identifierinfo for
IdentifierInfo*, but we are not concerned with it here).
A DeclarationName in a diagnostic will just be streamed to the output,
which will directly result in a call to DeclarationName::print.
A NamedDecl* in a diagnostic will also ultimately result in a call to
DeclarationName::print, but with two customisation points along the way:
The first customisation point is NamedDecl::getNameForDiagnostic which is
overloaded by FunctionDecl, ClassTemplateSpecializationDecl and
VarTemplateSpecializationDecl to print the template arguments, if any.
The second customisation point is NamedDecl::printName. By default it just
streams the stored DeclarationName into the output but it can be customised
to provide a user-friendly name for an entity. It is currently overloaded by
DecompositionDecl and MSGuidDecl.
What this patch does:
---------------------
For many diagnostics a DeclarationName is used instead of the NamedDecl*.
This bypasses the two customisation points mentioned above. This patches fix
this for diagnostics in Sema.cpp, SemaCast.cpp, SemaChecking.cpp, SemaDecl.cpp,
SemaDeclAttr.cpp, SemaDecl.cpp, SemaOverload.cpp and SemaStmt.cpp.
I have only modified diagnostics where I could construct a test-case which
demonstrates that the change is appropriate (either with this patch or the next
one).
Reviewed By: erichkeane, aaron.ballman
Differential Revision: https://reviews.llvm.org/D84656
Bruno Ricci [Mon, 27 Jul 2020 22:19:02 +0000 (23:19 +0100)]
[clang-format][NFC] Be more careful about the layout of FormatToken.
The underlying ABI forces FormatToken to have a lot of padding.
Currently (on x86-64 linux) `sizeof(FormatToken) == 288`. After this patch
`sizeof(FormatToken) == 232`.
No functional changes.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D84306
Joachim Protze [Tue, 28 Jul 2020 09:08:24 +0000 (11:08 +0200)]
[OpenMP][Tests] Enable nvptx64 testing for most libomptarget tests
Also add $BUILD/lib to the LIBRARY_PATH to fix
https://bugs.llvm.org/show_bug.cgi?id=46836.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D84557
Simon Pilgrim [Tue, 28 Jul 2020 08:52:38 +0000 (09:52 +0100)]
[X86][SSE] Attempt to match OP(SHUFFLE(X,Y),SHUFFLE(X,Y)) -> SHUFFLE(HOP(X,Y))
An initial backend patch towards fixing the various poor HADD combines (PR34724, PR41813, PR45747 etc.).
This extends isHorizontalBinOp to check if we have per-element horizontal ops (odd+even element pairs), but not in the expected serial order - in which case we build a "post shuffle mask" that we can apply to the HOP result, assuming we have fast-hops/optsize etc.
The next step will be to extend the SHUFFLE(HOP(X,Y)) combines as suggested on PR41813 - accepting more post-shuffle masks even on slow-hop targets if we can fold it into another shuffle.
Differential Revision: https://reviews.llvm.org/D83789
serge-sans-paille [Tue, 28 Jul 2020 08:55:09 +0000 (10:55 +0200)]
[legacyPM] Do not compute preserved analysis if there's no local change
All analysis are preserved if there's no local change, and thanks to
3667d87a33d3c8d4072a41fd84bb880c59347dc0 this property is enforced for all
passes.
Skipping the dependency computation improves the performance when there's a lot
of small functions, where only a few change happen.
Thanks to Nikita Popov who provided this numbers (extract below)
https://llvm-compile-time-tracker.com/compare.php?from=
183342c0a9850e60dd7a004b651c83dfb3a7d25e&to=
f2f91e6a2743070471cc9471e4e8c646e50c653c&stat=instructions
O3: (number of instructions)
Benchmark Old New
kimwitu++ 60783M 59968M (-1.34%)
sqlite3 73200M 73083M (-0.16%)
consumer-typeset 52776M 52712M (-0.12%)
Bullet 133709M 132940M (-0.58%)
tramp3d-v4 123864M 123186M (-0.55%)
mafft 55534M 55477M (-0.10%)
ClamAV 76292M 76164M (-0.17%)
lencod 103190M 103061M (-0.13%)
SPASS 64068M 63713M (-0.55%)
7zip 197332M 196308M (-0.52%)
geomean 85750M 85389M (-0.42%)
Differential Revision: https://reviews.llvm.org/D80707
Georgii Rymar [Thu, 23 Jul 2020 10:32:05 +0000 (13:32 +0300)]
[llvm-readelf] - Do not treat SHT_ANDROID_RELR sections the same as SHT_RELR.
Currently, when dumping section headers, llvm-readelf
prints "RELR" for SHT_ANDROID_RELR/SHT_RELR sections.
The behavior was introduced in D47919 and revealed in D84330.
But "SHT_ANDROID_RELR" has a different value from "SHT_RELR".
Also, "SHT_ANDROID_REL/SHT_ANDROID_RELA" are printed as "ANDROID_REL/ANDROID_RELA",
what makes the handling of the "SHT_ANDROID_RELR" inconsistent.
This patch makes llvm-readelf to print "ANDROID_RELR" instead of "RELR".
Differential revision: https://reviews.llvm.org/D84393
Kristina Bessonova [Fri, 29 May 2020 11:14:51 +0000 (13:14 +0200)]
[clang][cmake] Force CMAKE_LINKER for multistage build in case of BOOTSTRAP_LLVM_ENABLE_LLD and MSVC
The issue with LLVM_ENABLE_LLD is that it just passes -fuse-ld=lld
to compiler/linker options which makes sense only for those platforms
where cmake invokes a compiler driver for linking. On Windows (MSVC) cmake
invokes the linker directly and requires CMAKE_LINKER to be specified
otherwise it defaults CMAKE_LINKER to be link.exe.
This patch allows BOOTSTRAP_LLVM_ENABLE_LLD to set CMAKE_LINKER in two cases:
* if building for host Windows,
* if crosscompiling for target Windows.
It also skips adding '-fuse-ld=lld' to make lld-link not warning
about 'unknown argument'.
This fixes build with `clang/cmake/caches/DistributionExample.cmake`
on Windows.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D80873
Chen Zheng [Tue, 28 Jul 2020 06:56:35 +0000 (02:56 -0400)]
[PowerPC] test case for adding dq form to isLegalAddressingMode, nfc
Roman Lebedev [Tue, 28 Jul 2020 07:16:52 +0000 (10:16 +0300)]
[GVN] Rewrite IsValueFullyAvailableInBlock(): no recursion, less false-negatives
While this doesn't appear to help with the perf issue being exposed by
D84108, the function as-is is very weird, convoluted, and what's worse,
recursive.
There was no need for `SpeculativelyAvaliableAndUsedForSpeculation`,
tri-state choice is enough. We don't even ever check for that state.
The basic idea here is that we need to perform a depth-first traversal
of the predecessors of the basic block in question, either finding a
preexisting state for the block in a map, or inserting a "placeholder"
`SpeculativelyAvaliable`,
If we encounter an `Unavaliable` block, then we need to give up search,
and back-propagate the `Unavaliable` state to the each successor of
said block, more specifically to the each `SpeculativelyAvaliable`
we've just created.
However, if we have traversed entirety of the predecessors and have not
encountered an `Unavaliable` block, then it must mean the value is fully
available. We could update each inserted `SpeculativelyAvaliable` into
a `Avaliable`, but we don't need to, as assertion excersizes,
because we can assume that if we see an `SpeculativelyAvaliable` entry,
it is actually `Avaliable`, because during the time we've produced it,
if we would have found that it has an `Unavaliable` predecessor,
we would have updated it's successors, including this block,
into `Unavaliable`
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D84181
Ehsan Toosi [Fri, 24 Jul 2020 13:43:59 +0000 (15:43 +0200)]
[mlir][NFC] Polish copy removal transform
Address a few remaining comments in copy removal transform.
Differential Revision: https://reviews.llvm.org/D84529
Artem Dergachev [Thu, 23 Jul 2020 18:37:45 +0000 (11:37 -0700)]
[clang-tidy] Suppress one unittest on macOS.
Possibly a linker bug but I'm in a hurry to fix a buildbot.
Differential Revision: https://reviews.llvm.org/D84453
Craig Topper [Tue, 28 Jul 2020 04:11:54 +0000 (21:11 -0700)]
[X86] Detect if EFLAGs is live across XBEGIN pseudo instruction. Add it as livein to the basic blocks created when expanding the pseudo
XBEGIN causes several based blocks to be inserted. If flags are live across it we need to make eflags live in the new basic blocks to avoid machine verifier errors.
Fixes PR46827
Reviewed By: ivanbaev
Differential Revision: https://reviews.llvm.org/D84479
Craig Topper [Tue, 28 Jul 2020 04:11:48 +0000 (21:11 -0700)]
[X86] Add support for {disp32} to control size of jmp and jcc instructions in the assembler
By default we pick a 1 byte displacement and let relaxation enlarge it if necessary. The GNU assembler supports a pseudo prefix to basically pre-relax the instruction the larger size.
I plan to add {disp8} and {disp32} support for memory operands in another patch which is why I've included the parsing code and enum for {disp8} pseudo prefix as well.
Reviewed By: echristo
Differential Revision: https://reviews.llvm.org/D84709
Craig Topper [Tue, 28 Jul 2020 04:11:42 +0000 (21:11 -0700)]
[X86] Properly encode a 32-bit address with an index register and no base register in 16-bit mode.
In 16-bit mode we can encode a 32-bit address using 0x67 prefix.
We were failing to do this when the index register was a 32-bit
register, the base register was not present, and the displacement
fit in 16-bits.
Fixes PR46866.
Wei Mi [Wed, 8 Jul 2020 22:19:44 +0000 (15:19 -0700)]
Supplement instr profile with sample profile.
PGO profile is usually more precise than sample profile. However, PGO profile
needs to be collected from loadtest and loadtest may not be representative
enough to the production workload. Sample profile collected from production
can be used as a supplement -- for functions cold in loadtest but warm/hot
in production, we can scale up the related function in PGO profile if the
function is warm or hot in sample profile.
The implementation contains changes in compiler side and llvm-profdata side.
Given an instr profile and a sample profile, for a function cold in PGO
profile but warm/hot in sample profile, llvm-profdata will either mark
all the counters in the profile to be -1 or scale up the max count in the
function to be above hot threshold, depending on the zero counter ratio in
the profile. The assumption is if there are too many counters being zero
in the function profile, the profile is more likely to cause harm than good,
then llvm-profdata will mark all the counters to be -1 indicating the
function is hot but the profile is unaccountable. In compiler side, if a
function profile with all -1 counters is seen, the function entry count will
be set to be above hot threshold but its internal profile will be dropped.
In the long run, it may be useful to let compiler support using PGO profile
and sample profile at the same time, but that requires more careful design
and more substantial changes to make two profiles work seamlessly. The patch
here serves as a simple intermediate solution.
Differential Revision: https://reviews.llvm.org/D81981
Richard Smith [Tue, 28 Jul 2020 00:28:06 +0000 (17:28 -0700)]
Don't form a 'context-independent expr' reference to a member during
name annotation.
Instead, defer forming the member access expression or DeclRefExpr until
we build the use of ClassifyName's result. Just build an
UnresolvedLookupExpr to track the LookupResult until we're ready to
consume it.
This also reverts commit
2f7269b6773de2750f9cd1417ef5f21cd6cf7a91 (other
than its testcase). That change was an attempted workaround for the same
problem.
Xing GUO [Tue, 28 Jul 2020 01:53:59 +0000 (09:53 +0800)]
[llvm-readelf] Fix emitting incorrect number of spaces in '--hex-dump'.
This patch helps teach llvm-readelf to emit a correct number spaces when
dumping in hex format.
Before this patch, when the hex data doesn't fill the 4th column, some
spaces are missing.
```
Hex dump of section '.sec':
0x00000000
00000000 00000000 00000000 00000000 ................
0x00000010
00000000 00000000 00000000 0000 ..............
```
After this patch:
```
Hex dump of section '.sec':
0x00000000
00000000 00000000 00000000 00000000 ................
0x00000010
00000000 00000000 00000000 0000 ..............
```
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D84640
Matt Arsenault [Tue, 28 Jul 2020 00:29:53 +0000 (20:29 -0400)]
TableGen: Check if pattern outputs matches instruction defs
Attempt to fix address sanitizer bots when building ARM.
Alina Sbirlea [Fri, 24 Jul 2020 23:29:58 +0000 (16:29 -0700)]
[CFGDiff] Refactor Succ/Pred maps.
Summary:
Refactor Succ/Pred maps to have a single map lookup when constructing
children. The preivous desing made sense when used by GraphTraits.
This more closely matches the previous approach in DomTree.
Reviewers: dblaikie
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84567
Alina Sbirlea [Mon, 27 Jul 2020 23:41:55 +0000 (16:41 -0700)]
[DomTree] Remove dead code.[NFC]
Fred Riss [Tue, 28 Jul 2020 00:05:27 +0000 (17:05 -0700)]
[lldb/ArchSpec] Always match simulator environment in IsEqualTo
Summary:
Initially, Apple simulator binarie triples didn't use a `-simulator`
environment and were just differentiated based on the architecture.
For example, `x86_64-apple-ios` would obviously be a simualtor as iOS
doesn't run on x86_64. With Catalyst, we made the disctinction
explicit and today, all simulator triples (even the legacy ones) are
constructed with an environment. This is especially important on Apple
Silicon were the architecture is not different from the one of the
simulated device.
This change makes the simulator part of the environment always part of
the criteria to detect whether 2 `ArchSpec`s are equal or compatible.
Reviewers: aprantl
Subscribers: inglorion, dexonsmith, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D84716
Petr Hosek [Mon, 27 Jul 2020 18:55:52 +0000 (11:55 -0700)]
[CMake] Move find_package(ZLIB) to LLVMConfig
This way, downstream projects don't have to invoke find_package(ZLIB)
reducing the amount of boilerplate.
Differential Revision: https://reviews.llvm.org/D84691
Joel E. Denny [Mon, 27 Jul 2020 23:22:05 +0000 (19:22 -0400)]
[OpenMP][Docs] Update `present` modifier status
Alina Sbirlea [Thu, 16 Jul 2020 22:46:54 +0000 (15:46 -0700)]
[GraphDiff] Use class method getChildren instead of GraphTraits.
Summary:
Use getChildren() method in GraphDiff instead of GraphTraits.
This simplifies the code and allows for refactorigns inside GraphDiff.
All usecase need not have a light-weight/copyable range.
Clean GraphTraits implementation.
Reviewers: dblaikie
Subscribers: hiraditya, llvm-commits, george.burgess.iv
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84562
Matt Arsenault [Tue, 21 Jul 2020 23:29:37 +0000 (19:29 -0400)]
GlobalISel: Don't fail translate on intrinsics with metadata
Matt Arsenault [Sat, 25 Jul 2020 14:17:49 +0000 (10:17 -0400)]
AMDGPU/GlobalISel: Mark G_ATOMICRMW_{NAND|FSUB} as lower
These aren't implemented and we're still relying on the AtomicExpand
pass, but mark these as lower to eliminate a few of the few remaining
no rules defined cases.
Matt Arsenault [Wed, 22 Jul 2020 00:53:57 +0000 (20:53 -0400)]
AMDGPU: global_atomic_csub is not always dereferenceable
Jonas Devlieghere [Mon, 27 Jul 2020 22:36:16 +0000 (15:36 -0700)]
[llvm] Make ZLIB handling compatible with multi-configuration generators
The CMAKE_BUILD_TYPE is only meaningful to single-configuration
generators (such as make and Ninja). For multi-configuration generators
like Xcode and MSVC this variable won't be set, resulting in a CMake
error.
Matt Arsenault [Mon, 13 Jul 2020 12:59:38 +0000 (08:59 -0400)]
TableGen/GlobalISel: Allow output instructions with multiple defs
The DAG behavior allows matchching input patterns with a single result
to the first result of an output instruction that defines multiple
results. The remaining defs are implicitly dead.
This starts to fix using manual selection for AMDGPU add/sub (although
it's still needed, mostly because it's also still needed for
G_PTR_ADD).
Francesco Petrogalli [Mon, 6 Jul 2020 17:46:59 +0000 (17:46 +0000)]
[llvm][CodeGen] Addressing modes for SVE ldN.
Reviewers: c-rhodes, efriedma, sdesmalen
Subscribers: huihuiz, tschuett, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77251
peter klausler [Wed, 22 Jul 2020 23:56:37 +0000 (16:56 -0700)]
[flang] Allow omission of comma in FORMAT(1PE5.2) in runtime
A comma is not required between a scale factor and a following
data edit descriptor (C1302).
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D84369
Arthur Eubanks [Mon, 27 Jul 2020 21:58:42 +0000 (14:58 -0700)]
[DFSan] Remove unused DataFlowSanitizer vars
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D84704
Fred Riss [Mon, 27 Jul 2020 20:51:07 +0000 (13:51 -0700)]
[lldb] NFC: Use early exit in ArchSpec::IsEqualTo
Sridhar Gopinath [Fri, 24 Jul 2020 17:44:48 +0000 (10:44 -0700)]
Fix the move constructor of MMI to move MachineFunctions map
The move constructor of MachineModuleInfo currently does not copy the
MachineFunctions map. This commit fixes this issue.
Patch by Sridhar Gopinath. Thanks!
Differential Revision: https://reviews.llvm.org/D84274
Jinsong Ji [Mon, 27 Jul 2020 20:48:44 +0000 (20:48 +0000)]
Revert "[PowerPC] Remove QPX/A2Q BGQ/BGP CNK support"
This reverts commit
adffce71538e219aab4eeb024819baa7687262ff.
This is breaking test-suite, revert while investigation.
Guillaume Chatelet [Mon, 27 Jul 2020 20:49:01 +0000 (20:49 +0000)]
[NFC] Move BitcodeCommon.h from Bitstream to Bitcode
Sergej Jaskiewicz [Tue, 14 Jul 2020 08:37:27 +0000 (11:37 +0300)]
Reland "[compiler-rt] [test] Allow expanding lit substitutions recursively"
The commit
8372d505082aceb38417e0b561cd32f2e227597b has been reverted
(
eafeb8af34946306a7382fa3801cf6e39a1c7226) because it broke asan
tests on green dragon buildbots.
The underlying issue has been fixed in
4dd5c2bee366514cbc3fc4e6da46462bc11a0a3d.
Arthur Eubanks [Mon, 27 Jul 2020 20:42:13 +0000 (13:42 -0700)]
Rename t2-reduce-size -> thumb2-reduce-size
For readability and consistency with other thumb2 passes like
"thumb2-it".
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D84696
Roman Lebedev [Mon, 27 Jul 2020 20:35:51 +0000 (23:35 +0300)]
[OpenMPOpt] Most SCC's are uninteresting, don't waste time on them (up to 16x faster)
Summary:
This seems obvious in hindsight, but the result is surprising.
I've measured compile-time of `-openmpopt` pass standalone
on RawSpeed unity build, and while there is some OpenMP stuff,
most is not OpenMP. But nonetheless the pass does a lot of costly
preparations before ever trying to look for OpenMP stuff in SCC.
Numbers (n=25): 0.094624s -> 0.005976s, an -93.68% improvement, or ~16x
Reviewers: jdoerfert
Reviewed By: jdoerfert
Subscribers: yaxunl, hiraditya, guansong, llvm-commits, sstefan1
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84689
Adrian Prantl [Sat, 25 Jul 2020 15:27:21 +0000 (08:27 -0700)]
Unify the return value of GetByteSize to an llvm::Optional<uint64_t> (NFC-ish)
This cleanup patch unifies all methods called GetByteSize() in the
ValueObject hierarchy to return an optional, like the methods in
CompilerType do. This means fewer magic 0 values, which could fix bugs
down the road in languages where types can have a size of zero, such
as Swift and C (but not C++).
Differential Revision: https://reviews.llvm.org/D84285
This re-lands the patch with bogus :m_byte_size(0) initalizations removed.
Louis Dionne [Fri, 24 Jul 2020 14:13:53 +0000 (10:13 -0400)]
[libunwind] Remove old keymgr related logic
keymgr used to be used on MacOSX <= 10.6, however we don't build libunwind
from scratch for such old systems anymore. Hence, this code isn't useful
anymore.
Differential Revision: https://reviews.llvm.org/D84677
Ye Luo [Mon, 27 Jul 2020 20:08:19 +0000 (16:08 -0400)]
[OpenMP] Add more pass-through functions in DeviceTy
Summary:
1. Add DeviceTy::data_alloc, DeviceTy::data_delete, DeviceTy::data_alloc, DeviceTy::synchronize pass-through functions. Avoid directly accessing Device.RTL
2. Fix the type of the first argument of synchronize_ty in rth.h, device id is int32_t which is consistent with other functions.
Reviewers: tianshilei1992, jdoerfert
Reviewed By: tianshilei1992
Subscribers: yaxunl, guansong, sstefan1, openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D84487
Fred Riss [Fri, 24 Jul 2020 16:24:41 +0000 (09:24 -0700)]
[lldb/AppleSimulator] Always provide a -simulator environment
Summary:
This commit is somewhat NFC-ish today as the environment of triples
is not considered when comparing s if one of them is
not set (I plan to change that).
We have made simulator triples unambiguous these days, but the
simulator platforms still advertise triples without the
environment. This wasn't an issue when the sims ran only on
a very different architecure than the real device, but this
has changed with Apple Silicon.
This patch simplifies the way GetSupportedArchitectureAtIndex
is implemented for the sim platforms and adds the environment.
It also trivially adds support for Apple Silicon to those
platforms.
Reviewers: aprantl
Subscribers: lldb-commits
Jon Roelofs [Mon, 27 Jul 2020 19:37:35 +0000 (13:37 -0600)]
[llvm][examples][SimplifyCFG] Fix pass's IR changed reporting
... under the EXPENSIVE_CHECKS build, this fails the assert in the LegacyPM
that verifies whether a pass really did leave the IR alone when it reports no
changes back from its return status.
Jonas Devlieghere [Mon, 27 Jul 2020 19:30:09 +0000 (12:30 -0700)]
[lldb] Remove CMAKE_VERSION checks now that the minimum version is 3.13.4
Jinsong Ji [Mon, 27 Jul 2020 18:01:40 +0000 (18:01 +0000)]
[PowerPC] Remove QPX/A2Q BGQ/BGP CNK support
Per RFC http://lists.llvm.org/pipermail/llvm-dev/2020-April/141295.html
no one is making use of QPX/A2Q/BGQ/BGP CNK anymore.
This patch remove the support of QPX/A2Q in llvm, BGQ/BGP in clang,
CNK support in openmp/polly.
Reviewed By: hfinkel
Differential Revision: https://reviews.llvm.org/D83915