Amara Emerson [Thu, 1 Oct 2020 17:45:14 +0000 (10:45 -0700)]
[AArch64][GlobalISel] Camp oversize v4s64 G_FPEXT operations.
Hubert Tong [Thu, 1 Oct 2020 19:46:26 +0000 (15:46 -0400)]
[clang][Sema] Fix PR47676: Handle dependent AltiVec C-style cast
Fix premature decision in the presence of type-dependent expression
operands on whether AltiVec vector initializations from single
expressions are "splat" operations.
Verify that the instantiation is able to determine the correct cast
semantics for both the scalar type and the vector type case.
Note that, because the change only affects the single-expression
case (and the target type is an AltiVec-style vector type), the
replacement of a parenthesized list with a parenthesized expression
does not change the semantics of the program in a program-observable
manner.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D88526
Fangrui Song [Thu, 1 Oct 2020 19:36:08 +0000 (12:36 -0700)]
Raland D87318 [LLD][PowerPC] Add support for R_PPC64_GOT_TLSGD_PCREL34 used in TLS General Dynamic
Add Thread Local Storage support for the 34 bit relocation R_PPC64_GOT_TLSGD_PCREL34 used in General Dynamic.
The compiler will produce code that looks like:
```
pla r3, x@got@tlsgd@pcrel R_PPC64_GOT_TLSGD_PCREL34
bl __tls_get_addr@notoc(x@tlsgd) R_PPC64_TLSGD
R_PPC64_REL24_NOTOC
```
LLD should be able to correctly compute the relocation for R_PPC64_GOT_TLSGD_PCREL34 as well as do the following two relaxations where possible:
General Dynamic to Local Exec:
```
paddi r3, r13, x@tprel
nop
```
and General Dynamic to Initial Exec:
```
pld r3, x@got@tprel@pcrel
add r3, r3, r13
```
Note:
This patch adds support for the PC Relative (no TOC) version of General Dynamic on top of the existing support for the TOC version of General Dynamic.
The ABI does not provide any way to tell by looking only at the relocation `R_PPC64_TLSGD` when it is being used in a TOC instruction sequence or and when it is being used in a no TOC sequence. The TOC sequence should always be 4 byte aligned. This patch adds one to the offset of the relocation when it is being used in a no TOC sequence. In this way LLD can tell by looking at the alignment of the offset of `R_PPC64_TLSGD` whether or not it is being used as part of a TOC or no TOC sequence.
Reviewed By: NeHuang, sfertile, MaskRay
Differential Revision: https://reviews.llvm.org/D87318
Petr Hosek [Thu, 1 Oct 2020 19:21:01 +0000 (12:21 -0700)]
[CMake][Fuchsia] Don't set WIN32 API, rely on autodetection
We prefer autodetection here to avoid persisting this configuration
in the generated __config header which is shared across targets.
Differential Revision: https://reviews.llvm.org/D88694
Reid Kleckner [Thu, 1 Oct 2020 19:00:18 +0000 (12:00 -0700)]
[lit] Fix Python 2/3 compat in new winreg search code
This should fix the test failures on the clang win64 bot:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/18830
It has been red since Sept 23-ish.
This was subtle to debug. Windows has 'find' and 'sort' utilities in
C:\Windows\system32, but they don't support all the same flags as the
coreutils programs. I configured the buildbot above with Python 2.7
64-bit (hey, it was set up in 2016). When I installed git for Windows, I
opted to add all the Unix utilities that come with git to the system
PATH. This is *almost* enough to make the LLVM tests pass, but not
quite, because if you use the system PATH, the Windows version of find
and sort come first, but the tests that use diff, cmp, etc, will all
pass. So only a handful of tests will fail, and with cryptic error
messages.
The code changed in this CL doesn't work with Python 2. Before
Python 3.2, the winreg.OpenKey function did not accept the `access=`
keyword argument, the caller was required to pass an unused `reserved`
positional argument of 0. The try/except/pass around the OpenKey
operation masked this usage error in Python 2.
Further, the result of the registry operation has to be converted from
unicode to add it to the environment, but that was incidental.
Reid Kleckner [Wed, 30 Sep 2020 21:40:53 +0000 (14:40 -0700)]
[PDB] Use one func id DenseMap instead of per-source maps, NFC
This avoids some DenseMap copies when /Zi is in use, and results in
fewer data structures.
Differential Revision: https://reviews.llvm.org/D88617
Nikita Popov [Thu, 1 Oct 2020 18:57:09 +0000 (20:57 +0200)]
[InstCombine] Fix select operand simplification with undef (PR47696)
When replacing X == Y ? f(X) : Z with X == Y ? f(Y) : Z, make sure
that Y cannot be undef. If it may be undef, we might end up picking
a different value for undef in the comparison and the select
operand.
Petr Hosek [Mon, 28 Sep 2020 23:12:48 +0000 (16:12 -0700)]
[CMake] Use -isystem flag to access libc++ headers
This is a partial revert of D62155. Rather than copying libc++ headers
into the build directory to be later overwritten by the final headers,
use -isystem flag to access libc++ headers during CMake checks. This
should address the occasional flake we've seen, especially on Windows
builders where CMake fails to overwrite __config with the final version.
Differential Revision: https://reviews.llvm.org/D88454
Sanjay Patel [Thu, 1 Oct 2020 18:23:18 +0000 (14:23 -0400)]
[APFloat] convert SNaN to QNaN in convert() and raise Invalid signal
This is an alternate fix (see D87835) for a bug where a NaN constant
gets wrongly transformed into Infinity via truncation.
In this patch, we uniformly convert any SNaN to QNaN while raising
'invalid op'.
But we don't have a way to directly specify a 32-bit SNaN value in LLVM IR,
so those are always encoded/decoded by calling convert from/to 64-bit hex.
See D88664 for a clang fix needed to allow this change.
Differential Revision: https://reviews.llvm.org/D88238
Arthur Eubanks [Thu, 1 Oct 2020 18:27:32 +0000 (11:27 -0700)]
Revert "[CFGuard] Add address-taken IAT tables and delay-load support"
This reverts commit
ef4e971e5e18ae796466623df8f26265ba6bdfb5.
Stefan Pintilie [Thu, 1 Oct 2020 18:28:35 +0000 (13:28 -0500)]
Revert "[LLD][PowerPC] Add support for R_PPC64_GOT_TLSGD_PCREL34 used in TLS General Dynamic"
This reverts commit
79122868f9a3909cfd94d51e9bfe960917a1be05.
Stefan Pintilie [Thu, 1 Oct 2020 10:59:19 +0000 (05:59 -0500)]
[LLD][PowerPC] Add support for R_PPC64_GOT_TLSGD_PCREL34 used in TLS General Dynamic
Add Thread Local Storage support for the 34 bit relocation R_PPC64_GOT_TLSGD_PCREL34 used in General Dynamic.
The compiler will produce code that looks like:
```
pla r3, x@got@tlsgd@pcrel R_PPC64_GOT_TLSGD_PCREL34
bl __tls_get_addr@notoc(x@tlsgd) R_PPC64_TLSGD
R_PPC64_REL24_NOTOC
```
LLD should be able to correctly compute the relocation for R_PPC64_GOT_TLSGD_PCREL34 as well as do the following two relaxations where possible:
General Dynamic to Local Exec:
```
paddi r3, r13, x@tprel
nop
```
and General Dynamic to Initial Exec:
```
pld r3, x@got@tprel@pcrel
add r3, r3, r13
```
Note:
This patch adds support for the PC Relative (no TOC) version of General Dynamic on top of the existing support for the TOC version of General Dynamic.
The ABI does not provide any way to tell by looking only at the relocation `R_PPC64_TLSGD` when it is being used in a TOC instruction sequence or and when it is being used in a no TOC sequence. The TOC sequence should always be 4 byte aligned. This patch adds one to the offset of the relocation when it is being used in a no TOC sequence. In this way LLD can tell by looking at the alignment of the offset of `R_PPC64_TLSGD` whether or not it is being used as part of a TOC or no TOC sequence.
Reviewed By: NeHuang, sfertile, MaskRay
Differential Revision: https://reviews.llvm.org/D87318
Haojian Wu [Thu, 1 Oct 2020 17:45:01 +0000 (19:45 +0200)]
[Format] Don't treat compound extension headers (foo.proto.h) as foo.cc main-file header.
We receive internal bugs about this false positives after D86597.
Differential Revision: https://reviews.llvm.org/D88640.
Louis Dionne [Thu, 1 Oct 2020 17:55:39 +0000 (13:55 -0400)]
[libc++][ci] Add a job to run the vanilla configuration on Apple
Previously, we'd only have jobs testing the Apple cache on Apple platforms,
but libc++ should also work out-of-the-box.
Sanjay Patel [Thu, 1 Oct 2020 17:45:05 +0000 (13:45 -0400)]
[AST] do not error on APFloat invalidOp in default mode
If FP exceptions are ignored, we should not error out of compilation
just because APFloat indicated an exception.
This is required as a preliminary step for D88238
which changes APFloat behavior for signaling NaN convert() to set
the opInvalidOp exception status.
Currently, there is no way to trigger this error because convert()
never sets opInvalidOp. FP binops that set opInvalidOp also create
a NaN, so the path to checkFloatingPointResult() is blocked by a
different diagnostic:
// [expr.pre]p4:
// If during the evaluation of an expression, the result is not
// mathematically defined [...], the behavior is undefined.
// FIXME: C++ rules require us to not conform to IEEE 754 here.
if (LHS.isNaN()) {
Info.CCEDiag(E, diag::note_constexpr_float_arithmetic) << LHS.isNaN();
return Info.noteUndefinedBehavior();
}
return checkFloatingPointResult(Info, E, St);
Differential Revision: https://reviews.llvm.org/D88664
Sanjay Patel [Thu, 1 Oct 2020 15:58:01 +0000 (11:58 -0400)]
[InstCombine] auto-generate complete test checks; NFC
zoecarver [Thu, 1 Oct 2020 17:40:03 +0000 (10:40 -0700)]
[DSE] Look through memory PHI arguments when removing noop stores in MSSA.
Summary:
Adds support for "following" memory through MSSA PHI arguments. This will help catch more noop stores that exist between blocks.
Originally part of D79391.
Reviewers: fhahn, jfb, asbirlea
Differential Revision: https://reviews.llvm.org/D82588
Louis Dionne [Thu, 1 Oct 2020 17:39:58 +0000 (13:39 -0400)]
[libc++] NFC: Add missing SHA to ABI Changelog
Jamie Schmeiser [Thu, 1 Oct 2020 17:39:02 +0000 (17:39 +0000)]
Reland No.3: 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 an abstract template base class that generalizes the
comparison of IRs that takes an IR representation as template parameter.
Derived classes provide overrides 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.
Reviewed By: aeubanks (Arthur Eubanks), yrouban (Yevgeny Rouban), ychen (Yuanfang Chen), MaskRay (Fangrui Song)
Differential Revision: https://reviews.llvm.org/D86360
peter klausler [Thu, 1 Oct 2020 16:50:48 +0000 (09:50 -0700)]
[flang] Fix WRITE after BACKSPACE
A WRITE to an unformatted sequential variable-length unit after
a BACKSPACE needs to forget its previous knowledge of the length
of the record that's about to be overwritten, and a BACKSPACE
after an ENDFILE or at the start of the file needs to be a no-op.
Differential revision: https://reviews.llvm.org/D88675
Louis Dionne [Thu, 1 Oct 2020 17:30:46 +0000 (13:30 -0400)]
[libc++] Don't re-export new/delete from libc++abi when they are defined in libc++
This is a temporary workaround until the new/delete situation is made
better (i.e. we don't include new/delete in both libc++ and libc++abi
by default).
peter klausler [Thu, 1 Oct 2020 16:44:09 +0000 (09:44 -0700)]
[flang] Fix INQUIRE of access and formatting possibilities
Don't give false positives from INQUIRE about possible
access mode changes on connected units. DIRECT and SEQUENTIAL
cannot be intermixed, apart from allowing DIRECT on a SEQUENTIAL
file with fixed-size records and positioning. Nor can
FORMATTED and UNFORMATTED be interchanged. On unconnected
files, the best that we can do is "UNKNOWN".
Differential revision: https://reviews.llvm.org/D88673
Florian Mayer [Thu, 1 Oct 2020 17:08:33 +0000 (10:08 -0700)]
Allow to specify macro names for android-comparison-in-temp-failure-retry
Some projects do not use the TEMP_FAILURE_RETRY macro but define their
own one, as not to depend on glibc / Bionic details. By allowing the
user to override the list of macros, these projects can also benefit
from this check.
Differential Revision: https://reviews.llvm.org/D83144
peter klausler [Thu, 1 Oct 2020 16:32:48 +0000 (09:32 -0700)]
[flang] Add checks for misuse of formatted I/O APIs in unformatted I/O statement
Add checking to I/O statement APIs to catch cases where the formatted
I/O data item transfer routines like OutputInteger64 are being
incorrectly used for unformatted I/O, which should use the
unformatted block or descriptor-based data item interfaces.
Differential revision: https://reviews.llvm.org/D88672
Mircea Trofin [Wed, 30 Sep 2020 17:36:11 +0000 (10:36 -0700)]
[NFC] Let (MC)Register APIs check isStackSlot
The user is expected to make the isStackSlot check before calling isPhysicalRegister
or isVirtualRegister. The APIs assert otherwise. We can improve the usability
of these APIs by carrying out the check in the 2 APIs: they become a
complete "source of truth" and remove an extra responsibility from the
user.
Differential Revision: https://reviews.llvm.org/D88598
Shoaib Meenai [Thu, 1 Oct 2020 01:00:18 +0000 (18:00 -0700)]
[runtimes] Remove TOOLCHAIN_TOOLS specialization
https://reviews.llvm.org/D88310 fixed the AIX issue in LLVMExternalProjectUtils,
so we shouldn't need the workaround in the runtimes build anymore. I'm
reverting it because it prevents the target-specific tool selection in
LLVMExternalProjectUtils from taking effect, which we rely on for our
runtimes builds.
Reviewed By: daltenty
Differential Revision: https://reviews.llvm.org/D88627
MaheshRavishankar [Thu, 1 Oct 2020 05:43:54 +0000 (22:43 -0700)]
[mlir][Linalg] NFC : Move fusion on tensors to separate file.
Differential Revision: https://reviews.llvm.org/D88633
Vy Nguyen [Thu, 1 Oct 2020 16:12:34 +0000 (12:12 -0400)]
Reland rG4fcd1a8e6528:[llvm-exegesis] Add option to check the hardware support for a given feature before benchmarking.
This is mostly for the benefit of the LBR latency mode.
Right now, it performs no checking. If this is run on non-supported hardware, it will produce all zeroes for latency.
Differential Revision: https://reviews.llvm.org/D85254
New change: Updated lit.local.cfg to use pass the right argument to llvm-exegesis to actually request the LBR mode.
Differential Revision: https://reviews.llvm.org/D88670
Utkarsh Saxena [Wed, 30 Sep 2020 07:36:37 +0000 (09:36 +0200)]
[clangd] Split DecisionForest Evaluate() into one func per tree.
This allows us MSAN to instrument this function. Previous version is not
instrumentable due to it shear volume.
Differential Revision: https://reviews.llvm.org/D88536
Martin Storsjö [Tue, 29 Sep 2020 07:09:22 +0000 (10:09 +0300)]
[AArch64] Don't merge sp decrement into later stores when using WinCFI
This matches the corresponding existing case in
AArch64LoadStoreOpt::findMatchingUpdateInsnForward.
Both cases could also be modified to check
MBBI->getFlag(FrameSetup/FrameDestroy) instead of forbidding any
optimization involving SP, but the effect is probably pretty much
the same.
Differential Revision: https://reviews.llvm.org/D88541
Martin Storsjö [Thu, 1 Oct 2020 06:23:12 +0000 (09:23 +0300)]
[AArch64] Remove a duplicate call to setHasWinCFI. NFCI.
The function already has a cleanup scope that calls the same whenever
the function is exited. When reading the code, seeing that this return
codepath has an explicit call while other return paths lack it is
confusing.
In the hypothetical case of a function having a prologue that
set the HasWinCFI flag in the MF, but the epilogue containing no
WinCFI instructions, the HasWinCFI flag in the MF would end up reset back
to false.
Differential Revision: https://reviews.llvm.org/D88636
Simon Pilgrim [Thu, 1 Oct 2020 15:43:59 +0000 (16:43 +0100)]
[InstCombine] collectBitParts - convert to use PatterMatch matchers and avoid IntegerType casts.
Make sure we're using getScalarSizeInBits instead of cast<IntegerType> to get Type bit widths.
This is preliminary cleanup before we can start adding vector support to the bswap/bitreverse (element level) matching.
Michael Liao [Mon, 28 Sep 2020 14:54:16 +0000 (10:54 -0400)]
[clang][opencl][codegen] Remove the insertion of `correctly-rounded-divide-sqrt-fp-math` fn-attr.
- `-cl-fp32-correctly-rounded-divide-sqrt` is already handled in a
per-instruction manner by annotating the accuracy required. There's no
need to add that fn-attr. So far, there's no in-tree backend handling
that attr and that OpenCL specific option.
- In case that out-of-tree backends are broken, this change could be
reverted if those backends could not be fixed.
Differential Revision: https://reviews.llvm.org/D88424
Meera Nakrani [Thu, 1 Oct 2020 14:55:01 +0000 (14:55 +0000)]
[ARM] Removed hasSideEffects from signed/unsigned saturates
Removed hasSideEffects from SSAT and USAT so that they are no longer
marked as unpredictable.
Differential Revision: https://reviews.llvm.org/D88545
Louis Dionne [Thu, 1 Oct 2020 12:55:40 +0000 (08:55 -0400)]
[libc++][ci] Add a configuration testing Apple's system library build
Differential Revision: https://reviews.llvm.org/D88650
Valentin Clement [Thu, 1 Oct 2020 14:34:50 +0000 (10:34 -0400)]
[flang][openacc] Fix unparsing of combined construct (bug 47659)
This patch fixes the bug report in https://bugs.llvm.org/show_bug.cgi?id=47659
Reviewed By: sameeranjoshi
Differential Revision: https://reviews.llvm.org/D88597
Jay Foad [Thu, 1 Oct 2020 14:06:27 +0000 (15:06 +0100)]
[AMDGPU] Simplify getNumFlatOffsetBits. NFC.
Remove some checks that have already been done in the only caller.
LLVM GN Syncbot [Thu, 1 Oct 2020 14:18:52 +0000 (14:18 +0000)]
[gn build] Port
f6b1323bc68
Sam McCall [Thu, 1 Oct 2020 14:14:31 +0000 (16:14 +0200)]
Reland [clangd] clangd --check: standalone diagnosis of common problems
This reverts commit
30d07b14a274f075a01d201ad59723ca1a4a9b57.
Test failures have (hopefully) been fixed.
Sam McCall [Thu, 1 Oct 2020 14:10:03 +0000 (16:10 +0200)]
Revert "[clangd] clangd --check: standalone diagnosis of common problems"
This reverts commit
79fbcbff41734e3d07e6200d33c3e40732dfae6a.
The fallback command fails to parse for the test files if there's no
compile_commands.json in the tree.
Eduardo Caldas [Mon, 28 Sep 2020 09:33:11 +0000 (09:33 +0000)]
Migrate Declarators to use the List API
After this change all nodes that have a delimited-list are using the
`List` API.
Implementation details:
Let's look at a declaration with multiple declarators:
`int a, b;`
To generate a declarator list node we need to have the range of
declarators: `a, b`:
However, the `ClangAST` actually stores them as separate declarations:
`int a ;`
`int b;`
We solve that by appropriately marking the declarators on each separate
declaration in the `ClangAST` and then for the final declarator `int
b`, shrinking its range to fit to the already marked declarators.
Differential Revision: https://reviews.llvm.org/D88403
Sam McCall [Fri, 25 Sep 2020 20:25:03 +0000 (22:25 +0200)]
[clangd] clangd --check: standalone diagnosis of common problems
This is a tool to simply parse a file as clangd would, and run some
common features (code actions, go-to-definition, hover) in an attempt to
trigger or reproduce crashes, error diagnostics, etc.
This is easier and more predictable than loading the file in clangd, because:
- there's no editor/plugin variation to worry about
- there's no accidental variation of user behavior or other extraneous requests
- we trigger features at every token, rather than guessing
- everything is synchronoous, logs are easier to reason about
- it's easier to (get users to) capture logs when running on the command-line
This is a fairly lightweight variant of this idea.
We could do a lot more with it, and maybe we should.
But I can't in the near future, and experience will tell us if we made
the right tradeoffs and if it's worth investing further.
Differential Revision: https://reviews.llvm.org/D88338
David Tenty [Wed, 30 Sep 2020 15:13:20 +0000 (11:13 -0400)]
[compiler-rt][cmake][powerpc] Remove TEST_BIG_ENDIAN from base-config-ix.cmake
It's actually not safe to call TEST_BIG_ENDIAN here, since we may be
running from the builtins build (i.e builtins-config-ix) context where
TEST_COMPILE_ONLY is set since without builtins already built we may
fail to link, and TEST_BIG_ENDIAN internally performs tests which may
fail to link without builtins.
Fortunately powerpc is the only target that uses this information here and
we actually already know the whether we are targeting the LE variant due
to earlier macro checks, so we can simply this to remove our reliance on
TEST_BIG_ENDIAN.
Reviewed By: hubert.reinterpretcast, Whitney
Differential Revision: https://reviews.llvm.org/D88608
Simon Pilgrim [Thu, 1 Oct 2020 13:42:16 +0000 (14:42 +0100)]
[InstCombine] Use m_FAbs matcher helper. NFCI.
Simon Pilgrim [Thu, 1 Oct 2020 13:36:42 +0000 (14:36 +0100)]
[IR] PatternMatch - add m_FShl/m_FShr funnel shift intrinsic matchers. NFCI.
Jay Foad [Thu, 1 Oct 2020 13:21:59 +0000 (14:21 +0100)]
[AMDGPU] Tiny cleanup in isLegalFLATOffset. NFC.
David Sherwood [Wed, 30 Sep 2020 13:18:03 +0000 (14:18 +0100)]
[SVE][CodeGen] Replace use of TypeSize operator< in GlobalMerge::doMerge
We don't support global variables with scalable vector types so I've
changed the code to compare the fixed sizes instead.
Differential Revision: https://reviews.llvm.org/D88564
James Henderson [Fri, 25 Sep 2020 09:21:39 +0000 (10:21 +0100)]
[Archive] Don't throw away errors for malformed archive members
When adding an archive member with a problem, e.g. a new bitcode with an
old archiver, containing an unsupported attribute, or an ELF file with a
malformed symbol table, the archiver would throw away the error and
simply add the member to the archive without any symbol entries. This
meant that the resultant archive could be silently unusable when not
using --whole-archive, and result in unexpected undefined symbols.
This change fixes this issue by addressing two FIXMEs and only throwing
away not-an-object errors. However, this meant that some LLD tests which
didn't need symbol tables and were using invalid members deliberately to
test the linker's malformed input handling no longer worked, so this
patch also stops the archiver from looking for symbols in an object if
it doesn't require a symbol table, and updates the tests accordingly.
Differential Revision: https://reviews.llvm.org/D88288
Reviewed by: grimar, rupprecht, MaskRay
LLVM GN Syncbot [Thu, 1 Oct 2020 12:55:59 +0000 (12:55 +0000)]
[gn build] Port
d53b4bee0cc
Sjoerd Meijer [Wed, 30 Sep 2020 10:16:22 +0000 (11:16 +0100)]
[LoopFlatten] Add a loop-flattening pass
This is a simple pass that flattens nested loops. The intention is to optimise
loop nests like this, which together access an array linearly:
for (int i = 0; i < N; ++i)
for (int j = 0; j < M; ++j)
f(A[i*M+j]);
into one loop:
for (int i = 0; i < (N*M); ++i)
f(A[i]);
It can also flatten loops where the induction variables are not used in the
loop. This can help with codesize and runtime, especially on simple cpus
without advanced branch prediction.
This is only worth flattening if the induction variables are only used in an
expression like i*M+j. If they had any other uses, we would have to insert a
div/mod to reconstruct the original values, so this wouldn't be profitable.
This partially fixes PR40581 as this pass triggers on one of the two cases. I
will follow up on this to learn LoopFlatten a few more (small) tricks. Please
note that LoopFlatten is not yet enabled by default.
Patch by Oliver Stannard, with minor tweaks from Dave Green and myself.
Differential Revision: https://reviews.llvm.org/D42365
Sam Parker [Thu, 1 Oct 2020 12:37:47 +0000 (13:37 +0100)]
[NFC][ARM] LowOverheadLoop DEBUG statements
Raphael Isemann [Thu, 1 Oct 2020 12:32:02 +0000 (14:32 +0200)]
[lldb] Add missing import for LLDB test decorators to TestStopHookScripted
This test wasn't using decorators before and was missing the import, so my
previous commit broke the test.
Louis Dionne [Wed, 30 Sep 2020 23:17:16 +0000 (19:17 -0400)]
[libc++] Simplify how we re-export symbols from libc++abi
Instead of managing two copies of the symbol lists, reuse the same list
in libc++abi and libc++.
Differential Revision: https://reviews.llvm.org/D88623
Raphael Isemann [Thu, 1 Oct 2020 12:23:45 +0000 (14:23 +0200)]
[lldb] Skip the flakey part of TestStopHookScripted on Linux
This test seems to randomly fail on Linux machines. It's only one part of the
test failing randomly, so let's just skip it instead of reverting the whole
patch (again).
Simon Pilgrim [Thu, 1 Oct 2020 11:49:59 +0000 (12:49 +0100)]
[InstCombine] collectBitParts - use APInt directly to check for out of range bit shifts. NFCI.
Andrew Paverd [Thu, 1 Oct 2020 09:07:40 +0000 (10:07 +0100)]
[CFGuard] Add address-taken IAT tables and delay-load support
This patch adds support for creating Guard Address-Taken IAT Entry Tables (.giats$y sections) in object files, matching the behavior of MSVC. These contain lists of address-taken imported functions, which are used by the linker to create the final GIATS table.
Additionally, if any DLLs are delay-loaded, the linker must look through the .giats tables and add the respective load thunks of address-taken imports to the GFIDS table, as these are also valid call targets.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D87544
Kerry McLaughlin [Thu, 1 Oct 2020 10:06:55 +0000 (11:06 +0100)]
[SVE][CodeGen] Lower scalable fp_extend & fp_round operations
This patch adds FP_EXTEND_MERGE_PASSTHRU & FP_ROUND_MERGE_PASSTHRU
ISD nodes, used to lower scalable vector fp_extend/fp_round operations.
fp_round has an additional argument, the 'trunc' flag, which is an integer of zero or one.
This also fixes a warning introduced by the new tests added to sve-split-fcvt.ll,
resulting from an implicit TypeSize -> uint64_t cast in SplitVecOp_FP_ROUND.
Reviewed By: sdesmalen, paulwalker-arm
Differential Revision: https://reviews.llvm.org/D88321
Nicolas Vasilache [Thu, 1 Oct 2020 10:57:35 +0000 (06:57 -0400)]
[mlir][Linalg] Fix ASAN bug
```
LinalgTilingOptions &setTileSizes(ValueRange ts)
```
makes it all too easy to create stack-use-after-return errors.
In particular,
c694588fc52a8845174fee06ad0bcfa338e87816 introduced one such issue.
Instead just take a copy in the lambda and be done with it.
Max Kazantsev [Thu, 1 Oct 2020 08:58:31 +0000 (15:58 +0700)]
[SCEV] Prove implicaitons via AddRec start
If we know that some predicate is true for AddRec and an invariant
(w.r.t. this AddRec's loop), this fact is, in particular, true on the first
iteration. We can try to prove the facts we need using the start value.
The motivating example is proving things like
```
isImpliedCondOperands(>=, X, 0, {X,+,-1}, 0}
```
Differential Revision: https://reviews.llvm.org/D88208
Reviewed By: reames
Sam Parker [Thu, 1 Oct 2020 09:47:02 +0000 (10:47 +0100)]
[ARM][LowOverheadLoops] Adjust Start insertion.
Try to move the insertion point to become the terminator of the
block, usually the preheader.
Differential Revision: https://reviews.llvm.org/D88638
Kerry McLaughlin [Wed, 30 Sep 2020 09:55:51 +0000 (10:55 +0100)]
[SVE][CodeGen] Legalisation of integer -> floating point conversions
Splitting the operand of a scalable [S|U]INT_TO_FP results in a
concat_vectors operation where the operands are unpacked FP
scalable vectors (e.g. nxv2f32).
This patch adds custom lowering of concat_vectors which
checks that the number of operands is 2, and isel patterns
to match concat_vectors of scalable FP types with uzp1.
Reviewed By: efriedma, paulwalker-arm
Differential Revision: https://reviews.llvm.org/D88033
Paul Walker [Fri, 25 Sep 2020 12:37:03 +0000 (13:37 +0100)]
[NFC] Iterate across an explicit list of scalable MVTs when driving setOperationAction.
Iterating across all of integer_scalable_vector_valuetypes seems
wasteful when there's only a handful we care about.
Also removes some rouge whitespace.
Differential Revision: https://reviews.llvm.org/D88552
Sam Parker [Wed, 30 Sep 2020 10:10:49 +0000 (11:10 +0100)]
[ARM][LowOverheadLoops] Iteration count liveness
Before deciding to insert a [W|D]LSTP, check that defining LR with
the element count won't affect any other instructions that should be
taking the iteration count.
Differential Revision: https://reviews.llvm.org/D88549
Sam Parker [Wed, 30 Sep 2020 09:42:08 +0000 (10:42 +0100)]
[ARM][LowOverheadLoops] Start insertion point
If possible, try not to move the start position earlier than it
already is.
Differential Revision: https://reviews.llvm.org/D88542
Stefan Gränitz [Thu, 1 Oct 2020 08:25:06 +0000 (10:25 +0200)]
[ORC][examples] Temporarily remove LLJITWithChildProcess until ORC TPC lands
This solves a phase ordering problem: OrcV2 remote process support depends on OrcV2 removable code, OrcV2 removable code depends on OrcV1 removal, OrcV1 removal depends on LLJITWithChildProcess migration, and LLJITWithChildProcess migration depends on OrcV2 TargetProcessControl support.
Stefan Gränitz [Thu, 1 Oct 2020 08:03:58 +0000 (10:03 +0200)]
[ORC][examples] Remove ThinLtoJIT example after LLJITWithThinLTOSummaries landed in OrcV2Examples
The ThinLtoJIT example was aiming to utilize ThinLTO summaries and concurrency in ORC for speculative compilation. The latter is heavily dependent on asynchronous task scheduling which is probably done better out-of-tree with a mature library like Boost-ASIO. The pure utilization of ThinLTO summaries in ORC is demonstrated in OrcV2Examples/LLJITWithThinLTOSummaries.
Vitaly Buka [Thu, 1 Oct 2020 07:49:09 +0000 (00:49 -0700)]
[sanitizer] Fix SymbolizedStack leak
Sam Parker [Wed, 30 Sep 2020 14:15:42 +0000 (15:15 +0100)]
[ARM][LowOverheadLoops] Use iterator for InsertPt.
Use a MachineBasicBlock::iterator instead of a MachineInstr* for the
position of our LoopStart instruction. NFCish, as it change debug
info.
Fangrui Song [Thu, 1 Oct 2020 07:05:15 +0000 (00:05 -0700)]
[MC] Inline MCExpr::printVariantKind & remove UseParensForSymbolVariantBit
Note, MAI may be nullptr in -show-encoding.
Amara Emerson [Fri, 18 Sep 2020 18:33:16 +0000 (11:33 -0700)]
[AArch64][GlobalISel] Select all-zero G_BUILD_VECTOR into a zero mov.
Unfortunately the leaf SDAG patterns aren't supported yet so we need to do
this manually, but it's not a significant amount of code anyway.
Differential Revision: https://reviews.llvm.org/D87924
Andrew Dona-Couch [Thu, 1 Oct 2020 05:49:12 +0000 (18:49 +1300)]
[AVR] fix interrupt stack pointer restoration
This patch fixes a corruption of the stack pointer and several registers in any AVR interrupt with non-empty stack frame. Previously, the callee-saved registers were popped before restoring the stack pointer, causing the pointer math to use the wrong base value while also corrupting the caller's register. This change fixes the code to restore the stack pointer last before exiting the interrupt service routine.
https://bugs.llvm.org/show_bug.cgi?id=47253
Reviewed By: dylanmckay
Differential Revision: https://reviews.llvm.org/D87735
Patch by Andrew Dona-Couch.
Chris Lattner [Thu, 1 Oct 2020 05:36:44 +0000 (22:36 -0700)]
We don't need two different ways to get commit access, just simplify
the policy here so that old SVN users and new contributors do the same
thing.
Muhammad Omair Javaid [Thu, 1 Oct 2020 05:20:16 +0000 (10:20 +0500)]
[LLDB] Remove AArch64/Linux xfail decorator from TestGuiBasicDebug
This test now passes on AArch64/Linux after following change by Jonas:
d689570d7dcb16ee241676e22324dc456837eb23
Igor Chervatyuk [Thu, 24 Sep 2020 07:23:45 +0000 (10:23 +0300)]
[RISCV][ASAN] implementation for previous/next pc routines for riscv64
[7/11] patch series to port ASAN for riscv64
Depends On D87575
Reviewed By: eugenis, vitalybuka, luismarques
Differential Revision: https://reviews.llvm.org/D87577
Max Kazantsev [Thu, 1 Oct 2020 05:11:24 +0000 (12:11 +0700)]
[SCEV][NFC] Introduce isKnownPredicateAt method
We can query known predicates in different points, respecting
their dominating conditions.
Michael Liao [Thu, 1 Oct 2020 03:15:35 +0000 (23:15 -0400)]
Revert "[llvm-exegesis] Add option to check the hardware support for a given feature before benchmarking."
This reverts commit
4fcd1a8e6528ca42fe656f2745e15d2b7f5de495 as
`llvm/test/tools/llvm-exegesis/X86/lbr/mov-add.s` failed on hosts
without LBR supported if the build has LIBPFM enabled. On that host,
`perf_event_open` fails with `EOPNOTSUPP` on LBR config. That change's
basic assumption
> If this is run on a non-supported hardware, it will produce all zeroes for latency.
could not stand as `perf_event_open` system call will fail if the
underlying hardware really don't have LBR supported.
Fangrui Song [Thu, 1 Oct 2020 03:09:25 +0000 (20:09 -0700)]
[ELF] --wrap: don't unnecessarily expose __real_
The routing rules are:
sym -> __wrap_sym
__real_sym -> sym
__wrap_sym and sym are routing targets, so they need to be exposed to the symbol
table. __real_sym is not and can be eliminated if not used by regular object.
Craig Topper [Thu, 1 Oct 2020 02:31:08 +0000 (19:31 -0700)]
[APFloat] Improve asserts in isSignificandAllOnes and isSignificandAllZeros so they protect shift operations from undefined behavior.
For example, the assert in isSignificandAllZeros allowed NumHighBits
to be integerPartWidth. But since it is used directly as a shift amount
it must be less than integerPartWidth.
Michael Kruse [Thu, 1 Oct 2020 01:55:44 +0000 (20:55 -0500)]
[flang][msvc] Workaround 'forgotten' symbols in FoldOperation. NFC.
This resolves an issue where the Microsoft compiler 'forgets' symbols when using constexpr in a lambda in a templated function. The symbols are:
1. The implicit lambda captures `context` and `convert`. Fix by making them explicit captures. The error message was:
```
fold-implementation.h(1220): error C2065: 'convert': undeclared identifier
```
2. The function template argument FROMCAT. Fix by storing it in a temporary constexpr variable inside the function. The error message was:
```
fold-implementation.h(1216): error C2065: 'FROMCAT': undeclared identifier
```
This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D88504
Dan Gohman [Thu, 1 Oct 2020 00:21:57 +0000 (17:21 -0700)]
[WebAssembly] New-style command support
This adds support for new-style command support. In this mode, all exports
are considered command entrypoints, and the linker inserts calls to
`__wasm_call_ctors` and `__wasm_call_dtors` for all such entrypoints.
This enables support for:
- Command entrypoints taking arguments other than strings and return values
other than `int`.
- Multicall executables without requiring on the use of string-based
command-line arguments.
This new behavior is disabled when the input has an explicit call to
`__wasm_call_ctors`, indicating code not expecting new-style command
support.
This change does mean that wasm-ld no longer supports DCE-ing the
`__wasm_call_ctors` function when there are no calls to it. If there are no
calls to it, and there are ctors present, we assume it's wasm-ld's job to
insert the calls. This seems ok though, because if there are ctors present,
the program is expecting them to be called. This change affects the
init-fini-gc.ll test.
Michael Kruse [Wed, 30 Sep 2020 21:14:12 +0000 (16:14 -0500)]
[flang][msvc] Avoid ReferenceVariantBase ctor ambiguity. NFC.
Msvc reports the following error when a ReferenceVariantBase is constructed using an r-value reference or instantiated as std::vector template parameter. The error message is:
```
PFTBuilder.h(59,1): error C2665: 'std::variant<...>::variant': none of the 2 overloads could convert all the argument types
variant(1248,1): message : could be 'std::variant<...>::variant(std::variant<...> &&) noexcept(false)'
variant(1248,1): message : or 'std::variant<...>::variant(const std::variant<...> &) noexcept(false)'
PFTBuilder.h(59,1): message : while trying to match the argument list '(common::Reference<lower::pft::ReferenceVariantBase<false,...>>)'
```
Work around the ambiguity by only taking `common::Reference` arguments in the constructor. That is, conversion to common::Reference has to be done be the caller instead of being done inside the ctor. Unfortunately, with this change clang/gcc (but not msvc) insist on that the ReferenceVariantBase is stored in a `std::initializer_list`-initialized variable before being used, like being passed to a function or returned.
This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.
Reviewed By: DavidTruby
Differential Revision: https://reviews.llvm.org/D88109
Amara Emerson [Thu, 1 Oct 2020 01:03:02 +0000 (18:03 -0700)]
[AArch64][GlobalISel] Clamp oversize FP arithmetic vectors.
River Riddle [Thu, 1 Oct 2020 00:23:11 +0000 (17:23 -0700)]
[mlir] Split Dialect::addOperations into two functions
The current implementation uses a fold expression to add all of the operations at once. This is really nice, but apparently the lifetime of each of the AbstractOperation instances is for the entire expression which may lead to a stack overflow for large numbers of operations. This splits the method in two to allow for the lifetime of the AbstractOperation to be properly scoped.
peter klausler [Wed, 30 Sep 2020 22:04:43 +0000 (15:04 -0700)]
[flang] Fix Gw.d format output
The estimation of the decimal exponent needs to allow for all
'd' of the requested significant digits.
Also accept a plus sign on a "+kP" scaling factor in a format.
Differential revision: https://reviews.llvm.org/D88618
Geoffrey Martin-Noble [Thu, 1 Oct 2020 00:47:25 +0000 (17:47 -0700)]
Remove `Ops` suffix from dialect library names
Dialects include more than just ops, so this suffix is outdated. Follows
discussion in
https://llvm.discourse.group/t/rfc-canonical-file-paths-to-dialects/621
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D88530
Sam Clegg [Fri, 31 Jul 2020 00:44:32 +0000 (17:44 -0700)]
[lld][WebAssembly] Allow exporting of mutable globals
In particular allow explict exporting of `__stack_pointer` but
exclud this from `--export-all` to avoid requiring the mutable
globals feature whenenve `--export-all` is used.
This uncovered a bug in populateTargetFeatures regarding checking
if the mutable-globals feature is allowed.
See: https://github.com/WebAssembly/binaryen/issues/2934
Differential Revision: https://reviews.llvm.org/D88506
Amara Emerson [Thu, 1 Oct 2020 00:35:53 +0000 (17:35 -0700)]
Try to fix build. May have used a C++ feature too new/not supported on all platforms.
Arthur Eubanks [Wed, 30 Sep 2020 16:22:18 +0000 (09:22 -0700)]
[WholeProgramDevirt][NewPM] Add NPM testing path to match legacy pass
The legacy pass's default constructor sets UseCommandLine = true and
goes down a separate testing route. Match that in the NPM pass.
This fixes all tests in llvm/test/Transforms/WholeProgramDevirt under NPM.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D88588
Amara Emerson [Thu, 1 Oct 2020 00:20:57 +0000 (17:20 -0700)]
[AArch64][GlobalISel] Add some more legal types for G_PHI, G_IMPLICIT_DEF, G_FREEZE.
Also use this opportunity start to clean up the mess of vector type lists we
have in the LegalizerInfo. Unfortunately since the legalizer rule builders require
std::initializer_list objects as parameters we can't programmatically generate the
type lists.
peter klausler [Wed, 30 Sep 2020 19:53:00 +0000 (12:53 -0700)]
[flang] Allow record advancement in external formatted sequential READ
The '/' control edit descriptor causes a runtime crash for an
external formatted sequential READ because the AdvanceRecord()
member function for external units implemented only the tasks
to finish reading the current record. Split those out into
a new FinishReadingRecord() member function, call that instead
from EndIoStatement(), and change AdvanceRecord() to both
finish reading the current record and to begin reading the next
one.
Differential revision: https://reviews.llvm.org/D88607
Jonas Devlieghere [Thu, 1 Oct 2020 00:01:27 +0000 (17:01 -0700)]
[lldb] Make TestGuiBasicDebug more lenient
Matt's change to the register allocator in
89baeaef2fa9 changed where we
end up after the `finish`. Before we'd end up on line 4.
* thread #1, queue = 'com.apple.main-thread', stop reason = step out
Return value: (int) $0 = 1
frame #0: 0x0000000100003f7d a.out`main(argc=1, argv=0x00007ffeefbff630) at main.c:4:3
1 extern int func();
2
3 int main(int argc, char **argv) {
-> 4 func(); // Break here
5 func(); // Second
6 return 0;
7 }
Now, we end up on line 5.
* thread #1, queue = 'com.apple.main-thread', stop reason = step out
Return value: (int) $0 = 1
frame #0: 0x0000000100003f8d a.out`main(argc=1, argv=0x00007ffeefbff630) at main.c:5:3
2
3 int main(int argc, char **argv) {
4 func(); // Break here
-> 5 func(); // Second
6 return 0;
7 }
Given that this is not expected stable to be stable I've made the test a
bit more lenient to accept both scenarios.
Jessica Paquette [Wed, 30 Sep 2020 01:23:02 +0000 (18:23 -0700)]
[AArch64][GlobalISel] NFC: Refactor G_FCMP selection code
Refactor this so it's similar to the existing integer comparison code.
Also add some missing 64-bit testcases to select-fcmp.mir.
Refactoring to prep for improving selection for G_FCMP-related conditional
branches etc.
Differential Revision: https://reviews.llvm.org/D88614
Ranjeet Singh [Wed, 30 Sep 2020 23:30:36 +0000 (00:30 +0100)]
[ARM] Add missing target for Arm neon test case.
This is a follow-up from https://reviews.llvm.org/D61717. Where Richard
described the issue with compiling arm_neon.h under
-flax-vector-conversions=none. It looks like the example reproducer does
actually work but what was missing was a test entry for that target.
Differential Revision: https://reviews.llvm.org/D88546
Joachim Protze [Wed, 30 Sep 2020 23:01:09 +0000 (01:01 +0200)]
[OpenMP][libarcher] Allow all possible argument separators in TSAN_OPTIONS
Currently, the parser used to tokenize the TSAN_OPTIONS in libomp uses
only spaces as separators, even though TSAN in compiler-rt supports
other separators like ':' or ','.
CTest uses ':' to separate sanitizer options by default.
The documentation for other sanitizers mentions ':' as separator,
but TSAN only lists spaces, which is probably where this mismatch originated.
Patch provided by upsj
Differential Revision: https://reviews.llvm.org/D87144
Craig Topper [Wed, 30 Sep 2020 20:55:01 +0000 (13:55 -0700)]
Patch IEEEFloat::isSignificandAllZeros and IEEEFloat::isSignificandAllOnes (bug 34579)
Patch IEEEFloat::isSignificandAllZeros and IEEEFloat::isSignificandAllOnes to behave correctly in the case that the size of the significand is a multiple of the width of the integerParts making up the significand.
The patch to IEEEFloat::isSignificandAllOnes fixes bug 34579, and the patch to IEEE:Float:isSignificandAllZeros fixes the unit test "APFloatTest.x87Next" I added here. I have included both in this diff since the changes are very similar.
Patch by Andrew Briand
Ahsan Saghir [Tue, 29 Sep 2020 14:40:38 +0000 (09:40 -0500)]
[PowerPC] Add outer product instructions for MMA
This patch adds outer product instructions for MMA, including related infrastructure, and their tests.
Depends on D84968.
Reviewed By: #powerpc, bsaleil, amyk
Differential Revision: https://reviews.llvm.org/D88043
Akira Hatanaka [Wed, 30 Sep 2020 23:05:17 +0000 (16:05 -0700)]
Handle unknown OSes in DarwinTargetInfo::getExnObjectAlignment
rdar://problem/
69727650
Joachim Protze [Wed, 30 Sep 2020 22:53:41 +0000 (00:53 +0200)]
[OpenMP][OMPT] Update OMPT tests for newly added GOMP interface patches
This patch updates the expected results for the GOMP interface patches: D87267, D87269, and D87271.
The taskwait-depend test is changed to really use taskwait-depend and copied to an task_if0-depend test.
To pass the tests, the handling of the return address was fixed.
Differential Revision: https://reviews.llvm.org/D87680
Joachim Protze [Wed, 30 Sep 2020 08:40:51 +0000 (10:40 +0200)]
[OpenMP][libomptarget] make omp_get_initial_device 5.1 compliant
OpenMP 5.1 defines omp_get_initial_device to return the same value as omp_get_num_devices.
Since this change is also 5.0 compliant, no versioning is needed.
Differential Revision: https://reviews.llvm.org/D88149
peter klausler [Wed, 30 Sep 2020 20:34:23 +0000 (13:34 -0700)]
[flang] Semantic analysis for FINAL subroutines
Represent FINAL subroutines in the symbol table entries of
derived types. Enforce constraints. Update tests that have
inadvertent violations or modified messages. Added a test.
The specific procedure distinguishability checking code for generics
was used to enforce distinguishability of FINAL procedures.
(Also cleaned up some confusion and redundancy noticed in the
type compatibility infrastructure while digging into that area.)
Differential revision: https://reviews.llvm.org/D88613