Roman Lebedev [Mon, 19 Nov 2018 13:28:17 +0000 (13:28 +0000)]
[llvm-exegesis] Analysis: writeMeasurementValue(): don't alloc string for double each time.
Summary:
Test data: 500kLOC of benchmark.yaml, 23Mb. (that is a subset of the actual uops benchmark i was trying to analyze!)
Old time: (D54382)
```
Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (16 runs):
9024.354355 task-clock (msec) # 1.000 CPUs utilized ( +- 0.18% )
...
9.0262 +- 0.0161 seconds time elapsed ( +- 0.18% )
```
New time:
```
Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (16 runs):
8996.541057 task-clock (msec) # 0.999 CPUs utilized ( +- 0.19% )
...
9.0045 +- 0.0172 seconds time elapsed ( +- 0.19% )
```
-~0.3%, not that much. But this isn't the important part.
Old:
* calls to allocation functions: 2109712
* temporary allocations: 33112
* bytes allocated in total (ignoring deallocations): 4.43 GB
New:
* calls to allocation functions: 2095345 (-0.68%)
* temporary allocations: 18745 (-43.39% !!!)
* bytes allocated in total (ignoring deallocations): 4.31 GB (-2.71%)
Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn
Reviewed By: courbet
Subscribers: tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D54383
llvm-svn: 347199
Roman Lebedev [Mon, 19 Nov 2018 13:28:14 +0000 (13:28 +0000)]
[llvm-exegesis] Analysis::writeSnippet(): be smarter about memory allocations.
Summary:
Test data: 500kLOC of benchmark.yaml, 23Mb. (that is a subset of the actual uops benchmark i was trying to analyze!)
Old time: (D54381)
```
$ time ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html &> /dev/null
real 0m10.487s
user 0m9.745s
sys 0m0.740s
```
New time:
```
$ time ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html &> /dev/null
real 0m9.599s
user 0m8.824s
sys 0m0.772s
```
Not that much, around -9%. But that is not the good part yet, again.
Old:
* calls to allocation functions: 3347676
* temporary allocations: 277818
* bytes allocated in total (ignoring deallocations): 10.52 GB
New:
* calls to allocation functions: 2109712 (-36%)
* temporary allocations: 33112 (-88%)
* bytes allocated in total (ignoring deallocations): 4.43 GB (-58% *sic*)
Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn
Reviewed By: courbet, MaskRay
Subscribers: tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D54382
llvm-svn: 347198
Roman Lebedev [Mon, 19 Nov 2018 13:28:09 +0000 (13:28 +0000)]
[llvm-exegesis] InstructionBenchmarkClustering::dbScan(): use llvm::SetVector<> instead of ILLEGAL std::unordered_set<>
Summary:
Test data: 500kLOC of benchmark.yaml, 23Mb. (that is a subset of the actual uops benchmark i was trying to analyze!)
Old time:
```
$ time ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html &> /dev/null
real 0m24.884s
user 0m24.099s
sys 0m0.785s
```
New time:
```
$ time ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html &> /dev/null
real 0m10.469s
user 0m9.797s
sys 0m0.672s
```
So -60%. And that isn't the good bit yet.
Old:
* calls to allocation functions:
106560180 (yes, 107 *million* allocations.)
* bytes allocated in total (ignoring deallocations): 12.17 GB
New:
* calls to allocation functions: 3347676 (-96.86%) (just 3 mil)
* bytes allocated in total (ignoring deallocations): 10.52 GB (~2GB less)
---
Two points i want to raise:
* `std::unordered_set<>` should not have been used there in the first place.
It is banned by the https://llvm.org/docs/ProgrammersManual.html#other-set-like-container-options
* There is no tests, so i'm not fully sure this is correct.
Since it was unordered set, i guess there are zero restrictions on the order, and anything will be ok?
* I tried other containers suggested in https://llvm.org/docs/ProgrammersManual.html#set-like-containers-std-set-smallset-setvector-etc,
this `llvm::SetVector<>` seems to be best here.
Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn
Reviewed By: courbet
Subscribers: kristina, bobsayshilol, tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D54381
llvm-svn: 347197
Anastasia Stulova [Mon, 19 Nov 2018 12:43:39 +0000 (12:43 +0000)]
Fixed uninitialized variable issue.
This commit should fix failing bots.
llvm-svn: 347196
Simon Pilgrim [Mon, 19 Nov 2018 12:29:41 +0000 (12:29 +0000)]
[X86] Add codegen tests for slow-shld scalar funnel shifts
llvm-svn: 347195
Michael Platings [Mon, 19 Nov 2018 12:16:05 +0000 (12:16 +0000)]
Test commit - delete trailing space.
llvm-svn: 347194
Michael Platings [Mon, 19 Nov 2018 12:10:07 +0000 (12:10 +0000)]
Test commit - delete a trailing space.
llvm-svn: 347193
Nicolai Haehnle [Mon, 19 Nov 2018 12:03:11 +0000 (12:03 +0000)]
AMDGPU/InsertWaitcnts: Some more const-correctness
Reviewers: msearles, rampitec, scott.linder, kanarayan
Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits, hakzsam
Differential Revision: https://reviews.llvm.org/D54225
llvm-svn: 347192
Sam Parker [Mon, 19 Nov 2018 11:34:40 +0000 (11:34 +0000)]
[ARM] Remove trunc sinks in ARM CGP
Truncs are treated as sources if their produce a value of the same
type as the one we currently trying to promote. Truncs used to be
considered as a sink if their operand was the same value type.
We now allow smaller types in the search, so we should search through
truncs that produce a smaller value. These truncs can then be
converted to an AND mask.
This leaves sinks as being:
- points where the value in the register is being observed, such as
an icmp, switch or store.
- points where value types have to match, such as calls and returns.
- zext are included to ease the transformation and are generally
removed later on.
During this change, it also became apart from truncating sinks was
broken: if a sink used a source, its type information had already
been lost by the time the truncation happens. So I've changed the
method of caching the type information.
Differential Revision: https://reviews.llvm.org/D54515
llvm-svn: 347191
John Brawn [Mon, 19 Nov 2018 11:31:24 +0000 (11:31 +0000)]
[LICM] Make LICM able to hoist phis
The general approach taken is to make note of loop invariant branches, then when
we see something conditional on that branch, such as a phi, we create a copy of
the branch and (empty versions of) its successors and hoist using that.
This has no impact by itself that I've been able to see, as LICM typically
doesn't see such phis as they will have been converted into selects by the time
LICM is run, but once we start doing phi-to-select conversion later it will be
important.
Differential Revision: https://reviews.llvm.org/D52827
llvm-svn: 347190
Anastasia Stulova [Mon, 19 Nov 2018 11:00:14 +0000 (11:00 +0000)]
[OpenCL] Fix address space deduction in template args.
Don't deduce address spaces for non-pointer-like types
in template args.
Fixes PR38603!
Differential Revision: https://reviews.llvm.org/D54634
llvm-svn: 347189
Benjamin Kramer [Mon, 19 Nov 2018 10:59:12 +0000 (10:59 +0000)]
Remove unused variable. NFC.
llvm-svn: 347188
Anton Korobeynikov [Mon, 19 Nov 2018 10:43:02 +0000 (10:43 +0000)]
[MSP430] Optimize srl/sra in case of A >> (8 + N)
There is no variable-length shifts on MSP430. Therefore
"eat" 8 bits of shift via bswap & ext.
Path by Kristina Bessonova!
Differential Revision: https://reviews.llvm.org/D54623
llvm-svn: 347187
Serge Guelton [Mon, 19 Nov 2018 10:05:28 +0000 (10:05 +0000)]
Fix disturbing warning - NFCI
llvm-svn: 347186
Craig Topper [Mon, 19 Nov 2018 07:22:26 +0000 (07:22 +0000)]
[X86] Use a pcmpgt with 0 instead of psrad 31, to fill elements with the sign bit in v4i32 MULH lowering.
The shift requires a copy to avoid clobbering a register. Comparing with 0 uses an xor to produce 0 that will be overwritten with the compare results. So still requires 2 instructions, but should be one byte shorter since it doesn't need to encode an immediate.
llvm-svn: 347185
Fangrui Song [Mon, 19 Nov 2018 06:28:15 +0000 (06:28 +0000)]
[LoopSimplifyCFG] Add requires: asserts after rL347183
llvm-svn: 347184
Max Kazantsev [Mon, 19 Nov 2018 05:54:38 +0000 (05:54 +0000)]
[LoopSimplifyCFG] Teach LoopSimplifyCFG to constant-fold branches and switches
This patch introduces infrastructure and the simplest case for constant-folding
of branch and switch instructions within loop into unconditional branches.
It is useful as a cleanup for such passes as loop unswitching that sometimes
produce such branches.
Only the simplest case supported in this patch: after the folding, no block
should become dead or stop being part of the loop. Support for more
sophisticated cases will go separately in follow-up patches.
Differential Revision: https://reviews.llvm.org/D54021
Reviewed By: anna
llvm-svn: 347183
Vedant Kumar [Mon, 19 Nov 2018 05:23:16 +0000 (05:23 +0000)]
[ProfileSummary] Standardize methods and fix comment
Every Analysis pass has a get method that returns a reference of the Result of
the Analysis, for example, BlockFrequencyInfo
&BlockFrequencyInfoWrapperPass::getBFI(). I believe that
ProfileSummaryInfo::getPSI() is the only exception to that, as it was returning
a pointer.
Another change is renaming isHotBB and isColdBB to isHotBlock and isColdBlock,
respectively. Most methods use BB as the argument of variable names while
methods usually refer to Basic Blocks as Blocks, instead of BB. For example,
Function::getEntryBlock, Loop:getExitBlock, etc.
I also fixed one of the comments.
Patch by Rodrigo Caetano Rocha!
Differential Revision: https://reviews.llvm.org/D54669
llvm-svn: 347182
Craig Topper [Mon, 19 Nov 2018 04:33:20 +0000 (04:33 +0000)]
[X86] Use compare with 0 to fill an element with sign bits when sign extending to v2i64 pre-sse4.1
Previously we used an arithmetic shift right by 31, but that requires a copy to preserve the input. So we might as well materialize a zero and compare to it since the comparison will overwrite the register that contains the zeros. This should be one byte shorter.
llvm-svn: 347181
Craig Topper [Mon, 19 Nov 2018 00:33:16 +0000 (00:33 +0000)]
[X86] Remove most of the SEXTLOAD Custom setOperationAction calls under -x86-experimental-vector-widening-legalization.
Leave just the v4i8->v4i64 and v8i8->v8i64, but only enable them on pre-sse4.1 targets when 64-bit mode is enabled. In those cases we end up creating sext loads that get scalarized to code that looks better than what we get from loading into a vector register and doing a multiple step sign extend using unpacks and shifts.
llvm-svn: 347180
Brad Smith [Mon, 19 Nov 2018 00:21:06 +0000 (00:21 +0000)]
[PowerPC] Set the default PLT mode on OpenBSD/powerpc to Secure PLT.
OpenBSD/powerpc only supports Secure PLT.
llvm-svn: 347179
Brad Smith [Sun, 18 Nov 2018 22:30:58 +0000 (22:30 +0000)]
Replace the UTF-8 characters in the error message.
llvm-svn: 347178
Simon Pilgrim [Sun, 18 Nov 2018 22:13:31 +0000 (22:13 +0000)]
[X86][SSE] Add SimplifyDemandedVectorElts support for SSE packed i2fp conversions.
llvm-svn: 347177
Craig Topper [Sun, 18 Nov 2018 21:28:50 +0000 (21:28 +0000)]
[X86] Add custom type legalization for extending v4i8/v4i16->v4i64.
Pre-SSE4.1 sext_invec for v2i64 is complicated because we don't have a v2i64 sra instruction. So instead we sign extend to i32 using unpack and sra, then copy the elements and do a v4i32 sra to fill with sign bits, then interleave the i32 sign extend and the sign bits. So really we're doing to two sign extends but only using half of the v4i32 intermediate result.
When the result is more than 128 bits, default type legalization would prefer to split the destination type all the way down to v2i64 with shuffles followed by v16i8/v8i16->v2i64 sext_inreg operations. This results in more instructions than necessary because we are only utilizing the lower 2 elements of the v4i32 intermediate result. Instead we can custom split a v4i8/v4i16->v4i64 sign_extend. Then we can sign extend v4i8/v4i16->v4i32 invec producing a full v4i32 result. Create the sign bit vector as a v4i32 then split and interleave with the sign bits using an punpackldq and punpackhdq.
llvm-svn: 347176
Craig Topper [Sun, 18 Nov 2018 21:28:47 +0000 (21:28 +0000)]
[X86] Add a 32-bit command line with only sse2 to vector-sext.ll and vector-sext.ll to show some of the scalarized load sequences without 64-bit scalar support.
Some of these sequeces look pretty bad since we have to copy the sign bit from a 32 bit register to a 64 bit register to finish a sign extend.
llvm-svn: 347175
Zachary Turner [Sun, 18 Nov 2018 20:48:25 +0000 (20:48 +0000)]
Revert "Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD"
This breaks many tests on Windows, which now all fail with an error such
as "Unable to read memory at address <xxxxxxxx>".
llvm-svn: 347174
Simon Pilgrim [Sun, 18 Nov 2018 20:21:52 +0000 (20:21 +0000)]
[X86][SSE] Add SimplifyDemandedVectorElts support for SSE splat-vector-shifts.
SSE vector shifts only use the bottom 64-bits of the shift amount vector.
llvm-svn: 347173
Craig Topper [Sun, 18 Nov 2018 18:11:25 +0000 (18:11 +0000)]
[X86] Disable combineToExtendVectorInReg under -x86-experimental-vector-widening-legalization. Add custom type legalization for extends.
If we widen illegal types instead of promoting, we should be able to rely on the type legalizer to create the vector_inreg operations for us with some caveats.
This patch disables combineToExtendVectorInReg when we are using widening.
I've enabled custom legalization for v8i8->v8i64 extends under avx512f since the type legalizer would want to create a vector_inreg with a v64i8 input type which isn't legal without avx512bw. So we go to v16i8 with custom code using the relaxation of rules we get from D54346.
I've also enable custom legalization of v8i64 and v16i32 operations with with AVX. When the input type is 128 bits, the default splitting legalization would extend first 128->256, then do the a split to two 128 pieces. Extend each half to 256 and then concat the result. The custom legalization I've added instead uses a 128->256 bit vector_inreg extend that only reads the lower 64-bits for the low half of the split. Then shuffles the high 64-bits to the low 64-bits and does another vector_inreg extend.
llvm-svn: 347172
Craig Topper [Sun, 18 Nov 2018 17:59:28 +0000 (17:59 +0000)]
[X86] Lower v16i16->v8i16 truncate using an 'and' with 255, an extract_subvector, and a packuswb instruction.
Summary: This is an improvement over the two pshufbs and punpcklqdq we'd get otherwise.
Reviewers: RKSimon, spatel
Reviewed By: RKSimon
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54671
llvm-svn: 347171
Sanjay Patel [Sun, 18 Nov 2018 17:36:23 +0000 (17:36 +0000)]
[DAG] add undef simplifications for select nodes
Sadly, this duplicates (twice) the logic from InstSimplify. There
might be some way to at least share the DAG versions of the code,
but copying the folds seems to be the standard method to ensure
that we don't miss these folds.
Unlike in IR, we don't run DAGCombiner to fixpoint, so there's no
way to ensure that we do these kinds of simplifications unless the
code is repeated at node creation time and during combines.
There were other tests that would become worthless with this
improvement that I changed as pre-commits:
rL347161
rL347164
rL347165
rL347166
rL347167
I'm not sure how to salvage the remaining tests (diffs in this patch).
So the x86 tests verify that the new code is working as intended.
The AMDGPU test is actually similar to my motivating case: we have
some undef value that has survived to machine IR in an x86 test, and
then it gets folded in some weird way, or we crash if we don't transfer
the undef flag. But we would have been better off never getting to that
point by doing these simplifications.
This will lead back to PR32023 someday...
https://bugs.llvm.org/show_bug.cgi?id=32023
llvm-svn: 347170
Simon Pilgrim [Sun, 18 Nov 2018 17:24:59 +0000 (17:24 +0000)]
Remove unused variable. NFCI.
llvm-svn: 347169
Simon Pilgrim [Sun, 18 Nov 2018 17:15:06 +0000 (17:15 +0000)]
[X86][SSE] Split IsSplatValue into GetSplatValue and IsSplatVector
Refactor towards making this recursive (necessary for PR38243 rotation splat detection).
IsSplatVector returns the original vector source of the splat and the splat index.
GetSplatValue returns the scalar splatted value as an extraction from IsSplatVector.
llvm-svn: 347168
Sanjay Patel [Sun, 18 Nov 2018 16:56:17 +0000 (16:56 +0000)]
[x86] regenerate full checks; NFC
llvm-svn: 347167
Sanjay Patel [Sun, 18 Nov 2018 16:50:44 +0000 (16:50 +0000)]
[SystemZ] make test immune to improvements in undef simplification
llvm-svn: 347166
Sanjay Patel [Sun, 18 Nov 2018 16:50:16 +0000 (16:50 +0000)]
[Hexagon] make tests immune to improvements in undef simplification
llvm-svn: 347165
Sanjay Patel [Sun, 18 Nov 2018 16:49:42 +0000 (16:49 +0000)]
[ARM] make test immune to improvements in undef simplification
llvm-svn: 347164
Aaron Ballman [Sun, 18 Nov 2018 16:41:06 +0000 (16:41 +0000)]
Add the abseil-duration-factory-scale check.
This check removes unneeded scaling of arguments when calling Abseil Time factory functions.
Patch by Hyrum Wright.
llvm-svn: 347163
Simon Pilgrim [Sun, 18 Nov 2018 15:52:08 +0000 (15:52 +0000)]
[X86][SSE] Relax IsSplatValue - remove the 'variable shift' limit on subtracts.
Means we don't use the per-lane-shifts as much when we can cheaply use the older splat-variable-shifts.
llvm-svn: 347162
Sanjay Patel [Sun, 18 Nov 2018 15:27:19 +0000 (15:27 +0000)]
[x86] make tests immune to improvements in undef handling
llvm-svn: 347161
Sanjay Patel [Sun, 18 Nov 2018 14:39:03 +0000 (14:39 +0000)]
[SelectionDAG] simplify code; NFC
llvm-svn: 347160
Simon Pilgrim [Sun, 18 Nov 2018 14:35:57 +0000 (14:35 +0000)]
[X86][SSE] Add some generic masked gather codegen tests
llvm-svn: 347159
Simon Pilgrim [Sun, 18 Nov 2018 13:34:53 +0000 (13:34 +0000)]
[X86][SSE] Use raw shuffle mask decode in SimplifyDemandedVectorEltsForTargetNode (PR39549)
We were using the 'normalized' shuffle mask from resolveTargetShuffleInputs, which replaces zero/undef inputs with sentinel values. For SimplifyDemandedVectorElts we need the raw mask so we can correctly demand those 'zero' inputs that got normalized away, this requires an extra bit of logic to locally normalize undef inputs.
llvm-svn: 347158
Kristof Umann [Sun, 18 Nov 2018 12:47:03 +0000 (12:47 +0000)]
[analyzer][NFC] Move CheckerOptInfo to CheckerRegistry.cpp, and make it local
CheckerOptInfo feels very much out of place in CheckerRegistration.cpp, so I
moved it to CheckerRegistry.h.
Differential Revision: https://reviews.llvm.org/D54397
llvm-svn: 347157
Kamil Rytarowski [Sun, 18 Nov 2018 12:13:51 +0000 (12:13 +0000)]
Swap order of discovering of -ltinfo and -lterminfo
Summary:
NetBSD ships with native curses(3) and -ltinfo is a part of ncurses.
Set -lterminfo before -ltinfo, as it allows to prioritize native curses
libraries. Mixing curses and ncurses does not work well, especially
in software built on top of llvm.
Original patch by Ryo Onodera (NetBSD) in pkgsrc.
Reviewers: labath, dim, mgorny
Reviewed By: dim, mgorny
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54650
llvm-svn: 347156
Heejin Ahn [Sun, 18 Nov 2018 11:58:47 +0000 (11:58 +0000)]
[WebAssembly] Add null streamer support
Summary: Now `llc -filetype=null` works.
Reviewers: eush
Subscribers: dschuff, jgravelle-google, sbc100, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D54660
llvm-svn: 347155
Heejin Ahn [Sun, 18 Nov 2018 11:53:35 +0000 (11:53 +0000)]
[WebAssembly] Add equality comparison operators for WasmEventType
Summary:
This was missing in D54096. Independent tests for this is not available
here, because these are used in lld.
Reviewers: sbc100
Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D54662
llvm-svn: 347154
Kristof Umann [Sun, 18 Nov 2018 11:34:10 +0000 (11:34 +0000)]
[analyzer][UninitializedObjectChecker] Uninit regions are only reported once
Especially with pointees, a lot of meaningless reports came from uninitialized
regions that were already reported. This is fixed by storing all reported fields
to the GDM.
Differential Revision: https://reviews.llvm.org/D51531
llvm-svn: 347153
Jan Kratochvil [Sun, 18 Nov 2018 09:36:36 +0000 (09:36 +0000)]
cmake: z3: Remove EXACT from 4.7.1 after being compatible with 4.8.1
After check-in of D54391 a comment there by @mikhail.ramalho says:
Since we're supporting version 4.8.1 now, the cmake file should be changed to
"minimum" instead of "exact".
Differential Revision: https://reviews.llvm.org/D54535
llvm-svn: 347152
Craig Topper [Sun, 18 Nov 2018 08:30:09 +0000 (08:30 +0000)]
[X86] Add -x86-experimental-vector-widening-legalization check to combineSelect and combineSetCC to cover vXi16/vXi8 promotion without BWI.
I don't yet have any test cases for this, but its the right thing to do based on log file inspection.
llvm-svn: 347151
Craig Topper [Sun, 18 Nov 2018 07:35:08 +0000 (07:35 +0000)]
[X86] Rename WidenMaskArithmetic->PromoteMaskArithmetic since we usually use widen to refer to adding elements not making elements larger. NFC
llvm-svn: 347150
Craig Topper [Sun, 18 Nov 2018 05:53:21 +0000 (05:53 +0000)]
[X86] Don't use a pmaddwd for vXi32 multiply if the inputs are zero extends from i8 or smaller without SSE4.1. Prefer to shrink the mul instead.
The zero extend will require two stages of unpacks to implement. So its better to shrink the multiply using pmullw and then extend that result back to v4i32 using a single unpack.
llvm-svn: 347149
John Regehr [Sun, 18 Nov 2018 01:51:43 +0000 (01:51 +0000)]
tighten up a couple of assertions. hitting the BitPosition == BitWidth case that was previously not caught resulted in nasty corruption of APInts that (on my system at least) could not be detected using UBSan, ASan, or Valgrind. this patch does not cause any extra failures in a check-all nor does it interfere with bootstrapping. David Blaikie informally approved this change.
llvm-svn: 347148
Vedant Kumar [Sun, 18 Nov 2018 00:29:58 +0000 (00:29 +0000)]
[CorrelatedValuePropagation] Preserve debug locations (PR38178)
Fix all of the missing debug location errors in CVP found by debugify.
This includes the missing-location-after-udiv-truncation case described
in llvm.org/PR38178.
llvm-svn: 347147
Teresa Johnson [Sat, 17 Nov 2018 20:41:45 +0000 (20:41 +0000)]
Fix bot failure from r347145
The #if check around the statistics computation gave an error about
the statistic being an unused variable. Instead, guard with
AreStatisticsEnabled().
llvm-svn: 347146
Teresa Johnson [Sat, 17 Nov 2018 20:03:22 +0000 (20:03 +0000)]
[ThinLTO] Add some stats for read only variable internalization
Summary:
Follow up to D49362 ([ThinLTO] Internalize read only globals). Add a
statistic on the number of read only variables (only counting live
variables since dead variables will be dropped anyway).
Reviewers: evgeny777
Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, arphaman, llvm-commits
Differential Revision: https://reviews.llvm.org/D54642
llvm-svn: 347145
Calixte Denizet [Sat, 17 Nov 2018 19:41:39 +0000 (19:41 +0000)]
[Clang] Add options -fprofile-filter-files and -fprofile-exclude-files to filter the files to instrument with gcov (after revert https://reviews.llvm.org/rL346659)
Summary:
the previous patch (https://reviews.llvm.org/rC346642) has been reverted because of test failure under windows.
So this patch fix the test cfe/trunk/test/CodeGen/code-coverage-filter.c.
Reviewers: marco-c
Reviewed By: marco-c
Subscribers: cfe-commits, sylvestre.ledru
Differential Revision: https://reviews.llvm.org/D54600
llvm-svn: 347144
Craig Topper [Sat, 17 Nov 2018 18:54:43 +0000 (18:54 +0000)]
[X86] Add support for matching PACKUSWB from a v64i8 shuffle.
llvm-svn: 347143
Craig Topper [Sat, 17 Nov 2018 18:54:41 +0000 (18:54 +0000)]
[X86] Add test case to show missed opportunity to use PACKUSWB in v64i8 shuffle lowering.
llvm-svn: 347142
David Blaikie [Sat, 17 Nov 2018 18:04:13 +0000 (18:04 +0000)]
Sink BuryPointer from Clang into LLVM for reuse there
llvm-svn: 347141
David Blaikie [Sat, 17 Nov 2018 18:03:47 +0000 (18:03 +0000)]
Move BuryPointer from Clang to LLVM for use in other LLVM tools
Specifically planning to use this in llvm-symbolizer to remove the cost
of cleanup there.
llvm-svn: 347140
Simon Pilgrim [Sat, 17 Nov 2018 14:06:03 +0000 (14:06 +0000)]
[X86][SSE] Add shuffle demanded elts test case for PR39549
llvm-svn: 347139
Bruno Ricci [Sat, 17 Nov 2018 13:02:47 +0000 (13:02 +0000)]
[AST][NFC] Pack CXXDefaultInitExpr
Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXDefaultInitExpr.
llvm-svn: 347138
Bruno Ricci [Sat, 17 Nov 2018 12:56:30 +0000 (12:56 +0000)]
[AST][NFC] Pack CXXDefaultArgExpr
Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXDefaultArgExpr.
llvm-svn: 347137
Bruno Ricci [Sat, 17 Nov 2018 12:53:56 +0000 (12:53 +0000)]
[AST][NFC] Pack CXXThrowExpr
Use the newly available space in the bit-fields of Stmt.
This saves 8 bytes per CXXThrowExpr.
llvm-svn: 347136
Xing GUO [Sat, 17 Nov 2018 08:12:48 +0000 (08:12 +0000)]
[llvm-objdump] Print a blank row at the end of sections
Summary:
When using option `-x` (--all-headers), it will print `Sections`, `Symbol Table`, `Program Header` ...
`Sections` and `Symbol Table` will be connected together.
Before:
```
Sections:
Idx Name Size Address Type
0
00000000 0000000000000000
...
29 .shstrtab
0000011a 0000000000000000
SYMBOL TABLE:
...
```
After:
```
Sections:
Idx Name Size Address Type
0
00000000 0000000000000000
...
29 .shstrtab
0000011a 0000000000000000
SYMBOL TABLE:
...
```
Reviewers: Higuoxing
Reviewed By: Higuoxing
Subscribers: llvm-commits, jhenderson
Differential Revision: https://reviews.llvm.org/D54665
llvm-svn: 347135
David Blaikie [Sat, 17 Nov 2018 05:57:58 +0000 (05:57 +0000)]
llvm-symbolizer: Avoid calling getFromOffset when the index entry is already available
Especially for symbolizer it can be efficient to have to search through
the entire index when it isn't needed - llvm-symbolizer looks up only a
few CUs & already has an index available in getUnitForEntry, once it's
passed down to DWARFUnitHeader::extract then there's no need for it to
call getFromOffset.
llvm-svn: 347134
David L. Jones [Sat, 17 Nov 2018 04:48:54 +0000 (04:48 +0000)]
Fix unused variable warning.
llvm-svn: 347133
Stephane Moore [Sat, 17 Nov 2018 02:37:21 +0000 (02:37 +0000)]
[clang-tidy/checks] Implement a clang-tidy check to verify Google Objective-C function naming conventions 📜
Summary:
§1 Description
This check finds function names in function declarations in Objective-C files that do not follow the naming pattern described in the Google Objective-C Style Guide. Function names should be in UpperCamelCase and functions that are not of static storage class should have an appropriate prefix as described in the Google Objective-C Style Guide. The function `main` is a notable exception. Function declarations in expansions in system headers are ignored.
Example conforming function definitions:
```
static bool IsPositive(int i) { return i > 0; }
static bool ABIsPositive(int i) { return i > 0; }
bool ABIsNegative(int i) { return i < 0; }
```
A fixit hint is generated for functions of static storage class but otherwise the check does not generate a fixit hint because an appropriate prefix for the function cannot be determined.
§2 Test Notes
* Verified clang-tidy tests pass successfully.
* Used check_clang_tidy.py to verify expected output of processing google-objc-function-naming.m
Reviewers: benhamilton, hokein, Wizard, aaron.ballman
Reviewed By: benhamilton
Subscribers: Eugene.Zelenko, mgorny, xazax.hun, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D51575
llvm-svn: 347132
Craig Topper [Sat, 17 Nov 2018 02:36:07 +0000 (02:36 +0000)]
[X86] Don't extend v32i8 multiplies to v32i16 with avx512bw and prefer-vector-width=256.
llvm-svn: 347131
Craig Topper [Sat, 17 Nov 2018 02:36:02 +0000 (02:36 +0000)]
[X86] Add test cases to show incorrect use of a 512 bit vector in v32i8 multiply lowering with prefer-vector-width=256.
On the min-legal-vector-width test this actually causes some of the v32i16 operations we emitted to be scalarized.
llvm-svn: 347130
Vyacheslav Zakharin [Sat, 17 Nov 2018 02:26:34 +0000 (02:26 +0000)]
Reverted r347092 due to the following build fails:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/8662
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/26263
llvm-svn: 347129
Nico Weber [Sat, 17 Nov 2018 02:21:53 +0000 (02:21 +0000)]
Add initial scaffolding for the GN build.
See "GN build roundtable summary; adding GN build files to the repo" on
llvm-dev and cfe-dev for discussion.
In particular, this build is completely unsupported. People adding new files to
LLVM are not expected to update the GN build files, and reviewers are not
supposed to request the gn build files to be updated.
This adds just enough to be able to build llvm/lib/Demangle. It requires using
a monorepo.
This adds a few build config options you can set in args.gn
(`gn args out/foo --list` for all):
- is_debug = true to enable debug builds (defaults to release)
- llvm_enable_assertions to toggle assertions (defaults to true)
- clang_base_path, if set an absolute path to a locally-built clang to be used
as host compiler
Differential Revision: https://reviews.llvm.org/D54345
llvm-svn: 347128
Craig Topper [Sat, 17 Nov 2018 02:18:12 +0000 (02:18 +0000)]
[X86] Use getUnpackl/getUnpackh instead of hardcoding a shuffle mask.
llvm-svn: 347127
Fangrui Song [Sat, 17 Nov 2018 01:44:25 +0000 (01:44 +0000)]
Use llvm::copy. NFC
llvm-svn: 347126
Adrian Prantl [Sat, 17 Nov 2018 01:27:47 +0000 (01:27 +0000)]
Just don't even attempt to invoke sed on Windows.
llvm-svn: 347125
Adrian Prantl [Sat, 17 Nov 2018 01:27:46 +0000 (01:27 +0000)]
Revert "Makefile.rules: Fix the windows-sed-quoting issue harder."
llvm-svn: 347124
Fangrui Song [Sat, 17 Nov 2018 01:15:55 +0000 (01:15 +0000)]
[llvm-objcopy] Use llvm::all_of and rename the variables "Segment" to avoid confusion with the type of the same name
llvm-svn: 347123
Jason Molenda [Sat, 17 Nov 2018 01:08:01 +0000 (01:08 +0000)]
add PdbSymUid.cpp
llvm-svn: 347122
Kostya Serebryany [Sat, 17 Nov 2018 01:02:09 +0000 (01:02 +0000)]
[hwasan] don't check tail magic when in right_align mode (should fix the bot)
llvm-svn: 347121
Adrian Prantl [Sat, 17 Nov 2018 00:45:58 +0000 (00:45 +0000)]
Makefile.rules: Fix the windows-sed-quoting issue harder.
llvm-svn: 347120
Marc-Andre Laperle [Sat, 17 Nov 2018 00:41:14 +0000 (00:41 +0000)]
[clangd] Fix crash hovering on non-decltype trailing return
Summary:
More specifically, hovering on "auto" in
auto main() -> int {
return 0;
}
Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D54553
llvm-svn: 347119
Kostya Serebryany [Sat, 17 Nov 2018 00:40:34 +0000 (00:40 +0000)]
[hwasan] make the heap-buffer-overflow.c test more robust and re-enable it. With malloc_align_right the relative offsets of heap chunks are less predictable to simply don't test for them.
llvm-svn: 347118
Frederic Riss [Sat, 17 Nov 2018 00:40:31 +0000 (00:40 +0000)]
Make TestAppleSimulatorOSType.py more flexible
Different versions of Xcode have different outputs for the simctl command
llvm-svn: 347117
Kostya Serebryany [Sat, 17 Nov 2018 00:25:17 +0000 (00:25 +0000)]
[hwasan] implement free_checks_tail_magic=1
Summary:
With free_checks_tail_magic=1 (default) HWASAN
writes magic bytes to the tail of every heap allocation
(last bytes of the last granule, if the last granule is not fully used)
and checks these bytes on free().
This feature will detect buffer overwires within the last granule
at the time of free().
This is an alternative to malloc_align_right=[1289] that should have
fewer compatibility issues. It is also weaker since it doesn't
detect read overflows and reports bugs at free() instead of at access.
Reviewers: eugenis
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D54656
llvm-svn: 347116
Stanislav Mekhanoshin [Sat, 17 Nov 2018 00:17:15 +0000 (00:17 +0000)]
Moved dag-combine-select-undef.ll into amdgpu. NFC.
Tests really needs target arch to be specified.
llvm-svn: 347115
Zachary Turner [Sat, 17 Nov 2018 00:05:06 +0000 (00:05 +0000)]
Add missing triple from llvm-mc command line.
llvm-svn: 347114
James Y Knight [Fri, 16 Nov 2018 23:59:23 +0000 (23:59 +0000)]
Make git-llvm python3 compatible again. Hopefully. :)
llvm-svn: 347113
Stanislav Mekhanoshin [Fri, 16 Nov 2018 23:40:04 +0000 (23:40 +0000)]
Fixed test after r347110
Comments in llc outputs are printed differently on different
platforms, some with '#', some with '##'. Removed non-essential
part of the checks.
llvm-svn: 347112
Reid Kleckner [Fri, 16 Nov 2018 23:17:11 +0000 (23:17 +0000)]
Add missing test for r347072 -gcodeview-ghash
llvm-svn: 347111
Stanislav Mekhanoshin [Fri, 16 Nov 2018 23:13:38 +0000 (23:13 +0000)]
DAG combiner: fold (select, C, X, undef) -> X
Differential Revision: https://reviews.llvm.org/D54646
llvm-svn: 347110
Frederic Riss [Fri, 16 Nov 2018 23:07:28 +0000 (23:07 +0000)]
Rewrite stop-hook tests as a couple of FileCheck tests
Those tests were using pexpect and being flaky on some of ours bots.
This patch reimplmeents the tests usinf FileCheck, and it also
extends the test coverage to a few more stop-hook options.
llvm-svn: 347109
Petr Hosek [Fri, 16 Nov 2018 23:07:03 +0000 (23:07 +0000)]
[CMake] Use lld and llvm-objcopy for first stage compiler in Fuchsia
When cross-compiling the second stage to a different target, we need to
make sure that the first-stage compiler can produce binaries for that
target. Using lld and llvm-objcopy as the default linker and objcopy
tool eliminates some of the dependencies on the host toolchain.
Differential Revision: https://reviews.llvm.org/D54655
llvm-svn: 347108
Kostya Serebryany [Fri, 16 Nov 2018 23:01:42 +0000 (23:01 +0000)]
[hwasan] use reads instead of writes in a test
llvm-svn: 347107
Kamil Rytarowski [Fri, 16 Nov 2018 23:00:28 +0000 (23:00 +0000)]
Revert "Cast the 2nd argument of _Unwind_SetIP() to _Unwind_Ptr"
_Unwind_Ptr is unknown on some targets.
Detected on green-dragon-21 (MacPro Late 2013 | OS X 10.14(18A391) | Xcode 10.1(10B61)).
llvm-svn: 347106
Craig Topper [Fri, 16 Nov 2018 22:53:00 +0000 (22:53 +0000)]
[X86] Add custom promotion of narrow fp_to_uint/fp_to_sint operations under -x86-experimental-vector-widening-legalization.
This tries to force the result type to vXi32 followed by a truncate. This can help avoid scalarization that would otherwise occur.
There's some annoying examples of an avx512 truncate instruction followed by a packus where we should really be able to just use one truncate. But overall this is still a net improvement.
llvm-svn: 347105
Adrian Prantl [Fri, 16 Nov 2018 22:44:57 +0000 (22:44 +0000)]
Makefile.rules: Degrade gracefully on Windows machines without sed.
llvm-svn: 347104
James Y Knight [Fri, 16 Nov 2018 22:36:17 +0000 (22:36 +0000)]
Speed up git-llvm script by only svn up'ing affected directories.
Also, support modifications to toplevel files in git (which need to be
committed to "monorepo-root" in svn).
Differential Revision: https://reviews.llvm.org/D54341
llvm-svn: 347103
Kamil Rytarowski [Fri, 16 Nov 2018 22:17:36 +0000 (22:17 +0000)]
Cast the 2nd argument of _Unwind_SetIP() to _Unwind_Ptr
This modification is require for NetBSD with GCC, as there is a
custom unwind.h header implementation with different types.
No functional change intended for others.
Cherry-picked chunk from D33878.
llvm-svn: 347102
Kamil Rytarowski [Fri, 16 Nov 2018 22:15:09 +0000 (22:15 +0000)]
Cast _Unwind_GetIP() and _Unwind_GetRegionStart() to uintptr_t
This modification is require for NetBSD with GCC, as there is a
custom unwind.h header implementation with different types.
No functional change intended for others.
Cherry-picked chunk from D33878.
llvm-svn: 347101
Craig Topper [Fri, 16 Nov 2018 22:04:29 +0000 (22:04 +0000)]
[X86] Qualify part of the masked gather handling in ReplaceNodeResults with a getTypeAction call to know if we can use default legalization.
If we managed to switch to -x86-experimental-vector-widening-legalization this block can be removed.
llvm-svn: 347100