Sanjay Patel [Thu, 7 Nov 2019 17:08:10 +0000 (12:08 -0500)]
[InstCombine] canonicalize shift+logic+shift to reduce dependency chain
shift (logic (shift X, C0), Y), C1 --> logic (shift X, C0+C1), (shift Y, C1)
This is an IR translation of an existing SDAG transform added here:
rL370617
So we again have 9 possible patterns with a commuted IR variant of each pattern:
https://rise4fun.com/Alive/VlI
https://rise4fun.com/Alive/n1m
https://rise4fun.com/Alive/1Vn
Part of the motivation is to allow easier recognition and subsequent
canonicalization of bswap patterns as discussed in PR43146:
https://bugs.llvm.org/show_bug.cgi?id=43146
We had to delay this transform because it used to allow the SLP vectorizer
to create awful reductions out of simple load-combines.
That problem was fixed with:
rL375025
(we'll bring back load combining in IR someday...)
The backend is also better equipped to deal with these patterns now
using hooks like TLI.getShiftAmountThreshold().
The only remaining potential controversy is that the -reassociate pass
tends to reverse this kind of pattern (to help GVN?). But since -reassociate
doesn't do anything with these specific patterns, there is no conflict currently.
Finally, there's a new pass proposal at D67383 for general tree-height-reduction
reassociation, and it could use a cost model to decide how to optimally rearrange
these kinds of ops for a target. That patch appears to be stalled.
Differential Revision: https://reviews.llvm.org/D69842
Simon Pilgrim [Thu, 7 Nov 2019 16:48:35 +0000 (16:48 +0000)]
X86FrameLowering - fix bool to unsigned cast static analyzer warnings. NFCI.
Simon Pilgrim [Thu, 7 Nov 2019 16:46:55 +0000 (16:46 +0000)]
MachineMemOperand::getBaseAlignment() - fix "shift of i32 then extended to i64" static analyzer warning. NFCI.
Simon Pilgrim [Thu, 7 Nov 2019 16:45:36 +0000 (16:45 +0000)]
TypeRecord - fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Thu, 7 Nov 2019 16:45:01 +0000 (16:45 +0000)]
PostRAScheduler - fix uninitialized variable warning. NFCI.
Simon Pilgrim [Thu, 7 Nov 2019 16:43:47 +0000 (16:43 +0000)]
ManagedStringPool - pre-increment iterator. NFC.
Simon Pilgrim [Thu, 7 Nov 2019 16:41:48 +0000 (16:41 +0000)]
X86CondBrFolding - remove non-existent fixBranchProb function. NFC.
Simon Pilgrim [Thu, 7 Nov 2019 15:35:07 +0000 (15:35 +0000)]
AsmWriterOperand - fix uninitialized variable warning. NFCI.
diggerlin [Thu, 7 Nov 2019 16:51:34 +0000 (11:51 -0500)]
Using crtp to refactor the xcoff section header
SUMMARY:
According to https://reviews.llvm.org/D68575#inline-617586, Create a NFC patch for it.
Using crtp to refactor the xcoff section header
Move the define of SectionFlagsReservedMask and SectionFlagsTypeMask from XCOFFDumper.cpp to XCOFFObjectFile.h
Reviewers: hubert.reinterpretcast,jasonliu
Subscribers: rupprecht, seiyai,hiraditya
Differential Revision: https://reviews.llvm.org/D69131
Jan Kratochvil [Thu, 7 Nov 2019 16:48:25 +0000 (17:48 +0100)]
[lldb] Comment typo fix
joanlluch [Thu, 7 Nov 2019 16:41:05 +0000 (17:41 +0100)]
comment shiftamountthreshold
Michał Górny [Thu, 7 Nov 2019 16:29:13 +0000 (17:29 +0100)]
[openmp] [test] Skip one more test that kills NetBSD buildbot
Alexey Bataev [Thu, 7 Nov 2019 16:07:56 +0000 (11:07 -0500)]
[OPENMP][DOCS] Update OpenMP status (NFC)
Summary: This is updating the OpenMP status table. Cray has volunteered for `defaultmap` and supporting `in_reduction` on the `target` construct, so the status on those entries from was changed from "unclaimed". Also, a new entry was added for supporting non-contiguous arrays sections on the `target update` directive.
Reviewers: ABataev, hfinkel, jdoerfert, kkwli0
Reviewed By: ABataev
Subscribers: guansong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69923
Edward Jones [Thu, 7 Nov 2019 15:44:38 +0000 (15:44 +0000)]
[Sema] Suppress -Wchar-subscripts if the index is a literal char
Assume that the user knows what they're doing if they provide a char
literal as an array index. This more closely matches the behavior of
GCC.
Differential Revision: https://reviews.llvm.org/D58896
Mitch Phillips [Thu, 7 Nov 2019 15:41:08 +0000 (07:41 -0800)]
[GWP-ASan] Respect compiler-rt's -fno-lto
https://bugs.llvm.org/show_bug.cgi?id=43722
GWP-ASan didn't include SANITIZER_COMMON_CFLAGS, and thus would produce
LLVM bitcode files, when compiler-rt is generally built without LTO.
Edward Jones [Thu, 3 Oct 2019 14:00:55 +0000 (15:00 +0100)]
[RISCV] Add riscv{32,64} to ALL_CRT_SUPPORTED_ARCH list
This allows crtbegin and crtend to be built, allowing RISC-V
to no longer rely on implementations from libgcc.
Differential revision: https://reviews.llvm.org/D68393
Sanjay Patel [Thu, 7 Nov 2019 15:28:25 +0000 (10:28 -0500)]
[SDAG] reduce code duplication; NFC
Melanie Blower [Tue, 5 Nov 2019 21:41:21 +0000 (13:41 -0800)]
Add support for options -frounding-math, ftrapping-math, -ffp-model=, and -ffp-exception-behavior=
Add options to control floating point behavior: trapping and
exception behavior, rounding, and control of optimizations that affect
floating point calculations. More details in UsersManual.rst.
Reviewers: rjmccall
Differential Revision: https://reviews.llvm.org/D62731
Edward Jones [Thu, 3 Oct 2019 13:49:08 +0000 (14:49 +0100)]
[RISCV] Improve sysroot computation if no GCC install detected
If a GCC installed is not detected, the driver would default to
the root of the filesystem. This is not ideal when this doesn't
match the install directory of the toolchain and can cause
undesireable behavior such as picking up system libraries or
the system linker when cross-compiling.
Differential Revision: https://reviews.llvm.org/D68391
Sanjay Patel [Thu, 7 Nov 2019 15:14:49 +0000 (10:14 -0500)]
[SDAG] reduce code duplication; NFC
Sven van Haastregt [Thu, 7 Nov 2019 15:00:19 +0000 (15:00 +0000)]
[OpenCL] Add geometric and relational builtin functions
Add the geometric and relational builtin functions from the OpenCL C
specification.
Patch by Pierre Gondois and Sven van Haastregt.
Differential Revision: https://reviews.llvm.org/D69908
Sven van Haastregt [Wed, 6 Nov 2019 11:53:19 +0000 (11:53 +0000)]
[OpenCL] Add integer builtin functions
This patch adds the integer builtin functions from the OpenCL C
specification.
Patch by Pierre Gondois and Sven van Haastregt.
Differential Revision: https://reviews.llvm.org/D69901
Raphael Isemann [Thu, 7 Nov 2019 14:47:01 +0000 (15:47 +0100)]
[lldb] Add -m option to 'target modules dump symtab' to disable demangling
Summary: This option was added downstream in swift-lldb. This upstreams this option as it seems useful and also adds the missing tests.
Reviewers: #lldb, kwk, labath
Reviewed By: kwk, labath
Subscribers: labath, kwk, abidh, JDevlieghere, lldb-commits
Tags: #lldb, #upstreaming_lldb_s_downstream_patches
Differential Revision: https://reviews.llvm.org/D69944
Simon Pilgrim [Thu, 7 Nov 2019 13:51:35 +0000 (13:51 +0000)]
SampleProfWriter - fix uninitialized variable warnings. NFCI.
Tim Northover [Thu, 7 Nov 2019 13:36:03 +0000 (13:36 +0000)]
CodeGen: set correct result for atomic compound expressions
Atomic compound expressions try to use atomicrmw if possible, but this
path doesn't set the Result variable, leaving it to crash in later code
if anything ever tries to use the result of the expression. This fixes
that issue by recalculating the new value based on the old one
atomically loaded.
Louis Dionne [Thu, 7 Nov 2019 12:06:14 +0000 (12:06 +0000)]
[libc++] Fix potential OOB in poisson_distribution
See details in the original Chromium bug report:
https://bugs.chromium.org/p/chromium/issues/detail?id=994957
Roman Lebedev [Thu, 7 Nov 2019 13:18:03 +0000 (16:18 +0300)]
[ConstantRange][LVI] Use overflow flags from `sub` to constrain the range
Summary:
This notably improves non-negativity deduction:
```
| statistic | old | new | delta | % change |
| correlated-value-propagation.NumAShrs | 209 | 227 | 18 | 8.6124% |
| correlated-value-propagation.NumAddNSW | 4972 | 4988 | 16 | 0.3218% |
| correlated-value-propagation.NumAddNUW | 7141 | 7148 | 7 | 0.0980% |
| correlated-value-propagation.NumAddNW | 12113 | 12136 | 23 | 0.1899% |
| correlated-value-propagation.NumAnd | 442 | 445 | 3 | 0.6787% |
| correlated-value-propagation.NumNSW | 7160 | 7176 | 16 | 0.2235% |
| correlated-value-propagation.NumNUW | 13306 | 13316 | 10 | 0.0752% |
| correlated-value-propagation.NumNW | 20466 | 20492 | 26 | 0.1270% |
| correlated-value-propagation.NumSDivs | 207 | 212 | 5 | 2.4155% |
| correlated-value-propagation.NumSExt | 6279 | 6679 | 400 | 6.3704% |
| correlated-value-propagation.NumSRems | 28 | 29 | 1 | 3.5714% |
| correlated-value-propagation.NumShlNUW | 2793 | 2796 | 3 | 0.1074% |
| correlated-value-propagation.NumShlNW | 3964 | 3967 | 3 | 0.0757% |
| correlated-value-propagation.NumUDivs | 353 | 358 | 5 | 1.4164% |
| instcount.NumAShrInst | 13763 | 13741 | -22 | -0.1598% |
| instcount.NumAddInst | 277349 | 277348 | -1 | -0.0004% |
| instcount.NumLShrInst | 27437 | 27463 | 26 | 0.0948% |
| instcount.NumOrInst | 102677 | 102678 | 1 | 0.0010% |
| instcount.NumSDivInst | 8732 | 8727 | -5 | -0.0573% |
| instcount.NumSExtInst | 80872 | 80468 | -404 | -0.4996% |
| instcount.NumSRemInst | 1679 | 1678 | -1 | -0.0596% |
| instcount.NumTruncInst | 62154 | 62153 | -1 | -0.0016% |
| instcount.NumUDivInst | 2526 | 2527 | 1 | 0.0396% |
| instcount.NumURemInst | 1589 | 1590 | 1 | 0.0629% |
| instcount.NumZExtInst | 69405 | 69809 | 404 | 0.5821% |
| instcount.TotalInsts | 7439575 | 7439574 | -1 | 0.0000% |
```
Reviewers: nikic, reames, spatel
Reviewed By: nikic
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69942
Sven van Haastregt [Tue, 5 Nov 2019 19:47:21 +0000 (19:47 +0000)]
[OpenCL] Add math and common builtin functions
Add the remaining math and common builtin functions from the OpenCL C
specification.
Patch by Pierre Gondois and Sven van Haastregt.
Differential Revision: https://reviews.llvm.org/D69883
Louis Dionne [Thu, 7 Nov 2019 12:30:32 +0000 (12:30 +0000)]
[libc++] Fixed copy/copy_n/copy_backward for compilers that do not support is_constant_evaluated.
Differential Revision: https://reviews.llvm.org/D69940
Louis Dionne [Wed, 6 Nov 2019 14:52:26 +0000 (14:52 +0000)]
[libc++] Fix some constexpr tests broken by D68837
This doesn't fix all the issues with D68837
evgeny [Thu, 7 Nov 2019 12:13:35 +0000 (15:13 +0300)]
[ThinLTO] Import readonly vars with refs
Patch allows importing declarations of functions and variables, referenced
by the initializer of some other readonly variable.
Differential revision: https://reviews.llvm.org/D69561
Sanjay Patel [Wed, 6 Nov 2019 22:24:09 +0000 (17:24 -0500)]
[SLP] allow forming 2-way reduction patterns
We have a vector compare reduction problem seen in PR39665 comment 2:
https://bugs.llvm.org/show_bug.cgi?id=39665#c2
Or slightly reduced here:
define i1 @cmp2(<2 x double> %a0) {
%a = fcmp ogt <2 x double> %a0, <double 1.0, double 1.0>
%b = extractelement <2 x i1> %a, i32 0
%c = extractelement <2 x i1> %a, i32 1
%d = and i1 %b, %c
ret i1 %d
}
SLP would not attempt to turn this into a vector reduction because there is an
artificial lower limit on that transform. We can not completely remove that limit
without inducing regressions though, so this patch just hacks an extra attempt at
creating a 2-way reduction to the end of the analysis.
As shown in the test file, we are still not getting some of the motivating cases,
so follow-on patches will be needed to solve those cases.
Differential Revision: https://reviews.llvm.org/D59710
Roman Lebedev [Thu, 7 Nov 2019 10:59:26 +0000 (13:59 +0300)]
[NFC][CVP] Add some tests for `sub` with preexisting no-wrap flags
We can use those to further limit the ranges in LVI.
Simon Atanasyan [Tue, 5 Nov 2019 08:21:04 +0000 (11:21 +0300)]
[mips] Set macros for Octeon+ CPU
Simon Atanasyan [Mon, 4 Nov 2019 23:21:16 +0000 (02:21 +0300)]
[mips] Add `octeon+` to the list of CPUs accepted by the driver
Simon Atanasyan [Mon, 4 Nov 2019 22:26:24 +0000 (01:26 +0300)]
[mips] Write `AFL_EXT_OCTEONP` flag to the `.MIPS.abiflags` section
Differential Revision: https://reviews.llvm.org/D69851
Simon Atanasyan [Mon, 4 Nov 2019 22:23:59 +0000 (01:23 +0300)]
[mips] Support `octeon+` CPU in the `.set arch=` directive
Differential Revision: https://reviews.llvm.org/D69850
Simon Atanasyan [Mon, 4 Nov 2019 22:12:10 +0000 (01:12 +0300)]
[mips] Implement Octeon+ `saa` and `saad` instructions
`saa` and `saad` are 32-bit and 64-bit store atomic add instructions.
memory[base] = memory[base] + rt
These instructions are available for "Octeon+" CPU. The patch adds support
for both instructions to MIPS assembler and diassembler and introduces new
CPU type - "octeon+".
Next patches will implement `.set arch=octeon+` directive and `AFL_EXT_OCTEONP`
ISA extension flag support.
Differential Revision: https://reviews.llvm.org/D69849
Hans Wennborg [Thu, 7 Nov 2019 10:00:02 +0000 (11:00 +0100)]
Revert f0c2a5a "[LV] Generalize conditions for sinking instrs for first order recurrences."
It broke Chromium, causing "Instruction does not dominate all uses!" errors.
See https://bugs.chromium.org/p/chromium/issues/detail?id=1022297#c1 for a
reproducer.
> If the recurrence PHI node has a single user, we can sink any
> instruction without side effects, given that all users are dominated by
> the instruction computing the incoming value of the next iteration
> ('Previous'). We can sink instructions that may cause traps, because
> that only causes the trap to occur later, but not on any new paths.
>
> With the relaxed check, we also have to make sure that we do not have a
> direct cycle (meaning PHI user == 'Previous), which indicates a
> reduction relation, which potentially gets missed by
> ReductionDescriptor.
>
> As follow-ups, we can also sink stores, iff they do not alias with
> other instructions we move them across and we could also support sinking
> chains of instructions and multiple users of the PHI.
>
> Fixes PR43398.
>
> Reviewers: hsaito, dcaballe, Ayal, rengolin
>
> Reviewed By: Ayal
>
> Differential Revision: https://reviews.llvm.org/D69228
Haojian Wu [Thu, 7 Nov 2019 09:53:19 +0000 (10:53 +0100)]
[clangd] NFC, hide the internal-only utility function lex.
To avoid any potential ODR violations.
Guilherme Andrade [Thu, 7 Nov 2019 09:38:25 +0000 (10:38 +0100)]
[lldb-server] Add setting to force 'g' packet use
Following up on https://reviews.llvm.org/D62221, this change introduces
the settings plugin.process.gdb-remote.use-g-packet-for-reading. When
they are on, 'g' packets are used for reading registers.
Using 'g' packets can improve performance by reducing the number of
packets exchanged between client and server when a large number of
registers needs to be fetched.
Differential revision: https://reviews.llvm.org/D62931
Haojian Wu [Wed, 6 Nov 2019 14:21:40 +0000 (15:21 +0100)]
[clang-rename] Respect the traversal scope when traversing the entire AST.
Summary:
This should be NFC to clang-rename, by default the traversal scope is
TUDecl. Traversing the TUDecl in clangd is a performance cliff, we should
avoid it.
Reviewers: ilya-biryukov
Subscribers: kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69892
Hans Wennborg [Thu, 7 Nov 2019 09:23:24 +0000 (10:23 +0100)]
Revert a5c8ec4 "[CGDebugInfo] Emit subprograms for decls when AT_tail_call is understood"
This caused Chromium builds to fail with "inlinable function call in a function
with debug info must have a !dbg location" errors. See
https://bugs.chromium.org/p/chromium/issues/detail?id=1022296#c1 for a
reproducer.
> Currently, clang emits subprograms for declared functions when the
> target debugger or DWARF standard is known to support entry values
> (DW_OP_entry_value & the GNU equivalent).
>
> Treat DW_AT_tail_call the same way to allow debuggers to follow cross-TU
> tail calls.
>
> Pre-patch debug session with a cross-TU tail call:
>
> ```
> * frame #0: 0x0000000100000fa4 main`target at b.c:4:3 [opt]
> frame #1: 0x0000000100000f99 main`main at a.c:8:10 [opt]
> ```
>
> Post-patch (note that the tail-calling frame, "helper", is visible):
>
> ```
> * frame #0: 0x0000000100000fa4 main`target at b.c:4:3 [opt]
> frame #1: 0x0000000100000f80 main`helper [opt] [artificial]
> frame #2: 0x0000000100000f99 main`main at a.c:8:10 [opt]
> ```
>
> rdar://
46577651
>
> Differential Revision: https://reviews.llvm.org/D69743
Ilya Biryukov [Thu, 7 Nov 2019 08:59:36 +0000 (09:59 +0100)]
[clangd] Add unit tests for comments in system headers
Anders Waldenborg [Thu, 7 Nov 2019 08:59:34 +0000 (09:59 +0100)]
[clang-format] Make '.clang-format' variants finding a loop (NFC)
This simplifies logic making it trivial to add searching for other
files later.
Differential revision: https://reviews.llvm.org/D68568
Ilya Biryukov [Thu, 7 Nov 2019 08:53:07 +0000 (09:53 +0100)]
[clangd] Set RetainCommentsFromSystemHeaders to true
clangd should retain comments from system headers.
fixes https://github.com/clangd/clangd/issues/96
Patch by lh123!
Differential revision: https://reviews.llvm.org/D69928
dfukalov [Wed, 6 Nov 2019 19:05:58 +0000 (22:05 +0300)]
[AMDGPU] Fix bug introduced in
47a5c36b37f0
Summary: [AMDGPU] Fix bug introduced in
47a5c36b37f0
Reviewers: foad, arsenm
Reviewed By: arsenm
Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69915
Ilya Biryukov [Thu, 7 Nov 2019 08:37:25 +0000 (09:37 +0100)]
[Syntax] Silence "unused function" warning in no-assert builds. NFC
A helper `isImpicitExpr` is only used inside assert.
Georgii Rymar [Wed, 6 Nov 2019 09:11:44 +0000 (12:11 +0300)]
[llvm-readobj] - Simplify elf-hash-symbols.test. NFCI.
It converts binary contents of .hash and .gnu.hash that were generated by a linker
to YAML descriptions.
I've also dropped Shift2 and BloomFilter values because they are not needed here.
Differential revision: https://reviews.llvm.org/D69881
Craig Topper [Thu, 7 Nov 2019 06:53:48 +0000 (22:53 -0800)]
[X86] Remove unused variable. NFC
Craig Topper [Thu, 7 Nov 2019 06:24:05 +0000 (22:24 -0800)]
[X86] Remove dead code from combineStore.
Leftovers from before we switched to widening legalization.
Fixes PR43919.
kristina [Thu, 7 Nov 2019 05:38:24 +0000 (05:38 +0000)]
[Clang] Add ENABLE_LINKER_BUILD_ID to Hurd driver.
This was added for Linux toolchains in rC271692, this
patch extends this to the Hurd toolchain.
Patch by sthibaul (Samuel Thibault)
Differential Revision: https://reviews.llvm.org/D69754
Eric Christopher [Thu, 7 Nov 2019 05:58:28 +0000 (21:58 -0800)]
Temporarily Revert "[LV] Apply sink-after & interleave-groups as VPlan transformations (NFC)"
as it's causing assert failures.
This reverts commit
100e797adb433724a17c9b42b6533cd634cb796b.
Kelvin Li [Wed, 6 Nov 2019 18:25:16 +0000 (13:25 -0500)]
[OPENMP] [DOCS] fix section formatting issues [NFC]
Differential Revision: https://reviews.llvm.org/D69909
Wenlei He [Fri, 1 Nov 2019 19:57:23 +0000 (12:57 -0700)]
Keep import function list for inlinee profile update
Summary:
When adjusting function entry counts after inlining, Funciton::setEntryCount is called without providing an import function list. The side effect of that is the previously set import function list will be dropped. The import function list is used by ThinLTO to help import hot cross module callee for LTO inlining, so dropping that during ThinLTO pre-link may adversely affect LTO inlining. The fix is to keep the list while updating entry counts for inlining.
Reviewers: wmi, davidxl, tejohnson
Subscribers: mehdi_amini, hiraditya, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69736
Danilo Carvalho Grael [Wed, 6 Nov 2019 22:02:58 +0000 (17:02 -0500)]
[AArch64][SVE] Add remaining patterns and intrinsics for add/sub/mad patterns
Add pattern matching and intrinsics for the following instructions:
predicated orr, eor, and, bic
predicated mul, smulh, umulh, sdiv, udiv, sdivr, udivr
predicated smax, umax, smin, umin, sabd, uabd
mad, msb, mla, mls
https://reviews.llvm.org/D69588
Nico Weber [Thu, 7 Nov 2019 01:52:29 +0000 (20:52 -0500)]
Revert "gn build: (manually) merge
b5913e6d2f"
This reverts commit
c52efdc52cef2597a1d21595a9685e2f798025b8,
because
b5913e6d2f got reverted.
Alexander Shaposhnikov [Thu, 7 Nov 2019 01:04:04 +0000 (17:04 -0800)]
Revert "Introduce llvm-install-name-tool"
This reverts commit
b5913e6d2f6d13fb753df701619731ca11936316.
Matt Arsenault [Thu, 29 Aug 2019 18:53:17 +0000 (14:53 -0400)]
AMDGPU: Select global atomicrmw fadd
This only works if there is no use of the return value.
Matt Arsenault [Thu, 29 Aug 2019 19:10:12 +0000 (15:10 -0400)]
TableGen: Remove assert that pattern results match input number
AMDGPU has some atomic instructions that do not return the previous
result, and can only be selected if there are no uses. The source
pattern will only match if the use is empty, so it should be safe to
discard the result.
Eric Christopher [Wed, 6 Nov 2019 23:56:41 +0000 (15:56 -0800)]
Temporarily Revert:
"[SLP] Generalization of stores vectorization."
"[SLP] Fix -Wunused-variable. NFC"
"[SLP] Vectorize jumbled stores."
As they're causing significant (10-30x) compile time regressions on
vectorizable code.
The primary cause of the compile-time regression is
f228b5371647f471853c5fb3e6719823a42fe451.
This reverts commits:
f228b5371647f471853c5fb3e6719823a42fe451
5503455ccb3f5fcedced158332c016c8d3a7fa81
21d498c9c0f32dcab5bc89ac593aa813b533b43a
shafik [Wed, 6 Nov 2019 23:57:52 +0000 (15:57 -0800)]
[LLDB] Adding caching to libc++ std::function formatter for lookups that require scanning symbols
Performance issues lead to the libc++ std::function formatter to be disabled.
This change is the first of two changes that should address the performance issues and allow us to enable the formatter again.
In some cases we end up scanning the symbol table for the callable wrapped by std::function for those cases we will now cache the results and used the cache in subsequent look-ups. This still leaves a large cost for the initial lookup which will be addressed in the next change.
Differential Revision: https://reviews.llvm.org/D67111
Stanislav Mekhanoshin [Wed, 6 Nov 2019 20:39:38 +0000 (12:39 -0800)]
[AMDGPU] Add handling of 160 bit registers in analyzeResourceUsage
This was omitted. Also SReg_96Reg missed IsSGPR assignment.
Differential Revision: https://reviews.llvm.org/D69919
Saleem Abdulrasool [Wed, 6 Nov 2019 23:40:07 +0000 (15:40 -0800)]
unwind: restore the LINKER_LANGUAGE
Have CMake treat the unwind libraries as C libraries rather than C++.
There is no C++ runtime dependency at runtime. This ensures that we do
not accidentally end up with a link against the C++ runtime.
We need to explicitly reset the implicitly linked libraries for C++ to
ensure that we do not have CMake force the link against the C++ runtime.
This adjustment should enable the NetBSD bots to be happy with this
change.
Saleem Abdulrasool [Wed, 6 Nov 2019 23:38:25 +0000 (15:38 -0800)]
unwind: reflow some of the build rules (NFC)
Reflow the CMake properties to take less vertical space. This just
makes it easier to read. NFC.
Philip Reames [Wed, 6 Nov 2019 23:30:47 +0000 (15:30 -0800)]
[LoopPred] Enable new transformation by default
The basic idea of the transform is to convert variant loop exit conditions into invariant exit conditions by changing the iteration on which the exit is taken when we know that the trip count is unobservable. See the original patch which introduced the code for a more complete explanation.
The individual parts of this have been reviewed, the result has been fuzzed, and then further analyzed by hand, but despite all of that, I will not be suprised to see breakage here. If you see problems, please don't hesitate to revert - though please do provide a test case. The most likely class of issues are latent SCEV bugs and without a reduced test case, I'll be essentially stuck on reducing them.
(Note: A bunch of tests were opted out of the new transform to preserve coverage. That landed in a previous commit to simplify revert cycles if they turn out to be needed.)
Philip Reames [Wed, 6 Nov 2019 23:16:43 +0000 (15:16 -0800)]
[LoopPred] Selectively disable to preserve test cases
I'm about to enable the new loop predication transform by default. It has the effect of completely destroying many read only loops - which happen to be a super common idiom in our test cases. So as to preserve test coverage of other transforms, disable the new transform where it would cause sharp test coverage regressions.
(This is semantically part of the enabling commit. It's committed separate to ease revert if the actual flag flip gets reverted.)
Nico Weber [Wed, 6 Nov 2019 23:26:36 +0000 (18:26 -0500)]
gn build: (manually) merge
b5913e6d2f
Eric Christopher [Wed, 6 Nov 2019 23:16:19 +0000 (15:16 -0800)]
When lowering calls and tail calls in AArch64, the register mask and
return value location depends on the calling convention of the callee.
`F.getCallingConv()`, however, is the caller CC. Correct it to the
callee CC from `CallLoweringInfo`.
Fixes PR43449
Patch by Shu-Chun Weng!
Jonas Devlieghere [Wed, 6 Nov 2019 23:22:17 +0000 (15:22 -0800)]
[lldb] Mark ASan & TSan as test dependencies
Without asan and tsan as test dependencies, you might end up with a
clang that points to sanitizer runtime library that hasn't been build
yet.
Alex Langford [Wed, 6 Nov 2019 23:12:31 +0000 (15:12 -0800)]
[test] Fix apple_simulator_test decorator when simulators are unavailable
In the case where xcodebuild fails as you set up simulator tests, you
would fail because `feature` is never defined.
Jonas Devlieghere [Wed, 6 Nov 2019 22:44:39 +0000 (14:44 -0800)]
[lldb] Remove dead code from STLUtils.h
Lang Hames [Wed, 6 Nov 2019 22:37:04 +0000 (14:37 -0800)]
[docs] Fix references to a renamed flag.
The -use-mcjit option was replaced with -jit-kind=mcjit a while back. This patch
updates the docs to reflect that.
Patch by Yu Jian. Thanks Jian!
Roman Lebedev [Wed, 6 Nov 2019 22:21:29 +0000 (01:21 +0300)]
[ConstantRange] Add `subWithNoWrap()` method
Summary:
Much like D67339, adds ConstantRange handling for
when we know no-wrap behavior of the `sub`.
Unlike addWithNoWrap(), we only get lucky re returning empty set
for signed wrap. For unsigned, we must perform overflow check manually.
A patch that makes use of this in LVI (CVP) to be posted later.
Reviewers: nikic, shchenz, efriedma
Reviewed By: nikic
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69918
Roman Lebedev [Wed, 6 Nov 2019 22:19:54 +0000 (01:19 +0300)]
[ConstantRange] Cleanup addWithNoWrap() by just piggybacking on sadd_sat()/uadd_sat()
As discussed in https://reviews.llvm.org/D69918
that happens to work as intended, and returns empty set if
there is always an overflow because we get lucky with intersection.
Since there's now an explicit test for that, let's prefer cleaner code.
Roman Lebedev [Wed, 6 Nov 2019 22:16:01 +0000 (01:16 +0300)]
[ConstantRange] TestAddWithNo*WrapExhaustive: check that all overflow means empty set
As disscussed in https://reviews.llvm.org/D69918 / https://reviews.llvm.org/D67339
that is an implied postcondition, but it's not really fully tested.
Lang Hames [Tue, 5 Nov 2019 00:00:09 +0000 (16:00 -0800)]
[JITLink] Refactor EH-frame handling to support eh-frames with existing relocs.
Some targets (E.g. MachO/arm64) use relocations to fix some CFI record fields
in the eh-frame section. When relocations are used the initial (pre-relocation)
content of the eh-frame section can no longer be interpreted by following the
eh-frame specification. This causes errors in the existing eh-frame parser.
This patch moves eh-frame handling into two LinkGraph passes that are run after
relocations have been parsed (but before they are applied). The first] pass
breaks up blocks in the eh-frame section into per-CFI-record blocks, and the
second parses blocks of (potentially multiple) CFI records and adds the
appropriate edges to any CFI fields that do not have existing relocations.
These passes can be run independently of one another. By handling eh-frame
splitting/fixing with LinkGraph passes we can both re-use existing relocations
for CFI record fields and avoid applying eh-frame fixups before parsing the
section (which would complicate the linker and require extra temporary
allocations of working memory).
Fred Riss [Wed, 6 Nov 2019 21:53:14 +0000 (13:53 -0800)]
Testuite: Support Asan test with remote testing
To do so, we need to register the sanitizer libraries with the target
so that they get uploaded before running. This patch adds a helper to
the test class to this effect.
shafik [Wed, 6 Nov 2019 22:06:56 +0000 (14:06 -0800)]
[LLDB] Fix handling for the clang name mangling extension for block invocations
Add support for clangs mangling extension for block invocations.
Differential Revision: https://reviews.llvm.org/D69738
Alexandre Ganea [Wed, 6 Nov 2019 22:11:12 +0000 (17:11 -0500)]
[Orc] Fix iterator usage after remove
Differential Revision: https://reviews.llvm.org/D69805
Kazu Hirata [Wed, 6 Nov 2019 22:16:48 +0000 (14:16 -0800)]
[JumpThreading] Factor out code to clone instructions (NFC)
Summary:
This patch factors out code to clone instructions -- partly for
readability and partly to facilitate an upcoming patch of my own.
Reviewers: wmi
Subscribers: hiraditya, jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69861
Philip Reames [Wed, 6 Nov 2019 22:05:59 +0000 (14:05 -0800)]
[WC] Fix a subtle bug in our definition of widenable branch
We had a subtle, but nasty bug in our definition of a widenable branch, and thus in the transforms which used that utility. Specifically, we returned true for any branch which included a widenable condition within it's condition, regardless of whether that widenable condition also had other uses.
The problem is that the result of the WC() call is defined to be one particular value. As such, all users must agree as to what that value is. If we widen a branch without also updating *all other users* of the WC in the same way, we have broken the required semantics.
Most of the textual diff is updating existing transforms not to leave dead uses hanging around. They're largely NFC as the dead instructions would be immediately deleted by other passes. The reason to make these changes is so that the transforms preserve the widenable branch form.
In practice, we don't get bitten by this only because it isn't profitable to CSE WC() calls and the lowering pass from guards uses distinct WC calls per branch.
Differential Revision: https://reviews.llvm.org/D69916
Dávid Bolvanský [Wed, 6 Nov 2019 22:07:17 +0000 (23:07 +0100)]
[Analysis] Attribute deref/deref_or_null should not prevent tail call optimization
Haibo Huang [Wed, 30 Oct 2019 17:33:05 +0000 (10:33 -0700)]
[lldb] Record framework build path and use it everywhere
This avoids config time dependencies on liblldb. And enables other refactoring.
Philip Reames [Wed, 6 Nov 2019 20:36:28 +0000 (12:36 -0800)]
[LoopPred] Fix two subtle issues found by inspection
This patch fixes two issues noticed by inspection when going to enable the loop predication code in IndVarSimplify.
Issue 1 - Both the LoopPredication transform, and the already on by default optimizeLoopExits transform, modify the exit count of the exits they modify. (either to 0 or Infinity) Looking at the code more closely, this was not reflected into SCEV and we were instead running later transforms with incorrect SCEVs. Fixing this requires forgetting the loop, weakening a too strong assert, and updating SCEV to not pessimize results when a loop is provable untaken. I haven't been able to find a test case to demonstrate the miscompile.
Issue 2 - For modules without a data layout, we can end up with unsized pointer typed exit counts. Just bail out of this case.
I think these are the last two issues which need addressed before we enable this by default. The code has already survived a decent amount of fuzzing without revealing either of the above.
Differential Revision: https://reviews.llvm.org/D69695
Joel E. Denny [Thu, 25 Jul 2019 03:14:32 +0000 (03:14 +0000)]
[lit] Protect full test suite from FILECHECK_OPTS
lit's test suite calls lit multiple times for various sample test
suites. `FILECHECK_OPTS` is safe for FileCheck calls in lit's test
suite. It's not safe for FileCheck calls in the sample test suites,
whose output affects the results of lit's test suite.
Without this patch, only one such sample test suite is protected from
`FILECHECK_OPTS`, and currently `shtest-shell.py` breaks with
`FILECHECK_OPTS=-vv`. Moreover, it's hard to predict the future,
especially false passes. Thus, this patch protects all existing and
future sample test suites from `FILECHECK_OPTS` (and the deprecated
`FILECHECK_DUMP_INPUT_ON_FAILURE`).
Reviewed By: probinson
Differential Revision: https://reviews.llvm.org/D65156
Craig Topper [Wed, 6 Nov 2019 20:39:09 +0000 (12:39 -0800)]
[X86] Clamp large constant shift amounts for MMX shift intrinsics to 8-bits.
The MMX intrinsics for shift by immediate take a 32-bit shift
amount but the hardware for shifting by immediate only encodes
8-bits. For the intrinsic we don't require the shift amount to
fit in 8-bits in the frontend because we don't check that its an
immediate in the frontend. If its is not an immediate we move it
to an MMX register and use the shift by register.
But if it is an immediate we'll use the shift by immediate
instruction. But we need to change the shift amount to 8-bits.
We were previously doing this accidentally by masking it in the
encoder. But this can make a large shift amount into a small
in bounds shift amount. Instead we should clamp larger shift
amounts to 255 so that the they don't become in bounds.
Fixes PR43922
Eli Friedman [Mon, 4 Nov 2019 22:46:42 +0000 (14:46 -0800)]
[AArch64] Re-add patterns for (s/u)mull2.
These patterns were added in D46009, but removed in D54276 due to
missing test coverage.
Differential Revision: https://reviews.llvm.org/D69831
paulhoad [Wed, 6 Nov 2019 20:02:16 +0000 (20:02 +0000)]
[clang-format] [NFC] update the documentation in Format.h to allow dump_format_style.py to get a little closer to being correct. (part 2)
Summary:
a change {D67541} cause LanguageStandard to now be subtly different from all other clang-format options, in that the Enum value (less the prefix) is not always allowed as valid as the configuration option.
This caused the ClangFormatStyleOptions.rst and the Format.h to diverge so that the ClangFormatStyleOptions.rst could no longer be generated from the Format.h using dump_format_stlye.py
This fix tried to remedy that:
1) by allowing an additional comment (in Format.h) after the enum to be used as the `in configuration ( XXXX )` text, and changing the dump_format_style.py to support that.
This makes the following code:
```
enum {
...
LS_Cpp03, // c++03
LS_Cpp11, // c++11
...
};
```
would render as:
```* ``LS_Cpp03`` (in configuration: ``c++03``)
* ``LS_Cpp11`` (in configuration: ``c++11``)
```
And we also move the deprecated alias into the text of the enum (otherwise it won't be added at the end as an option)
This patch includes a couple of other whitespace changes which help bring Format.h and ClangFormatStyleOptions.rst almost back into line and regeneratable... (there is still one more)
Reviewers: klimek, mitchell-stellar, sammccall
Reviewed By: mitchell-stellar, sammccall
Subscribers: mrexodia, cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D69433
Alexander Shaposhnikov [Thu, 17 Oct 2019 22:12:55 +0000 (15:12 -0700)]
Introduce llvm-install-name-tool
This diff adds a new "driver" for llvm-objcopy
which is supposed to emulate the behavior of install-name-tool.
Differential revision: https://reviews.llvm.org/D69146
Test plan: make check-all
Steven Wu [Wed, 6 Nov 2019 19:42:21 +0000 (11:42 -0800)]
Fix a typo in my previous commit
David Tenty [Wed, 6 Nov 2019 18:05:32 +0000 (13:05 -0500)]
[NFC] Add SUPPORT_PLUGINS to add_llvm_executable()
Summary:
this allows us to move logic about when it is appropriate set
LLVM_NO_DEAD_STRIP out of each tool and into add_llvm_executable,
which will enable future platform specific handling.
This is a follow on to the reverted D69356
Reviewers: hubert.reinterpretcast, beanz, lhames
Reviewed By: beanz
Subscribers: mgorny, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D69638
Quentin Colombet [Wed, 6 Nov 2019 19:09:12 +0000 (11:09 -0800)]
[GISel][ArtifactCombiner] Relax the constraint to combine unmerge with concat_vectors
The combine G_UNMERGE_VALUES with G_CONCAT_VECTORS used to only be performed
when the result type of the G_UNMERGE_VALUES was a vector type.
In other words, we were expecting that the G_UNMERGE_VALUES was effectively
the exact opposite of the G_CONCAT_VECTORS.
Lift that constraint by allowing any G_UNMERGE_VALUES to be combined
with any G_CONCAT_VECTORS (as long as the size of the different pieces
that we merge/unmerge match).
Differential Revision: https://reviews.llvm.org/D69288
Steven Wu [Wed, 6 Nov 2019 19:25:50 +0000 (11:25 -0800)]
[Object][MachO] Rewrite macho-invalid-fat-arch-size into YAML
Summary:
Rewrite one of the invalid macho test input file with YAML file. The
original invalid macho is breaking our internal test infrastusture
because it is too broken to be copy around.
Need to relax an assertion in the YAML/MachoEmitter to allow yaml2obj to
write an invalid object like this.
rdar://problem/
56879982
Reviewers: beanz, mtrent
Reviewed By: beanz
Subscribers: hiraditya, jkorous, dexonsmith, ributzka, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69856
Dávid Bolvanský [Wed, 6 Nov 2019 19:10:13 +0000 (20:10 +0100)]
[X86TargetTransformInfo] Fixed warning: Expression 'ISD == ISD::UREM' is always true. NFCI.
Simon Pilgrim [Wed, 6 Nov 2019 19:07:54 +0000 (19:07 +0000)]
[X86] Fix SLM v2i64 ADD/Sub/CMPEQ instruction schedules
Noticed while fixing the reduction costs for D59710 - the SLM model doesn't account for the poor throughput of v2i64 ops.
Numbers taken from Intel AOM (+ checked against Agner)
Simon Pilgrim [Wed, 6 Nov 2019 18:59:45 +0000 (18:59 +0000)]
[X86] Fix SLM v2f64 ADD/MUL + FP BLEND/HADD instruction schedules
Noticed while fixing the reduction costs for D59710 - the SLM model doesn't account for the poor throughput of v2f64/v2i64 ops.
Dávid Bolvanský [Wed, 6 Nov 2019 19:04:15 +0000 (20:04 +0100)]
[X86ISelLowering] Fixed typo in assert. NFCI.
Saleem Abdulrasool [Wed, 6 Nov 2019 18:51:42 +0000 (10:51 -0800)]
unwind: disable RTTI during the build of libunwind
Disable the type information emission for libunwind. libunwind does not
use `dynamic_cast`. This results in a smaller binary, and more
importantly, avoids the dependency on libc++abi. This ensures that we
have complete symbol resolution of symbols on ELF targets without
linking to the C++ runtime support library. This change avoids the
emission of a reference to `__si_class_type_info`.
Craig Topper [Wed, 6 Nov 2019 18:27:53 +0000 (10:27 -0800)]
[X86] Add 'fxsr' feature to -march=pentium2 to match X86.td and gcc.