Jonas Devlieghere [Mon, 6 Jan 2020 17:52:09 +0000 (09:52 -0800)]
[lldb/Test] Move @skipIfAsan from test class to test methods.
skipTestIfFn can only be used to decorate a test method.
Fangrui Song [Sun, 5 Jan 2020 22:56:27 +0000 (14:56 -0800)]
[llvm-readelf] Print EI_ABIVERSION as decimal instead of hexadecimal
This matches GNU readelf and llvm-readobj.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D72234
LLVM GN Syncbot [Mon, 6 Jan 2020 17:22:13 +0000 (17:22 +0000)]
[gn build] Port
350da402ef6
Tamás Zolnai [Sat, 4 Jan 2020 13:05:09 +0000 (14:05 +0100)]
[clang-tidy] new check: bugprone-signed-char-misuse
Summary:
This check searches for signed char -> integer conversions which might
indicate programming error, because of the misinterpretation of char
values. A signed char might store the non-ASCII characters as negative
values. The human programmer probably expects that after an integer
conversion the converted value matches with the character code
(a value from [0..255]), however, the actual value is in
[-128..127] interval.
See also:
STR34-C. Cast characters to unsigned char before converting to larger integer sizes
<https://wiki.sei.cmu.edu/confluence/display/c/STR34-C.+Cast+characters+to+unsigned+char+before+converting+to+larger+integer+sizes>
By now this check is limited to assignment / variable declarations.
If we would catch all signed char -> integer conversion, then it would
produce a lot of findings and also false positives. So I added only
this use case now, but this check can be extended with additional
use cases later.
The CERT documentation mentions another use case when the char is
used for array subscript. Next to that a third use case can be
the signed char - unsigned char comparison, which also a use case
where things happen unexpectedly because of conversion to integer.
Reviewers: alexfh, hokein, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: sylvestre.ledru, whisperity, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D71174
Jonas Devlieghere [Mon, 6 Jan 2020 17:06:09 +0000 (09:06 -0800)]
[lldb/Test] Temporarily skip TestFoundationDisassembly on the ASan bot.
This test is timing out on the sanitized bot on GreenDragon. Temporarily
disable it to increase the signal-to-noise ration.
Jonas Devlieghere [Mon, 6 Jan 2020 16:49:36 +0000 (08:49 -0800)]
[lldb/CMake] Autodetect Python dependency
Python was the last remaining "optional" dependency for LLDB. This moves
the code to find Python into FindPythonInterpAndLibs using the same
principles as FindCursesAndPanel.
Differential revision: https://reviews.llvm.org/D72107
diggerlin [Mon, 6 Jan 2020 16:45:00 +0000 (11:45 -0500)]
[AIX] Use csect reference for function address constants
SUMMARY:
We currently emit a reference for function address constants as labels;
for example:
foo_ptr:
.long foo
however, there may be no such label in the case where the function is
undefined. Although the label exists when the function is defined, we
will (to be consistent) also use a csect reference in that case.
Address one comment
https://reviews.llvm.org/D71144#inline-653255
Reviewers: daltenty,hubert.reinterpretcast,jasonliu,Xiangling_L
Subscribers: cebowleratibm, wuzish, nemanjai
Differential Revision: https://reviews.llvm.org/D71144
Guillaume Chatelet [Mon, 6 Jan 2020 12:31:45 +0000 (13:31 +0100)]
[llvm-libc] Fix missing virtual destructor
Summary: This patch adds a virtual destructor to the Command class.
Reviewers: sivachandra
Subscribers: mgorny, MaskRay, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D72253
David Green [Mon, 6 Jan 2020 15:54:36 +0000 (15:54 +0000)]
[ARM] Use the correct opcodes for Thumb2 segmented stack frame lowering
The segmented stack lowering code appears to be using ARM opcodes under
Thumb2. The MRC opcode will be the same for Thumb and ARM, but t2LDR
seems wrong. Either way, using the correct thumb vs arm opcodes is more
correct.
Differential Revision: https://reviews.llvm.org/D72074
David Green [Mon, 6 Jan 2020 10:58:14 +0000 (10:58 +0000)]
[ARM] Use correct TRAP opcode for thumb in FastISel
We were previously unconditionally using the ARM::TRAP opcode, even
under Thumb. My understanding is that these are essentially the same
thing (they both result in a trap under Thumb), but the ARM::TRAP opcode
is marked as requiring IsARM, so it is more correct to use ARM::tTRAP.
Differential Revision: https://reviews.llvm.org/D72075
diggerlin [Mon, 6 Jan 2020 16:38:22 +0000 (11:38 -0500)]
[AIX] Use csect reference for function address constants
SUMMARY:
We currently emit a reference for function address constants as labels;
for example:
foo_ptr:
.long foo
however, there may be no such label in the case where the function is
undefined. Although the label exists when the function is defined, we
will (to be consistent) also use a csect reference in that case.
Reviewers: daltenty,hubert.reinterpretcast,jasonliu,Xiangling_L
Subscribers: cebowleratibm, wuzish, nemanjai
Differential Revision: https://reviews.llvm.org/D71144
Mark de Wever [Wed, 1 Jan 2020 16:23:18 +0000 (17:23 +0100)]
Adds -Wrange-loop-analysis to -Wall
This makes the range loop warnings part of -Wall.
Fixes PR32823: Warn about accidental coping of data in range based for
Differential Revision: https://reviews.llvm.org/D68912
Recomitted after fixing the warnings it created.
Mark de Wever [Sun, 5 Jan 2020 13:26:39 +0000 (14:26 +0100)]
[NFC] Fixes -Wrange-loop-analysis warnings
This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.
Differential Revision: https://reviews.llvm.org/D72210
Simon Pilgrim [Mon, 6 Jan 2020 16:36:33 +0000 (16:36 +0000)]
[AMDGPU] Fix "use of uninitialized variable" static analyzer warning. NFCI.
Add "unreachable" default case to AMDGPUTargetStreamer::getArchNameFromElfMach
Simon Pilgrim [Mon, 6 Jan 2020 16:17:05 +0000 (16:17 +0000)]
Fix "use of uninitialized variable" static analyzer warnings. NFCI.
Add "unreachable" default cases like we do for the other switch()s in X86MCInstLower::Lower
Simon Pilgrim [Mon, 6 Jan 2020 16:15:17 +0000 (16:15 +0000)]
Fix "use of uninitialized variable" static analyzer warning. NFCI.
Simon Tatham [Mon, 6 Jan 2020 16:33:14 +0000 (16:33 +0000)]
[ARM,MVE] Fix many signedness errors in MVE intrinsics.
Summary:
Running an end-to-end test last week I noticed that a lot of the ACLE
intrinsics that operate differently on vectors of signed and unsigned
integers were ending up generating the signed version of the
instruction unconditionally. This is because the IR intrinsics had no
way to distinguish signed from unsigned: the LLVM type system just
calls them both `v8i16` (or whatever), so you need either separate
intrinsics for signed and unsigned, or a flag parameter that tells
ISel which one to choose.
This patch fixes all the problems of that kind that I've noticed, by
adding an i32 flag parameter to many of the IR intrinsics which is set
to 1 for unsigned (matching the existing practice in cases where we
got it right), and conditioning all the isel patterns on that flag. So
the fundamental change is in `IntrinsicsARM.td`, changing the
low-level IR intrinsics API; there are knock-on changes in
`arm_mve.td` (adjusting code gen for the ACLE intrinsics to use the
modified API) and in `ARMInstrMVE.td` (adjusting isel to expect the
new unsigned flags). The rest of this patch is boringly updating tests.
Reviewers: dmgreen, miyuki, MarkMurrayARM
Reviewed By: dmgreen
Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D72270
Simon Tatham [Mon, 6 Jan 2020 16:33:05 +0000 (16:33 +0000)]
[ARM,MVE] Support -ve offsets in gather-load intrinsics.
Summary:
The ACLE intrinsics with `gather_base` or `scatter_base` in the name
are wrappers on the MVE load/store instructions that take a vector of
base addresses and an immediate offset. The immediate offset can be up
to 127 times the alignment unit, and it can be positive or negative.
At the MC layer, we got that right. But in the Sema error checking for
the wrapping intrinsics, the offset was erroneously constrained to be
positive.
To fix this I've adjusted the `imm_mem7bit` class in the Tablegen that
defines the intrinsics. But that causes integer literals like
`0xfffffffffffffe04` to appear in the autogenerated calls to
`SemaBuiltinConstantArgRange`, which provokes a compiler warning
because that's out of the non-overflowing range of an `int64_t`. So
I've also tweaked `MveEmitter` to emit that as `-0x1fc` instead.
Updated the tests of the Sema checks themselves, and also adjusted a
random sample of the CodeGen tests to actually use negative offsets
and prove they get all the way through code generation without causing
a crash.
Reviewers: dmgreen, miyuki, MarkMurrayARM
Reviewed By: dmgreen
Subscribers: kristof.beyls, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D72268
Simon Tatham [Mon, 6 Jan 2020 16:28:18 +0000 (16:28 +0000)]
[ARM,MVE] Generate the right instruction for vmaxnmq_m_f16.
Summary:
Due to a copy-paste error in the isel patterns, the predicated version
of this intrinsic was expanding to the `VMAXNMT.F32` instruction
instead of `VMAXNMT.F16`. Similarly for vminnm.
Reviewers: dmgreen, miyuki, MarkMurrayARM
Reviewed By: dmgreen
Subscribers: kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72269
Matt Arsenault [Mon, 2 Sep 2019 07:27:20 +0000 (03:27 -0400)]
AMDGPU/GlobalISel: Select scalar v2s16 G_BUILD_VECTOR
Michał Górny [Sat, 4 Jan 2020 04:34:41 +0000 (05:34 +0100)]
[lldb] [Process/NetBSD] Remove unused orig_*ax use
orig_*ax logic is Linux-specific, and was never used on NetBSD.
In fact, its support seems to be a dead code entirely.
Differential Revision: https://reviews.llvm.org/D72195
Matt Arsenault [Wed, 1 Jan 2020 20:23:58 +0000 (15:23 -0500)]
AMDGPU/GlobalISel: Select more G_EXTRACTs correctly
This assumed a 32-bit extract size, which would produce invalid copies
with 64-bit extracts. Handle the easy case. Ideally we would have a
way to get the proper subreg index for any 32-bit offset, but there
should probably be a tablegenerated way of getting the subreg index
for any size and offset.
Nicolas Vasilache [Thu, 2 Jan 2020 20:25:21 +0000 (15:25 -0500)]
[mlir][Linalg] Reimplement and extend getStridesAndOffset
Summary: This diff reimplements getStridesAndOffset in a significantly simpler way by operating on the AffineExpr and calling into simplifyAffineExpr instead of rolling its own saturating arithmetic.
As a consequence it becomes quite simple to extend the behavior of getStridesAndOffset to encompass more cases by manipulating the AffineExpr more directly.
The divisions are still filtered out and continue to yield fully dynamic strides.
Simplifying the divisions is left for a later time if compelling use cases arise.
Relevant tests are added.
Reviewers: ftynse
Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72098
Mitchell Balan [Mon, 6 Jan 2020 14:21:41 +0000 (09:21 -0500)]
[clang-format] fix conflict between FormatStyle::BWACS_MultiLine and BeforeCatch/BeforeElse
Summary:
Found a bug introduced with BraceWrappingFlags AfterControlStatement MultiLine. This feature conflicts with the existing BeforeCatch and BeforeElse flags.
For example, our team uses BeforeElse.
if (foo ||
bar) {
doSomething();
}
else {
doSomethingElse();
}
If we enable MultiLine (which we'd really love to do) we expect it to work like this:
if (foo ||
bar)
{
doSomething();
}
else {
doSomethingElse();
}
What we actually get is:
if (foo ||
bar)
{
doSomething();
}
else
{
doSomethingElse();
}
Reviewers: MyDeveloperDay, Bouska, mitchell-stellar
Patch by: pastey
Subscribers: Bouska, cfe-commits
Tags: clang
Differential Revision: https://reviews.llvm.org/D71939
Simon Pilgrim [Mon, 6 Jan 2020 13:44:55 +0000 (13:44 +0000)]
[X86] Add extra PR43971 test case mentioned in D70267
Simon Pilgrim [Mon, 6 Jan 2020 13:16:43 +0000 (13:16 +0000)]
[CostModel][X86] Add missing scalar i64->f32 uitofp costs
Simon Pilgrim [Mon, 6 Jan 2020 10:42:48 +0000 (10:42 +0000)]
[DAG] DAGCombiner::XformToShuffleWithZero - use APInt::extractBits helper. NFCI.
James Henderson [Fri, 3 Jan 2020 14:06:57 +0000 (14:06 +0000)]
[test][DebugInfo][NFC] Rename method for clarity
The checkGetOrParseLineTableEmitsError function could end up generating
both recoverable and unrecoverable errors, but it is only intended for
handling the latter.
Reviewed by: dblaikie
Differential Revision: https://reviews.llvm.org/D72156
James Henderson [Mon, 6 Jan 2020 10:15:44 +0000 (10:15 +0000)]
[NFC] Fix trivial typos in comments
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D72143
Patch by Kazuaki Ishizaki.
Simon Pilgrim [Mon, 6 Jan 2020 10:20:20 +0000 (10:20 +0000)]
Fix MSVC "not all control paths return a value" warning. NFCI.
Sjoerd Meijer [Mon, 6 Jan 2020 09:56:02 +0000 (09:56 +0000)]
[ARM][MVE] More MVETailPredication debug messages. NFC.
I've added a few more debug messages to MVETailPredication because I wanted to
trace better which instructions are added/removed. And while I was at it, I
factored out one function which I thought was clearer, and have added some
comments to describe better the flow between MVETailPredication and
ARMLowOverheadLoops.
Differential Revision: https://reviews.llvm.org/D71549
Shengchen Kan [Tue, 31 Dec 2019 16:19:56 +0000 (00:19 +0800)]
Add interface emitPrefix for MCCodeEmitter
Differential Revision: https://reviews.llvm.org/D72047
Ehud Katz [Mon, 6 Jan 2020 08:51:55 +0000 (10:51 +0200)]
[APFloat] Fix compilation warnings
Kern Handa [Mon, 6 Jan 2020 09:01:59 +0000 (10:01 +0100)]
[mlir] Update mlir/CMakeLists.txt to install *.def files
This is needed to consume mlir after it has been installed of the source
tree. Without this, consuming mlir results a build error.
Differential Revision: https://reviews.llvm.org/D72232
Neil Henning [Wed, 11 Dec 2019 13:20:42 +0000 (13:20 +0000)]
Add ExternalAAWrapperPass to createLegacyPMAAResults.
Our out-of-tree custom aliasing solution for the HPC# Burst compiler
here at Unity makes use of the `ExternalAAwrapperPass` infrastructure to
insert our custom aliasing resolution into the core of LLVM. This is
great for all cases except for function inlining, where because
`createLegacyPMAAResults` does not make use of `ExternalAAWrapperPass`,
when we have a definite no-alias result within a function it won't be
propagated to the calling function during inlining.
This commit just rectifies this oversight by adding the missing
dependency.
Differential Revision: https://reviews.llvm.org/D71348
Ehud Katz [Mon, 6 Jan 2020 08:05:00 +0000 (10:05 +0200)]
[APFloat] Add recoverable string parsing errors to APFloat
Implementing the APFloat part in PR4745.
Differential Revision: https://reviews.llvm.org/D69770
Anton Afanasyev [Fri, 29 Nov 2019 11:22:10 +0000 (14:22 +0300)]
[Metadata] Add TBAA struct metadata to `AAMDNode`
Summary:
Make `AAMDNodes`' `getAAMetadata()` and `setAAMetadata()` to take `!tbaa.struct`
into account as well as `!tbaa`. This impacts llvm.org/pr42022.
This is a temprorary fix needed to keep `!tbaa.struct` tag by SROA pass.
New field `TBAAStruct` should be deleted when `!tbaa` tag replaces `!tbaa.struct`.
Merging two `!tbaa.struct`'s to one is conservatively considered to be `nullptr`
(giving `MayAlias`) -- this could be enhanced, but relying on the said future
replacement.
Reviewers: RKSimon, spatel, vporpo
Subscribers: hiraditya, kosarev, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70924
Kristina Brooks [Mon, 6 Jan 2020 07:21:13 +0000 (07:21 +0000)]
[Clang] Force rtlib=platform in test to avoid fails with CLANG_DEFAULT_RTLIB
Driver test `cross-linux.c` fails when CLANG_DEFAULT_RTLIB is "compiler-rt"
as the it expects a GCC-style `"crtbegin.o"` after `"crti.o"` but instead
receives something akin to this in the frontend invocation:
```
"crt1.o" "crti.o"
"/o/b/llvm/bin/../lib/clang/10.0.0/lib/linux/clang_rt.crtbegin-x86_64.o"
```
This patch adds an override to `cross-linux.c` tests so the expected result
is produced regardless of the compile-time default rtlib, as having tests
fail due to that is fairly confusing. After applying the patch, the test
passes regardless of the CLANG_DEFAULT_RTLIB setting.
Differential Revision: https://reviews.llvm.org/D72236
Craig Topper [Mon, 6 Jan 2020 06:54:34 +0000 (22:54 -0800)]
[TargetLowering] Use SETCC input type to call getBooleanContents instead of the setcc result type.
This isn't a functonal change since we also check the bit width is the
same and the input type is integer. This guarantees the input and
output type are the same. But passing the input type makes the code
more readable.
MaheshRavishankar [Thu, 2 Jan 2020 23:17:48 +0000 (15:17 -0800)]
[mlir][spirv] Update SPIR-V documentation with information about
lowering to SPIR-V dialect.
Add information about
- SPIRVTypeConverter
- SPIRVOpLowering
- Utility functions used in lowering to SPIR-V dialect.
Fangrui Song [Mon, 6 Jan 2020 04:00:07 +0000 (20:00 -0800)]
[MC] Reorder members of MCFragment's subclasses to decrease padding
On a 64-bit platform:
sizeof(MCBoundaryAlignFragment): 64 -> 56
sizeof(MCOrgFragment): 72 -> 64
sizeof(MCFillFragment): 80 -> 72
sizeof(MCLEBFragment): 88 -> 80
Fangrui Song [Mon, 6 Jan 2020 03:02:59 +0000 (19:02 -0800)]
[MC] Reorder MCFragment members to decrease padding
sizeof(MCFragment) does not change, but some if its subclasses do, e.g.
on a 64-bit platform,
sizeof(MCEncodedFragment) decreases from 64 to 56,
sizeof(MCDataFragment) decreases from 224 to 216.
QingShan Zhang [Mon, 6 Jan 2020 03:00:58 +0000 (03:00 +0000)]
[DAGCombine] Don't check the legality of type when combine the SIGN_EXTEND_INREG
This is the DAG node for SIGN_EXTEND_INREG :
t21: v4i32 = sign_extend_inreg t18, ValueType:ch:v4i16
It has two operands. The first one is the value it want to extend, and the second
one is the type to specify how to extend the value. For this example, it means
that, it is signed extend the t18(v4i32) from v4i16 to v4i32. That is
the semantics of c code:
vector int foo(vector int m) {
return m << 16 >> 16;
}
And it could be any vector type that hardware support the operation, though
the type 'v4i16' is NOT legal for the target. When we are trying to combine
the srl + sra, what we did now is calling the TLI.isOperationLegal(), which
will also check the legality of the type. That doesn't make sense.
Differential Revision: https://reviews.llvm.org/D70230
Fangrui Song [Mon, 6 Jan 2020 02:44:22 +0000 (18:44 -0800)]
[MC] Delete MCFragment::isDummy. NFC
isa<...>, dyn_cast<...> and cast<...> are used by other fragments.
Don't make MCDummyFragment special.
Craig Topper [Mon, 6 Jan 2020 01:01:57 +0000 (17:01 -0800)]
[X86] Improve v2i64->v2f32 and v4i64->v4f32 uint_to_fp on avx and avx2 targets.
Summary:
Based on Simon's D52965, but improved to handle strict fp and improve some of the shuffling.
Rather than use v2i1/v4i1 and let type legalization continue, just generate all the code with legal types and use an explicit shuffle.
I also added an explicit setcc to the v4i64 code to match the semantics of vselect which doesn't just use the sign bit. I'm also using a v4i64->v4i32 truncate instead of the shuffle in Simon's original code. With the setcc this will become a pack.
Future work can look into using X86ISD::BLENDV and a different shuffle that only moves the sign bit.
Reviewers: RKSimon, spatel
Reviewed By: RKSimon
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71956
Liu, Chen3 [Mon, 6 Jan 2020 01:33:28 +0000 (09:33 +0800)]
[NFC] Modify the format:
Drop the else since we alerady returned in the if.
Brian Gesiak [Sun, 5 Jan 2020 22:07:57 +0000 (17:07 -0500)]
[Coroutines] Remove corresponding phi values when apply simplifyTerminatorLeadingToRet
Summary:
In addMustTailToCoroResumes, we set musttail on those resume instructions that are followed by a ret instruction. This is done by simplifyTerminatorLeadingToRet which replace a sequence of branches leading to a ret with a clone of the ret.
However it forgets to remove corresponding PHI values that come from basic block of replaced branch, and may cause jumpthreading pass hangs (https://bugs.llvm.org/show_bug.cgi?id=43720)
This patch fix this issue
Test Plan:
cppcoro library with O3+flto
check-llvm
Reviewers: modocache, GorNishanov, lewissbaker
Reviewed By: modocache
Subscribers: mehdi_amini, EricWF, hiraditya, dexonsmith, jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71826
Patch by junparser (JunMa)!
Stephen Kelly [Sun, 5 Jan 2020 22:58:03 +0000 (22:58 +0000)]
Clang-format previous commit
Fangrui Song [Sun, 5 Jan 2020 22:02:18 +0000 (14:02 -0800)]
[MC][ARM] Delete MCSection::HasData and move SHF_ARM_PURECODE logic to ARMELFObjectWriter::addTargetSectionFlags
This simplifies the generic interface and also makes SHF_ARM_PURECODE
more robust (fixes a TODO). Inspecting MCDataFragment contents covers
more cases than MCObjectStreamer::EmitBytes.
Stephen Kelly [Sun, 5 Jan 2020 21:55:13 +0000 (21:55 +0000)]
Add missing test
Kristina Brooks [Sun, 5 Jan 2020 21:43:16 +0000 (21:43 +0000)]
[Gnu toolchain] Look at standard GCC paths for libstdcxx by default
Linux' current addLibCxxIncludePaths and addLibStdCxxIncludePaths
are actually almost non-Linux-specific at all, and can be reused
almost as such for all gcc toolchains. Only keep
Android/Freescale/Cray hacks in Linux's version.
Patch by sthibaul (Samuel Thibault)
Differential Revision: https://reviews.llvm.org/D69758
Fangrui Song [Sun, 5 Jan 2020 20:48:48 +0000 (12:48 -0800)]
[MC] Delete MCSection::{rbegin,rend}
Stephen Kelly [Sun, 5 Jan 2020 20:48:20 +0000 (20:48 +0000)]
Allow using traverse() with bindings
Stephen Kelly [Sun, 5 Jan 2020 20:27:37 +0000 (20:27 +0000)]
Fix oversight in AST traversal helper
Fangrui Song [Sun, 5 Jan 2020 20:02:11 +0000 (12:02 -0800)]
[MC] Merge MCSymbol::getSectionPtr into getSection and simplify
Fangrui Song [Sun, 5 Jan 2020 19:39:46 +0000 (11:39 -0800)]
[MC] Drop an unused rule about absolute temporary symbols
Simon Pilgrim [Sun, 5 Jan 2020 18:50:44 +0000 (18:50 +0000)]
[X86][SSE] Combine combineLogicBlendIntoConditionalNegate for VSELECT nodes (PR43660)
Attempt to use combineLogicBlendIntoConditionalNegate for (select M, (sub 0, X), X) -> (sub (xor X, M), M)
We limit this to cases that can't easily replace the VSELECT with a shuffle (non-constant masks) or where a BLENDV is likely to occur (which tends to result in slower codegen).
Simon Pilgrim [Sun, 5 Jan 2020 17:17:41 +0000 (17:17 +0000)]
[X86] Move combineLogicBlendIntoConditionalNegate before combineSelect. NFCI.
Updates function order in preparation of future fix for PR43660
Simon Pilgrim [Sun, 5 Jan 2020 15:24:23 +0000 (15:24 +0000)]
[X86] Merge (identical) LowerGC_TRANSITION_START and LowerGC_TRANSITION_END (NFC)
Silences a copy+paste analyzer warning - all they are doing are inserting NOOPs in exactly the same way.
David Green [Sun, 5 Jan 2020 10:59:21 +0000 (10:59 +0000)]
[ARM] Use isFMAFasterThanFMulAndFAdd for scalars as well as MVE vectors
This adds extra scalar handling to isFMAFasterThanFMulAndFAdd, allowing
the target independent code to handle more folds in more situations (for
example if the fast math flags are present, but the global
AllowFPOpFusion option isnt). It also splits apart the HasSlowFPVMLx
into HasSlowFPVFMx, to allow VFMA and VMLA to be controlled separately
if needed.
Differential Revision: https://reviews.llvm.org/D72139
David Green [Sun, 5 Jan 2020 10:54:49 +0000 (10:54 +0000)]
[ARM] Fill in FP16 FMA patterns
This adds fp16 variants of all the fma patterns in the ARM backend.
Differential Revision: https://reviews.llvm.org/D72138
David Green [Sat, 4 Jan 2020 20:16:32 +0000 (20:16 +0000)]
[ARM] Add and update FMA tests. NFC
David Green [Sun, 5 Jan 2020 11:23:35 +0000 (11:23 +0000)]
[ParserTest] Move raw string literal out of macro
Some combinations of gcc and ccache do not deal well with raw strings in
macros. Moving the string out to attempt to fix the bots.
Craig Topper [Sun, 5 Jan 2020 03:18:50 +0000 (19:18 -0800)]
[LegalizeVectorOps][X86] Enable expansion of vector fp_to_uint in LegalizeVectorOps to avoid scalarization.
The code here isn't great in all caess. Particularly v4f64->v4i32
on 64-bit AVX targets. But there is some improvement in some
configurations.
There's definitely some issues with computeNumSignBits with
X86ISD::STRICT_FCMP. As well as not being able to propagate sign
bits through merge_values nodes that get created during custom
legalization.
Craig Topper [Sun, 5 Jan 2020 02:14:33 +0000 (18:14 -0800)]
[TargetLowering] In expandFP_TO_UINT, add proper extend or truncate for the condition to feed the DstVT select.
Previously, for vectors we created a vselect with a condition that
didn't match what the target wanted according to getSetCCResultType.
To make up for this, X86 had a special DAG combine to detect if
the condition was all sign bits and then insert its own truncate
or extend. By adding the extend/truncate here explicitly we can
avoid that.
Craig Topper [Sun, 5 Jan 2020 01:03:33 +0000 (17:03 -0800)]
[LegalizeVectorOps] Split most of ExpandStrictFPOp into a separate UnrollStrictFPOp method. Call that method from ExpandUINT_TO_FLOAT.
ExpandStrictFPOp calls ExpandUINT_TO_FLOAT. Previously, ExpandUINT_TO_FLOAT
returned SDValue() if it wasn't able to handle and needed to unroll.
Then ExpandStrictFPOp would detect his SDValue() and do the unroll.
After this change, ExpandUINT_TO_FLOAT will directly call
UnrollStrictFPOp and return the unrolled result.
Fangrui Song [Sat, 4 Jan 2020 19:53:17 +0000 (11:53 -0800)]
[ELF] Drop const qualifier to fix -Wrange-loop-analysis. NFC
```
lld/ELF/Relocations.cpp:1622:56: warning: loop variable 'ts' of type 'const std::pair<ThunkSection *, uint32_t>' (aka 'const pair<lld::elf::ThunkSection *, unsigned int>') creates a copy from type 'const std::pair<ThunkSection *, uint32_t>' [-Wrange-loop-analysis]
for (const std::pair<ThunkSection *, uint32_t> ts : isd->thunkSections)
```
Drop const qualifier to fix -Wrange-loop-analysis.
We can make -Wrange-loop-analysis warnings (DiagnoseForRangeConstVariableCopies) on `const A` more
permissive on more types (e.g. POD -> trivially copyable), unfortunately it will not make std::pair
good, because `constexpr pair& operator=(const pair& p);` is unfortunately user-defined.
Reviewed By: Mordante
Differential Revision: https://reviews.llvm.org/D72211
Matt Arsenault [Sat, 4 Jan 2020 18:24:09 +0000 (13:24 -0500)]
GlobalISel: Scalarize all division operations
This only handled G_SDIV, but they all are trivially scalarizable.
Also define placeholder AMDGPU division legalizer rules.
Florian Hahn [Sat, 4 Jan 2020 18:44:38 +0000 (18:44 +0000)]
Revert "[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC)."
This reverts commit
51ef53f3bd23559203fe9af82ff2facbfedc1db3, as it
breaks some bots.
Florian Hahn [Sat, 4 Jan 2020 18:15:02 +0000 (18:15 +0000)]
[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC).
SCEVExpander modifies the underlying function so it is more suitable in
Transforms/Utils, rather than Analysis. This allows using other
transform utils in SCEVExpander.
Reviewers: sanjoy.google, efriedma, reames
Reviewed By: sanjoy.google
Differential Revision: https://reviews.llvm.org/D71537
Florian Hahn [Sat, 4 Jan 2020 18:20:55 +0000 (18:20 +0000)]
[SCEV] Remove unused ScalarEvolutionExpander.h includes (NFC).
Matt Arsenault [Sat, 4 Jan 2020 17:46:58 +0000 (12:46 -0500)]
GlobalISel: Define G_READCYCLECOUNTER
Matt Arsenault [Fri, 27 Dec 2019 15:17:45 +0000 (10:17 -0500)]
AMDGPU/GlobalISel: Refine SMRD selection rules
Fix selecting these for volatile global loads, and ensure the loads
are constant enough.
Matt Arsenault [Thu, 2 Jan 2020 19:45:11 +0000 (14:45 -0500)]
AMDGPU/GlobalISel: Legalize more odd sized loads
The attempts to widen sufficently aligned, odd sized loads wasn't
consistently applied.
Matt Arsenault [Mon, 23 Dec 2019 23:34:59 +0000 (18:34 -0500)]
AMDGPU/GlobalISel: Assume vcc phis for any vcc input
This produces more intelligible looking results, more comparabble to
the DAG output in the simplest cases. This is probably wrong in
complex control flow, but RegBankSelect doesn't attempt analyzing if
this is on a masked path for selecting the bank yet.
Florian Hahn [Sat, 4 Jan 2020 17:32:15 +0000 (17:32 +0000)]
[Pass Registration] XFAIL load_extension.ll test on macOS.
This test fails on macOS, causing the following bots to fail
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/7438/
http://green.lab.llvm.org/green/job/clang-stage1-RA/5034/
Error:
Error opening 'build/./lib/libBye.dylib': dlopen(build/./lib/libBye.dylib, 9): image not found
-load request ignored.
Matt Arsenault [Mon, 23 Dec 2019 19:39:01 +0000 (14:39 -0500)]
AMDGPU/GlobalISel: Implement applyMappingImpl less incorrectly
We're checking the current register bank of the registers in the
instruction, but the mapping may have inserted cross bank copies and
is expecting to replace the registers.
We mostly get away with this currently, because VGPR->SGPR copies are
illegal, and we assume this won't happen. In a future change, we'll
start relying on more cross register bank copies being inserted, and
this starts to break down.
Florian Hahn [Sat, 4 Jan 2020 17:12:24 +0000 (17:12 +0000)]
[cmake] Remove install from add_llvm_example_library.
This should fix
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/30086
Florian Hahn [Sat, 4 Jan 2020 15:01:43 +0000 (15:01 +0000)]
Re-apply "[Examples] Add IRTransformations directory to examples."
This reverts commit
19fd8925a4afe6efd248688cce06aceff50efe0c.
Should include a fix for PR44197.
Kazuaki Ishizaki [Sat, 4 Jan 2020 15:28:41 +0000 (10:28 -0500)]
NFC: Fix trivial typos in comments
alex-t [Sat, 4 Jan 2020 15:23:14 +0000 (18:23 +0300)]
[AMDGPU] need to insert wait between the scalar load and vector store to the same address to avoid WAR conflict.
Reviewers: rampitec, vpykhtin, nhaehnle
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D71934
Roman Lebedev [Sat, 4 Jan 2020 14:24:20 +0000 (17:24 +0300)]
[NFCI][InstCombine] Refactor 'sink negation into select if that folds one hand of select to 0' fold
I would think it's better than having two practically identical folds
next to eachother, but then generalization isn't all that pretty
due to the fact that we need to produce different `sub` each time..
This change is no-functional-changes-intended refactoring.
Roman Lebedev [Sat, 4 Jan 2020 13:50:53 +0000 (16:50 +0300)]
[InstCombine] Sink sub into hands of select if one hand becomes zero. Part 2 (PR44426)
This decreases use count of %Op0, makes one hand of select to be 0,
and possibly exposes further folding potential.
Name: sub %Op0, (select %Cond, %Op0, %FalseVal) -> select %Cond, 0, (sub %Op0, %FalseVal)
%Op0 = %TrueVal
%o = select i1 %Cond, i8 %Op0, i8 %FalseVal
%r = sub i8 %Op0, %o
=>
%n = sub i8 %Op0, %FalseVal
%r = select i1 %Cond, i8 0, i8 %n
Name: sub %Op0, (select %Cond, %TrueVal, %Op0) -> select %Cond, (sub %Op0, %TrueVal), 0
%Op0 = %FalseVal
%o = select i1 %Cond, i8 %TrueVal, i8 %Op0
%r = sub i8 %Op0, %o
=>
%n = sub i8 %Op0, %TrueVal
%r = select i1 %Cond, i8 %n, i8 0
https://rise4fun.com/Alive/aHRt
https://bugs.llvm.org/show_bug.cgi?id=44426
Roman Lebedev [Sat, 4 Jan 2020 13:43:34 +0000 (16:43 +0300)]
[NFC][InstCombine] 'subtract from one hands of select' pattern tests (PR44426)
https://bugs.llvm.org/show_bug.cgi?id=44426
Roman Lebedev [Sat, 4 Jan 2020 13:31:18 +0000 (16:31 +0300)]
[InstCombine] Sink sub into hands of select if one hand becomes zero (PR44426)
This decreases use count of %Op1, makes one hand of select to be 0,
and possibly exposes further folding potential.
Name: sub (select %Cond, %Op1, %FalseVal), %Op1 -> select %Cond, 0, (sub %FalseVal, %Op1)
%Op1 = %TrueVal
%o = select i1 %Cond, i8 %Op1, i8 %FalseVal
%r = sub i8 %o, %Op1
=>
%n = sub i8 %FalseVal, %Op1
%r = select i1 %Cond, i8 0, i8 %n
Name: sub (select %Cond, %TrueVal, %Op1), %Op1 -> select %Cond, (sub %TrueVal, %Op1), 0
%Op1 = %FalseVal
%o = select i1 %Cond, i8 %TrueVal, i8 %Op1
%r = sub i8 %o, %Op1
=>
%n = sub i8 %TrueVal, %Op1
%r = select i1 %Cond, i8 %n, i8 0
https://rise4fun.com/Alive/avL
https://bugs.llvm.org/show_bug.cgi?id=44426
Roman Lebedev [Sat, 4 Jan 2020 13:23:44 +0000 (16:23 +0300)]
[NFC][InstCombine] 'subtract of one hands of select' pattern tests (PR44426)
https://bugs.llvm.org/show_bug.cgi?id=44426
Alexey Lapshin [Tue, 24 Dec 2019 21:38:09 +0000 (00:38 +0300)]
[Transforms][GlobalSRA] huge array causes long compilation time and huge memory usage.
Summary:
For artificial cases (huge array, few usages), Global SRA optimization creates
a lot of redundant data. It creates an instance of GlobalVariable for each array
element. For huge array, that means huge compilation time and huge memory usage.
Following example compiles for 10 minutes and requires 40GB of memory.
namespace {
char LargeBuffer[64 * 1024 * 1024];
}
int main ( void ) {
LargeBuffer[0] = 0;
printf("\n ");
return LargeBuffer[0] == 0;
}
The fix is to avoid Global SRA for large arrays.
Reviewers: craig.topper, rnk, efriedma, fhahn
Reviewed By: rnk
Subscribers: xbolva00, lebedev.ri, lkail, merge_guards_bot, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71993
Simon Pilgrim [Sat, 4 Jan 2020 13:15:50 +0000 (13:15 +0000)]
[TargetLowering] SimplifyDemandedBits - call SimplifyMultipleUseDemandedBits for ISD::EXTRACT_VECTOR_ELT (REAPPLIED)
This patch attempts to peek through vectors based on the demanded bits/elt of a particular ISD::EXTRACT_VECTOR_ELT node, allowing us to avoid dependencies on ops that have no impact on the extract.
In particular this helps remove some unnecessary scalar->vector->scalar patterns.
The wasm shift patterns are annoying - @tlively has indicated that the wasm vector shift codegen are to be refactored in the near-term and isn't considered a major issue.
Reapplied after reversion at rL368660 due to PR42982 which was fixed at rGca7fdd41bda0.
Differential Revision: https://reviews.llvm.org/D65887
Martin Storsjö [Sun, 29 Dec 2019 22:32:22 +0000 (00:32 +0200)]
[LLD] [COFF] Don't error out on duplicate absolute symbols with the same value
Both MS link.exe and GNU ld.bfd handle it this way; one can have
multiple object files defining the same absolute symbols, as long
as it defines it to the same value. But if there are multiple absolute
symbols with differing values, it is treated as an error.
Differential Revision: https://reviews.llvm.org/D71981
Craig Topper [Sat, 4 Jan 2020 07:58:43 +0000 (23:58 -0800)]
[X86] Update MaxIndex test in x86-cmov-converter.ll to return the index and not use the index to look up the array after the loop.
This represents a more realistic version of the code being tested.
The cmov converter doesn't look at the code after the loop so
it doesn't matter for what's being tested.
But as noted in this twitter thread https://twitter.com/trav_downs/status/
1213311159413161987
gcc can turn the previous MaxIndex code into the MaxValue code. So
returning the index makes it a distinct case.
Kelvin Li [Sat, 4 Jan 2020 03:03:42 +0000 (22:03 -0500)]
[OpenMP] NFC: Fix trivial typos in comments
Submitted by: kiszk
Differential Revision: https://reviews.llvm.org/D72171
LLVM GN Syncbot [Sat, 4 Jan 2020 02:17:36 +0000 (02:17 +0000)]
[gn build] Port
5d304d68dd5
Daniel Sanders [Sat, 4 Jan 2020 02:13:50 +0000 (18:13 -0800)]
Revert "[gicombiner] Add GIMatchTree and use it for the code generation"
All the windows bots are failing match-tree.td and there's no obvious cause that
I can see. It's not just the %p formatting problem. My best guess is that
there's an ordering issue too but I'll need further information to figure that
out. Revert while I'm investigating.
This reverts commit
64f1bb5cd2c6d69af7c74ec68840029603560238 and
77d4b5f5feff663e70b347516cc4c77fa5cd2a20
Med Ismail Bennani [Sat, 28 Dec 2019 13:47:51 +0000 (14:47 +0100)]
[lldb/Command] Add --force option for `watchpoint delete` command
Currently, there is no option to delete all the watchpoint without LLDB
asking for a confirmation. Besides making the watchpoint delete command
homogeneous with the breakpoint delete command, this option could also
become handy to trigger automated watchpoint deletion i.e. using
breakpoint actions.
rdar://
42560586
Differential Revision: https://reviews.llvm.org/D72096
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Craig Topper [Sat, 4 Jan 2020 01:18:07 +0000 (17:18 -0800)]
[X86] Autogenerate complete checks. NFC
Francis Visoiu Mistrih [Fri, 3 Jan 2020 22:50:19 +0000 (14:50 -0800)]
[Remarks] Warn if a remark file is not found when processing static archives
Static archives contain object files which contain sections pointing to
external remark files.
When static archives are shipped without the remark files, dsymutil
shouldn't generate an error.
Instead, generate a warning to inform the user that remarks for that
library won't be available in the .dSYM.
Davide Italiano [Sat, 4 Jan 2020 00:49:51 +0000 (16:49 -0800)]
[UserExpression] Clean up `return` after `else`.
Daniel Sanders [Sat, 4 Jan 2020 00:51:28 +0000 (16:51 -0800)]
[gicombiner] Correct
64f1bb5cd2c to account for MSVC's %p format
Tyker [Fri, 3 Jan 2020 23:14:17 +0000 (00:14 +0100)]
LLVM GN Syncbot [Sat, 4 Jan 2020 00:24:04 +0000 (00:24 +0000)]
[gn build] Port
64f1bb5cd2c