Akira Hatanaka [Sat, 30 May 2020 01:08:09 +0000 (18:08 -0700)]
Clean up clang/test/CodeGenObjC/os_log.m
Don't run optimization passes at -O2 and remove unneeded #ifdef and test
cases.
Kirstóf Umann [Mon, 1 Jun 2020 20:03:05 +0000 (22:03 +0200)]
[analyzer][MallocChecker] Fix the incorrect retrieval of the from argument in realloc()
In the added testfile, the from argument was recognized as
&Element{SymRegion{reg_$0<long * global_a>},-1 S64b,long}
instead of
reg_$0<long * global_a>.
Louis Dionne [Mon, 1 Jun 2020 20:35:42 +0000 (16:35 -0400)]
[libc++] Add assertions on OOB accesses in std::array when the debug mode is enabled
Like we do for empty std::array, make sure we have assertions in place
for obvious out-of-bounds issues in std::array when the debug mode is
enabled (which isn't by default).
Lei Huang [Thu, 28 May 2020 20:30:47 +0000 (15:30 -0500)]
[PowerPC] Add clang option -m[no-]pcrel
Summary:
Add user-facing front end option to turn off pc-relative memops.
This will be compatible with gcc.
Reviewers: stefanp, nemanjai, hfinkel, power-llvm-team, #powerpc, NeHuang, saghir
Reviewed By: stefanp, NeHuang, saghir
Subscribers: saghir, wuzish, shchenz, cfe-commits, kbarton, echristo
Tags: #clang, #powerpc
Differential Revision: https://reviews.llvm.org/D80757
Louis Dionne [Mon, 1 Jun 2020 20:28:44 +0000 (16:28 -0400)]
[libc++] NFC: Minor refactoring in std::array
Joseph Huber [Mon, 1 Jun 2020 20:23:10 +0000 (16:23 -0400)]
[OpenMP] Replace Clang's OpenMP RTL Definitions with OMPKinds.def
Summary: This changes Clang's generation of OpenMP runtime functions to use the types and functions defined in OpenMPKinds and OpenMPConstants. New OpenMP runtime function information should now be added to OMPKinds.def. This patch also changed the definitions of __kmpc_push_num_teams and __kmpc_copyprivate to match those found in the runtime.
Reviewers: jdoerfert
Reviewed By: jdoerfert
Subscribers: jfb, AndreyChurbanov, openmp-commits, fghanim, hiraditya, sstefan1, cfe-commits, llvm-commits
Tags: #openmp, #clang, #llvm
Differential Revision: https://reviews.llvm.org/D80222
Reid Kleckner [Mon, 1 Jun 2020 20:12:06 +0000 (13:12 -0700)]
[PDB] Share code to relocate .debug$[SF] sections, NFC
Sink relocateDebugChunk near the only call site.
Sterling Augustine [Mon, 18 May 2020 22:54:55 +0000 (15:54 -0700)]
For --relativenames, ignore directory 0, which is the comp_dir.
Update for upstream comments. Improve test by writing all the debug
info by hand.
Reviewers: dblaikie, jhenderson
Subscribers: hiraditya, MaskRay, rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80168
Jonas Devlieghere [Mon, 1 Jun 2020 20:04:32 +0000 (13:04 -0700)]
[lldb/Test] Add test for man page and lldb --help output
Mircea Trofin [Thu, 21 May 2020 15:40:49 +0000 (08:40 -0700)]
[llvm][NFC] Cache FAM in InlineAdvisor
Summary:
This simplifies the interface by storing the function analysis manager
with the InlineAdvisor, and, thus, not requiring it be passed each time
we inquire for an advice.
Reviewers: davidxl, asbirlea
Subscribers: eraman, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80405
Daniel Grumberg [Fri, 29 May 2020 15:34:07 +0000 (16:34 +0100)]
Add DIAError.h to list of headers excluded from the LLVM_DebugInfo_PDB module
Differential Revision: https://reviews.llvm.org/D80808
Paula Toth [Mon, 1 Jun 2020 19:27:25 +0000 (12:27 -0700)]
[libc] Expose APIGenerator.
Summary: This is split off from D79192 and exposes APIGenerator (renames to APIIndexer) for use in generating the integrations tests.
Reviewers: sivachandra
Reviewed By: sivachandra
Subscribers: tschuett, ecnelises, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D80832
Reid Kleckner [Mon, 1 Jun 2020 18:34:09 +0000 (11:34 -0700)]
[PDB] Use inlinee file checksum offsets directly
The inlinees section contains references to the file checksum table. The
file checksum table in the PDB must have the same layout as the file
checksum table in the object file, so all the existing file id
references should stay valid.
Previously, we would do this:
for all inlined functions:
- lookup filename from checksum and string table
- make that filename absolute
- look up the new file id for that filename up in the new checksum
table
This lead to pdbMakeAbsolute and remove_dots ending up in the hot path.
We should only need to absolutify the source path once, not once every
time we process an inline function from that source file.
This speeds up linking chrome PGO stage 1 net_unittests.exe from 9.203s
to 8.500s (-7.6%). Looking just at time to process symbol records, it
goes from ~2000ms to ~1300ms, which is consistent with the overall
speedup of about 700ms. This will be less noticeable in debug builds,
which have fewer inlined functions records.
Florian Hahn [Mon, 1 Jun 2020 18:42:03 +0000 (19:42 +0100)]
[Matrix] Implement matrix index expressions ([][]).
This patch implements matrix index expressions
(matrix[RowIdx][ColumnIdx]).
It does so by introducing a new MatrixSubscriptExpr(Base, RowIdx, ColumnIdx).
MatrixSubscriptExprs are built in 2 steps in ActOnMatrixSubscriptExpr. First,
if the base of a subscript is of matrix type, we create a incomplete
MatrixSubscriptExpr(base, idx, nullptr). Second, if the base is an incomplete
MatrixSubscriptExpr, we create a complete
MatrixSubscriptExpr(base->getBase(), base->getRowIdx(), idx)
Similar to vector elements, it is not possible to take the address of
a MatrixSubscriptExpr.
For CodeGen, a new MatrixElt type is added to LValue, which is very
similar to VectorElt. The only difference is that we may need to cast
the type of the base from an array to a vector type when accessing it.
Reviewers: rjmccall, anemet, Bigcheese, rsmith, martong
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D76791
Martin Liska [Sat, 30 May 2020 08:13:07 +0000 (10:13 +0200)]
Move internal_uname to #if SANITIZER_LINUX scope.
Remove it from target-specific scope which corresponds
to sanitizer_linux.cpp where it lives in the same macro
scope.
Differential Revision: https://reviews.llvm.org/D80864
Fangrui Song [Mon, 1 Jun 2020 18:27:53 +0000 (11:27 -0700)]
[ELF] Refine --export-dynamic-symbol semantics to be compatible GNU ld 2.35
GNU ld from binutils 2.35 onwards will likely support
--export-dynamic-symbol but with different semantics.
https://sourceware.org/pipermail/binutils/2020-May/111302.html
Differences:
1. -export-dynamic-symbol is not supported
2. --export-dynamic-symbol takes a glob argument
3. --export-dynamic-symbol can suppress binding the references to the definition within the shared object if (-Bsymbolic or -Bsymbolic-functions)
4. --export-dynamic-symbol does not imply -u
I don't think the first three points can affect any user.
For the fourth point, Not implying -u can lead to some archive members unfetched.
Add -u foo to restore the previous behavior.
Exact semantics:
* -no-pie or -pie: matched non-local defined symbols will be added to the dynamic symbol table.
* -shared: matched non-local STV_DEFAULT symbols will not be bound to definitions within the shared object
even if they would otherwise be due to -Bsymbolic, -Bsymbolic-functions, or --dynamic-list.
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D80487
Sanjay Patel [Mon, 1 Jun 2020 18:06:46 +0000 (14:06 -0400)]
[InstCombine] fix use of base VectorType; NFC
SimplifyDemandedVectorElts() bails out on ScalableVectorType
anyway, but we can exit faster with the external check.
Move this to a helper function because there are likely other
vector folds that we can try here.
Matt Arsenault [Thu, 28 May 2020 01:41:52 +0000 (21:41 -0400)]
AMDGPU: Fix not emitting nofpexcept on fdiv expansion
In this awkward case, we have to emit custom pseudo-constrained FP
wrappers. InstrEmitter concludes that since a mayRaiseFPException
instruction had a chain, it can't add nofpexcept.
Test deferred until mayRaiseFPException is really set on everything.
Vedant Kumar [Mon, 1 Jun 2020 18:01:49 +0000 (11:01 -0700)]
[LiveDebugValues] Add LocIndex::u32_{location,index}_t types for readability, NFC
This is per Adrian's suggestion in https://reviews.llvm.org/D80684.
Vedant Kumar [Thu, 28 May 2020 01:19:54 +0000 (18:19 -0700)]
[LiveDebugValues] Speed up removeEntryValue, NFC
Summary:
Instead of iterating over all VarLoc IDs in removeEntryValue(), just
iterate over the interval reserved for entry value VarLocs. This changes
the iteration order, hence the test update -- otherwise this is NFC.
This appears to give an ~8.5x wall time speed-up for LiveDebugValues when
compiling sqlite3.c 3.30.1 with a Release clang (on my machine):
```
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
Before: 2.5402 ( 18.8%) 0.0050 ( 0.4%) 2.5452 ( 17.3%) 2.5452 ( 17.3%) Live DEBUG_VALUE analysis
After: 0.2364 ( 2.1%) 0.0034 ( 0.3%) 0.2399 ( 2.0%) 0.2398 ( 2.0%) Live DEBUG_VALUE analysis
```
The change in removeEntryValue() is the only one that appears to affect
wall time, but for consistency (and to resolve a pending TODO), I made
the analogous changes for iterating over SpillLocKind VarLocs.
Reviewers: nikic, aprantl, jmorse, djtodoro
Subscribers: hiraditya, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80684
Matt Arsenault [Thu, 28 May 2020 01:39:17 +0000 (21:39 -0400)]
DAG: Fix getNode dropping flags if there's a glue output
The AMDGPU non-strict fdiv lowering needs to introduce an FP mode
switch in some cases, and has custom nodes to provide chain/glue for
the intermediate FP operations. We need to propagate nofpexcept here,
but getNode was dropping the flags.
Adding nofpexcept in the AMDGPU custom lowering is left to a future
patch.
Also fix a second case where flags were dropped, but in this case it
seems it just didn't handle this number of operands.
Test will be included in future AMDGPU patch.
Julian Lettner [Thu, 14 May 2020 20:43:33 +0000 (13:43 -0700)]
[Darwin] Add and adopt a way to query the Darwin kernel version
This applies the learnings from [1]. What I intended as a simple
cleanup made me realize that the compiler-rt version checks have two
separate issues:
1) In some places (e.g., mmap flag setting) what matters is the kernel
version, not the OS version.
2) OS version checks are implemented by querying the kernel version.
This is not necessarily correct inside the simulators if the
simulator runtime isn't aligned with the host macOS.
This commit tackles 1) by adopting a separate query function for the
Darwin kernel version. 2) (and cleanups) will be dealt with in
follow-ups.
[1] https://reviews.llvm.org/D78942
rdar://
63031937
Reviewed By: delcypher
Differential Revision: https://reviews.llvm.org/D79965
Hiroshi Yamauchi [Wed, 8 Apr 2020 23:06:25 +0000 (16:06 -0700)]
[PGO] Improve the working set size heuristics under the partial sample PGO.
Summary:
The working set size heuristics (ProfileSummaryInfo::hasHugeWorkingSetSize)
under the partial sample PGO may not be accurate because the profile is partial
and the number of hot profile counters in the ProfileSummary may not reflect the
actual working set size of the program being compiled.
To improve this, the (approximated) ratio of the the number of profile counters
of the program being compiled to the number of profile counters in the partial
sample profile is computed (which is called the partial profile ratio) and the
working set size of the profile is scaled by this ratio to reflect the working
set size of the program being compiled and used for the working set size
heuristics.
The partial profile ratio is approximated based on the number of the basic
blocks in the program and the NumCounts field in the ProfileSummary and computed
through the thin LTO indexing. This means that there is the limitation that the
scaled working set size is available to the thin LTO post link passes only.
Reviewers: davidxl
Subscribers: mgorny, eraman, hiraditya, steven_wu, dexonsmith, arphaman, dang, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79831
Matt Arsenault [Mon, 1 Jun 2020 17:15:06 +0000 (13:15 -0400)]
AMDGPU: Fix test in code directory
Matt Arsenault [Mon, 1 Jun 2020 17:14:18 +0000 (13:14 -0400)]
AMDGPU: Remove dead file
hsmahesha [Mon, 1 Jun 2020 17:20:29 +0000 (22:50 +0530)]
[AMDGPU/MemOpsCluster] Let mem ops clustering logic also consider number of clustered bytes
Summary:
While clustering mem ops, AMDGPU target needs to consider number of clustered bytes
to decide on max number of mem ops that can be clustered. This patch adds support to pass
number of clustered bytes to target mem ops clustering logic.
Reviewers: foad, rampitec, arsenm, vpykhtin, javedabsar
Reviewed By: foad
Subscribers: MatzeB, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, javed.absar, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80545
Fangrui Song [Mon, 1 Jun 2020 17:17:48 +0000 (10:17 -0700)]
[ELF] Set DF_1_PIE for -pie
DF_1_PIE originated from Solaris (https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html ).
GNU ld since
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=
5fe2850dd96483f176858fd75c098313d5b20bc2
sets the flag on non-Solaris platforms.
It can help distinguish PIE from ET_DYN.
eu-classify from elfutils uses this to recognize PIE (https://sourceware.org/git/?p=elfutils.git;a=commit;h=
3f489b5c7c78df6d52f8982f79c36e9a220e8951 )
glibc uses this flag to reject dlopen'ing a PIE (https://sourceware.org/bugzilla/show_bug.cgi?id=24323 )
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D80872
Stanislav Mekhanoshin [Mon, 1 Jun 2020 17:18:04 +0000 (10:18 -0700)]
Temporarily removed unstable test. NFC.
Matt Arsenault [Sat, 30 May 2020 15:53:54 +0000 (11:53 -0400)]
AMDGPU: Fix alignment for dynamic allocas
The alignment value also needs to be scaled by the wave size.
Christopher Tetreault [Mon, 1 Jun 2020 16:55:24 +0000 (09:55 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from Clang
Reviewers: efriedma, david-arm, fpetrogalli, ddunbar, rjmccall
Reviewed By: fpetrogalli, rjmccall
Subscribers: tschuett, rkruppe, psnobl, dmgreen, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D80323
Nick Desaulniers [Mon, 1 Jun 2020 16:21:51 +0000 (09:21 -0700)]
[Clang][CGM] style cleanups NFC
Summary:
Forked from:
https://reviews.llvm.org/D80242
Use the getter for access to DebugInfo consistently.
Use break in switch in CodeGenModule::EmitTopLevelDecl consistently.
Reviewers: dblaikie
Reviewed By: dblaikie
Subscribers: cfe-commits, srhines
Tags: #clang
Differential Revision: https://reviews.llvm.org/D80840
Eric Schweitz [Wed, 27 May 2020 21:18:40 +0000 (14:18 -0700)]
[flang] This adds the lowering stubs for Open MP.
The lowering bridge will call these lowering hooks to process the Open
MP directives that it iterates over in the PFT. This is a mock
interface without an implementation in this patch.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D80815
Stanislav Mekhanoshin [Mon, 1 Jun 2020 16:07:17 +0000 (09:07 -0700)]
Update some names in test. NFC.
There seems to be some instability with IR nameing between
platforms. Attempted to fix it with replacing dot-numbered
names.
Fangrui Song [Mon, 1 Jun 2020 15:50:21 +0000 (08:50 -0700)]
[Object] Add DF_1_PIE
This flag (and the whole field DT_FLAGS_1) originated from Solaris. I intend to use it in an LLD patch D80872.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D80871
Sanjay Patel [Mon, 1 Jun 2020 15:50:43 +0000 (11:50 -0400)]
[InstCombine] add test for select-of-shuffle; NFC
This is based on an example in D80658
Stanislav Mekhanoshin [Fri, 29 May 2020 21:00:51 +0000 (14:00 -0700)]
Process gep (phi ptr1, ptr2) in SROA
Differential Revision: https://reviews.llvm.org/D79218
Siva Chandra Reddy [Mon, 18 May 2020 22:06:01 +0000 (15:06 -0700)]
[libc] Add implementations of ceil[f], floor[f] and trunc[f] from math.h.
Reviewers: abrachet
Differential Revision: https://reviews.llvm.org/D80612
Sam Clegg [Mon, 1 Jun 2020 15:12:53 +0000 (08:12 -0700)]
[WebAssembly] Update test expectations
simd-2.C now compiles thanks to:
https://github.com/WebAssembly/wasi-libc/pull/183
Differential Revision: https://reviews.llvm.org/D80930
Sanjay Patel [Mon, 1 Jun 2020 14:56:27 +0000 (10:56 -0400)]
[InstNamer] use 'i' for Instructions, not 'tmp'
As discussed in https://bugs.llvm.org/show_bug.cgi?id=45951 and
D80584, the name 'tmp' is almost always a bad choice, but we have
a legacy of regression tests with that name because it was baked
into utils/update_test_checks.py.
This change makes -instnamer more consistent (already using "arg"
and "bb", the common LLVM shorthand). And it avoids the conflict
in telling users of the FileCheck script to run "-instnamer" to
create a better regression test and having that cause a warn/fail
in update_test_checks.py.
AndreyChurbanov [Mon, 1 Jun 2020 14:51:02 +0000 (17:51 +0300)]
[openmp] Fixed taskloop recursive splitting so that taskloop tasks have
same parent tasks.
Differential Revision: https://reviews.llvm.org/D80577
Aaron Ballman [Mon, 1 Jun 2020 14:39:38 +0000 (10:39 -0400)]
Support GCC [[gnu::attributes]] in C2x mode
GCC 10.1 introduced support for the [[]] style spelling of attributes in C
mode. Similar to how GCC supports __attribute__((foo)) as [[gnu::foo]] in
C++ mode, it now supports the same spelling in C mode as well. This patch
makes a change in Clang so that when you use the GCC attribute spelling,
the attribute is automatically available in all three spellings by default.
However, like Clang, GCC has some attributes it only recognizes in C++ mode
(specifically, abi_tag and init_priority), which this patch also honors.
Ehud Katz [Mon, 1 Jun 2020 14:42:09 +0000 (17:42 +0300)]
[StructurizeCFG] Fix an incorrect comment, NFC.
Sanjay Patel [Mon, 1 Jun 2020 14:14:47 +0000 (10:14 -0400)]
[CodeGen] remove instnamer dependency from test file; NFC
This file was originally added without instnamer at:
rL283716 /
fe2b9b4fbf860e3dc7da7705f548bc8d7b6ab9c1
But that was reverted and the test file reappeared with instnamer at:
rL285688 /
62f516f5906f967179610a73e4cc1d852b908bbd
I'm not seeing any difference locally from checking nameless values,
so trying to remove a layering violation and see if that can
survive the build bots.
James Henderson [Fri, 22 May 2020 12:53:47 +0000 (13:53 +0100)]
[Support] Add more context to DataExtractor getLEB128 errors
Reviewed by: clayborg, dblaikie, labath
Differential Revision: https://reviews.llvm.org/D80799
Raphael Isemann [Mon, 1 Jun 2020 12:41:08 +0000 (14:41 +0200)]
Revert "[lldb] Pass -fPIC flag even when DYLIB_ONLY is set"
This reverts commit
fd0ab3b3eb88de3fe4792c34b50084595e22d68d.
The fix here is incorrect and the actual fault was an incorrect test Makefile.
To give some more background:
The original test for D80798 compiled three source files into either one
executable or one executable + 2 shared libraries, each being one different
test setup. If both the monolithic executable and the shared libraries
where compiled in the same directory, then Make would overwrite the .o files
of one test setup with the other. This caused that while -fPIC was passed
correctly to the test setup with the shared libraries, the compiler invocations
for the monolithic executable would later overwrite these object files (and
as only the test setup with the shared library used -fPIC, it appeared as if
the shared library object files didn't receive the -fPIC flag).
Thanks to Pavel for figuring this out.
James Henderson [Wed, 20 May 2020 14:53:44 +0000 (15:53 +0100)]
[DebugInfo] Add use of truncating data extractor to debug line parsing
This will ensure that nothing can ever start parsing data from a future
sequence and part-read data will be returned as 0 instead.
Reviewed by: aprantl, labath
Differential Revision: https://reviews.llvm.org/D80796
Raphael Isemann [Mon, 1 Jun 2020 08:28:22 +0000 (10:28 +0200)]
[lldb][NFC] Make ClangExpressionSourceCode's wrapping logic more consistent
Summary:
ClangExpressionSourceCode has different ways to wrap the user expression based on
which context the expression is executed in. For example, if we're in a C++ member
function we put the expression inside a fake member function of a fake class to make the
evaluation possible. Similar things are done for Objective-C instance/static methods.
There is also a default wrapping where we put the expression in a normal function
just to make it possible to execute it.
The way we currently define which kind of wrapping the expression needs is based on
the `wrapping_language` we keep passing to the ClangExpressionSourceCode
instance. We repurposed the language type enum for that variable to distinguish the
cases above with the following mapping:
* language = C_plus_plus -> member function wrapping
* language = ObjC -> instance/static method wrapping (`is_static` distinguished between those two).
* language = C -> normal function wrapping
* all other cases like C_plus_plus11, Haskell etc. make our class a no-op that does mostly nothing.
That mapping is currently not documented and just confusing as the `language`
is unrelated to the expression language (and in the ClangUserExpression we even pretend
that it *is* the actual language, but luckily never used it for anything). Some of the code
in ClangExpressionSourceCode is also obviously thinking that this is the actual language of
the expression as it checks for non-existent cases such as `ObjC_plus_plus` which is
not part of the mapping.
This patch makes a new enum to describe the four cases above (with instance/static Objective-C
methods now being their own case). It also make that enum just a member of
ClangExpressionSourceCode instead of having to pass the same value to the class repeatedly.
This gets also rid of all the switch-case-checks for 'unknown' language such as C_plus_plus11 as this
is no longer necessary.
Reviewers: labath, JDevlieghere
Reviewed By: labath
Subscribers: abidh
Differential Revision: https://reviews.llvm.org/D80793
Sanjay Patel [Mon, 1 Jun 2020 10:49:07 +0000 (06:49 -0400)]
[utils] change default nameless value to "TMP"
This is effectively reverting rGbfdc2552664d to avoid test churn
while we figure out a better way forward.
We at least salvage the warning on name conflict from that patch
though.
If we change the default string again, we may want to mass update
tests at the same time. Alternatively, we could live with the poor
naming if we change -instnamer.
This also adds a test to LLVM as suggested in the post-commit
review. There's a clang test that is also affected. That seems
like a layering violation, but I have not looked at fixing that yet.
Differential Revision: https://reviews.llvm.org/D80584
James Henderson [Wed, 20 May 2020 14:29:55 +0000 (15:29 +0100)]
[llvm-dwarfdump][test] Use verbose output to check expected opcodes
The debug_line_invalid.test test case was previously using the
interpreted line table dumping to identify which opcodes have been
parsed. This change moves to looking for the expected opcodes
explicitly. This is probably a little clearer and also allows for
testing some cases that wouldn't be easily identifiable from the
interpreted table.
Reviewed by: MaskRay
Differential Revision: https://reviews.llvm.org/D80795
Simon Pilgrim [Mon, 1 Jun 2020 10:39:56 +0000 (11:39 +0100)]
ARMFrameLowering.h - remove unnecessary includes. NFC.
They are implicitly included in TargetFrameLowering.h and only ever used in TargetFrameLowering override methods.
Simon Pilgrim [Mon, 1 Jun 2020 10:36:27 +0000 (11:36 +0100)]
MIPatternMatch.h - remove unused APFloat/APInt includes. NFC.
Igor Kudrin [Mon, 1 Jun 2020 08:57:23 +0000 (15:57 +0700)]
[DebugInfo] Separate fields with commas in headers of type units (3/3).
For most tables, we already use commas in headers. This set of patches
unifies dumping the remaining ones.
Differential Revision: https://reviews.llvm.org/D80806
Igor Kudrin [Mon, 1 Jun 2020 08:56:28 +0000 (15:56 +0700)]
[DebugInfo] Separate fields with commas in headers of compile units (2/3).
For most tables, we already use commas in headers. This set of patches
unifies dumping the remaining ones.
Differential Revision: https://reviews.llvm.org/D80806
Igor Kudrin [Mon, 1 Jun 2020 08:35:33 +0000 (15:35 +0700)]
[DebugInfo] Separate fields with commas in headers of .debug_pub* tables (1/3).
For most tables, we already use commas in headers. This set of patches
unifies dumping the remaining ones.
Differential Revision: https://reviews.llvm.org/D80806
Georgii Rymar [Mon, 1 Jun 2020 10:10:16 +0000 (13:10 +0300)]
[llvm-readelf] - Add explicit braces again. NFC.
Partially reverts
feee98645dde4be31a70cc6660d2fc4d4b9d32d8.
Add explicit braces to a different place to fix
"error: add explicit braces to avoid dangling else [-Werror,-Wdangling-else]"
Georgii Rymar [Mon, 1 Jun 2020 09:53:50 +0000 (12:53 +0300)]
[llvm-readelf] - Add explicit braces. NFC.
Should fix the BB (http://lab.llvm.org:8011/builders/clang-ppc64le-rhel/builds/3907/steps/build%20stage%201/logs/stdio):
llvm-readobj/ELFDumper.cpp:4708:5: error: add explicit braces to avoid dangling else [-Werror,-Wdangling-else]
else
^
Ehud Katz [Mon, 1 Jun 2020 09:50:35 +0000 (12:50 +0300)]
[StructurizeCFG] Fix region nodes ordering
This is a reimplementation of the `orderNodes` function, as the old
implementation didn't take into account all cases.
The new implementation uses SCCs instead of Loops to take account of
irreducible loops.
Fix PR41509
Differential Revision: https://reviews.llvm.org/D79037
Georgii Rymar [Thu, 21 May 2020 10:57:41 +0000 (13:57 +0300)]
[llvm-readobj] - Improve error reporting for hash tables.
This improves the next points for broken hash tables:
1) Use reportUniqueWarning to prevent duplication when
--hash-table and --elf-hash-histogram are used together.
2) Dump nbuckets and nchain fields. It is often possible
to dump them even when the table itself goes past the EOF etc.
Differential revision: https://reviews.llvm.org/D80373
Tim Northover [Wed, 22 Apr 2020 13:02:48 +0000 (14:02 +0100)]
AArch64: materialize large stack offset into xzr correctly.
When a stack offset was too big to materialize in a single instruction, we were
trying to do it in stages:
adds xD, sp, #imm
adds xD, xD, #imm
Unfortunately, if xD is xzr then the second instruction doesn't exist and
wouldn't do what was needed if it did. Instead we can use a temporary register
for all but the last addition.
Djordje Todorovic [Wed, 27 May 2020 11:58:21 +0000 (13:58 +0200)]
[DebugInfo][CallSites] Remove decl subprograms from 'retainedTypes:'
After the D70350, the retainedTypes: isn't being used for the purpose
of call site debug info for extern calls, so it is safe to delete it
from IR representation.
We are also adding a test to ensure the subprogram isn't stored within
the retainedTypes: from corresponding DICompileUnit.
Differential Revision: https://reviews.llvm.org/D80369
Nathan James [Mon, 1 Jun 2020 06:52:01 +0000 (07:52 +0100)]
[ASTMatchers] Force c++ unittests to specify correct language standard
Force the unittests on c++ code for matchers to specify the correct standard.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D80884
serge-sans-paille [Mon, 1 Jun 2020 05:49:19 +0000 (07:49 +0200)]
Improve SmallPtrSetImpl::count implementation
Relying on the find method implies a roundtrip to the iterator world, which is
not costless because iterator creation involves a few check to ensure the
iterator is in a valid position (through the SmallPtrSetIteratorImpl::AdvanceIfNotValid
method). It turns out that the result of SmallPtrSetImpl::find_imp is either
valid or the EndPointer, so there's no need to go through that abstraction,
and the compiler cannot guess it.
Differential Revision: https://reviews.llvm.org/D80708
serge-sans-paille [Thu, 28 May 2020 15:50:31 +0000 (17:50 +0200)]
Fix strict aliasing warning in msan.cpp
Use internal_memcpy instead.
Differential Revision: https://reviews.llvm.org/D80732
Chen Zheng [Wed, 27 May 2020 02:39:37 +0000 (22:39 -0400)]
[MachineCombine] add a hook for resource length limit
Li Rong Yi [Mon, 1 Jun 2020 02:29:18 +0000 (02:29 +0000)]
[PowerPC] Exploit vabsd on P9
Summary: Exploit vabsd* for for absolute difference of vectors on P9,
for example:
void foo (char *restrict p, char *restrict q, char *restrict t)
{
for (int i = 0; i < 16; i++)
t[i] = abs (p[i] - q[i]);
}
this case should be matched to the HW instruction vabsdub.
Reviewed By: steven.zhang
Differential Revision: https://reviews.llvm.org/D80271
Nico Weber [Mon, 1 Jun 2020 02:04:35 +0000 (22:04 -0400)]
[gn build] (semi-manually) port
a8ca0ec2670
Matt Arsenault [Sun, 31 May 2020 23:58:55 +0000 (19:58 -0400)]
AMDGPU/GlobalISel: Add stub reg-bank aware combiner pass
Fangrui Song [Mon, 1 Jun 2020 00:15:14 +0000 (17:15 -0700)]
[Driver] Simplify Linux::addProfileRTLibs
Kirstóf Umann [Sun, 31 May 2020 19:22:35 +0000 (21:22 +0200)]
[analyzer] Add dumps to CheckerRegistry
Hubert Tong [Sun, 31 May 2020 20:38:10 +0000 (16:38 -0400)]
[Driver] NFC: Use Twine temp to replace std::string local
This patch replaces a `std::string` local used for a concatentation with
a `Twine` where the string was being passed into call.
Hubert Tong [Sun, 31 May 2020 20:33:42 +0000 (16:33 -0400)]
[test][compiler-rt] Avoid LD_PRELOAD for "outer" dynamic linkers
Summary:
This patch moves the setting of `LD_PRELOAD` "inwards" to avoid issues
where the built library needs to be loaded with the dynamic linker that
was configured with the build (and cannot, for example, be loaded by the
dynamic linker associated with the `env` utility).
Reviewed By: vitalybuka, nemanjai, jsji
Differential Revision: https://reviews.llvm.org/D79695
Craig Topper [Sun, 31 May 2020 19:39:14 +0000 (12:39 -0700)]
[X86] Rewrite how X86PartialReduction finds candidates to consider optimizing.
Previously we walked the users of any vector binop looking for
more binops with the same opcode or phis that eventually ended up
in a reduction. While this is simple it also means visiting the
same nodes many times since we'll do a forward walk for each
BinaryOperator in the chain. It was also far more general than what
we have tests for or expect to see.
This patch replaces the algorithm with a new method that starts at
extract elements looking for a horizontal reduction. Once we find
a reduction we walk through backwards through phis and adds to
collect leaves that we can consider for rewriting.
We only consider single use adds and phis. Except for a special
case if the Add is used by a phi that forms a loop back to the
Add. Including other single use Adds to support unrolled loops.
Ultimately, I want to narrow the Adds, Phis, and final reduction
based on the partial reduction we're doing. I still haven't
figured out exactly what that looks like yet. But restricting
the types of graphs we expect to handle seemed like a good first
step. As does having all the leaves and the reduction at once.
Differential Revision: https://reviews.llvm.org/D79971
Simon Pilgrim [Sun, 31 May 2020 19:19:24 +0000 (20:19 +0100)]
[X86][AVX] Reduce unary target shuffles width if the upper elements aren't demanded.
Simon Pilgrim [Sun, 31 May 2020 18:58:15 +0000 (19:58 +0100)]
[X86][AVX] combineX86ShufflesRecursively - peekThroughOneUseBitcasts subvector before widening.
This matches what we do for the full sized vector ops at the start of combineX86ShufflesRecursively, and helps getFauxShuffleMask extract more INSERT_SUBVECTOR patterns.
Chris Lattner [Sun, 31 May 2020 18:43:54 +0000 (11:43 -0700)]
Change some extraneous /// comments to // comments inside methods. NFC.
Nathan James [Sun, 31 May 2020 16:41:29 +0000 (17:41 +0100)]
clang-tidy and clang-query wont crash with invalid command line options
Motivated by [[ https://bugs.llvm.org/show_bug.cgi?id=46141 | clang-tidy crashed for unknown command line argument. ]]
Reviewed By: aaron.ballman, thakis
Differential Revision: https://reviews.llvm.org/D80879
Nathan James [Sun, 31 May 2020 15:40:09 +0000 (16:40 +0100)]
Revert "clang-tidy and clang-query wont crash with invalid command line options"
This reverts commit
f23ddbe3c3ae5f40b99ba272afc3d16b800ba8b9.
Sanjay Patel [Sun, 31 May 2020 15:06:32 +0000 (11:06 -0400)]
[utils] update expected strings in tests; NFC
The script was changes with:
https://github.com/llvm/llvm-project/commit/
bfdc2552664d6f0bb332a9c6a115877020f3c1df
Nathan James [Sat, 30 May 2020 21:03:50 +0000 (22:03 +0100)]
clang-tidy and clang-query wont crash with invalid command line options
Summary: Motivated by [[ https://bugs.llvm.org/show_bug.cgi?id=46141 | clang-tidy crashed for unknown command line argument. ]]
Reviewers: aaron.ballman, alexfh
Reviewed By: aaron.ballman
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D80879
Matt Arsenault [Sat, 30 May 2020 20:03:16 +0000 (16:03 -0400)]
AArch64/GlobalISel: Fix incorrect ptrmask usage for alignment
I inverted the mask when I ported to the new form of G_PTRMASK in
8bc03d2168241f7b12265e9cd7e4eb7655709f34.
I don't think this really broke anything, since G_VASTART isn't
handled for types with an alignment higher than the stack alignment.
Sanjay Patel [Sun, 31 May 2020 14:46:11 +0000 (10:46 -0400)]
[utils] change update_test_checks.py use of 'TMP' value names
As discussed in PR45951:
https://bugs.llvm.org/show_bug.cgi?id=45951
There's a potential name collision between update_test_checks.py and -instnamer
and/or manually-generated IR test files because all of them try to use the
variable name that should never be used: "tmp".
This patch proposes to reduce the odds of collision and adds a warning if we
detect the problem. This will cause regression test churn when regenerating
CHECK lines on existing files.
Differential Revision: https://reviews.llvm.org/D80584
Sanjay Patel [Sun, 31 May 2020 14:10:28 +0000 (10:10 -0400)]
[PhaseOrdering] add test for hoisting/CSE (PR46115); NFC
Simon Pilgrim [Sun, 31 May 2020 13:20:00 +0000 (14:20 +0100)]
[X86][AVX] Add SimplifyMultipleUseDemandedBits VBROADCAST handling to SimplifyDemandedVectorElts.
As suggested on D79987.
Sanjay Patel [Sun, 31 May 2020 13:05:48 +0000 (09:05 -0400)]
[VectorCombine] add tests for scalarizing binop-with-constant; NFC
Goes with proposal in D80885.
This is adapted from the InstCombine tests that were added for
D50992
But these should be adjusted further to provide more interesting
scenarios for x86-specific codegen. Eg, vector types/sizes will
have different costs depending on ISA attributes.
We also need to add tests that include a load of the scalar
variable and add tests that include extra uses of the insert
to further exercise the cost model.
Simon Pilgrim [Sun, 31 May 2020 12:50:40 +0000 (13:50 +0100)]
[X86] getFauxShuffleMask/getTargetShuffleInputs - make SelectionDAG const (PR45974).
Try to prevent future node creation issues (as detailed in PR45974) by making the SelectionDAG reference const, so it can still be used for analysis, but not node creation.
Simon Pilgrim [Sun, 31 May 2020 12:46:46 +0000 (13:46 +0100)]
[X86][AVX] Add test case described in D79987
Sanjay Patel [Sun, 31 May 2020 12:41:09 +0000 (08:41 -0400)]
[PhaseOrdering] add scalarization test for PR42174; NFC
Motivating test for vector-combine enhancement in D80885.
Make sure that vectorization and canonicalization are
working together as expected.
Simon Pilgrim [Sun, 31 May 2020 12:19:18 +0000 (13:19 +0100)]
[X86][AVX] getFauxShuffleMask - don't widen shuffle inputs from INSERT_SUBVECTOR(X,SHUFFLE(Y,Z))
Don't create nodes on the fly when decoding INSERT_SUBVECTOR as faux shuffles.
Simon Pilgrim [Sun, 31 May 2020 10:43:27 +0000 (11:43 +0100)]
[X86][AVX] Pad small shuffle inputs in combineX86ShufflesRecursively
As detailed on PR45974 and D79987, getFauxShuffleMask is creating nodes on the fly to create shuffles with inputs the same size as the result, causing problems for hasOneUse() checks in later simplification stages.
Currently only combineX86ShufflesRecursively benefits from these widened inputs so I've begun moving the functionality there, and out of getFauxShuffleMask. This allows us to remove the widening from VBROADCAST and *EXTEND* faux shuffle cases.
This just leaves the INSERT_SUBVECTOR case in getFauxShuffleMask still creating nodes, which will require more extensive refactoring.
Florian Hahn [Sun, 31 May 2020 10:04:35 +0000 (11:04 +0100)]
[ScheduleDAG] Avoid unnecessary recomputation of topological order.
In some cases ScheduleDAGRRList has to add new nodes to resolve problems
with interfering physical registers. When new nodes are added, it
completely re-computes the topological order, which can take a long
time, but is unnecessary. We only add nodes one by one, and initially
they do not have any predecessors. So we can just insert them at the end
of the vector. Later we add predecessors, but the helper function
properly updates the topological order much more efficiently. With this
change, the compile time for the program below drops from 300s to 30s on
my machine.
define i11129 @test1() {
%L1 = load i11129, i11129* undef
%B30 = ashr i11129 %L1, %L1
store i11129 %B30, i11129* undef
ret i11129 %L1
}
This should be generally beneficial, as we can skip a large amount of
work. Theoretically there are some scenarios where we might not safe
much, e.g. when we add a dependency between the first and last node.
Then we would have to shift all nodes. But we still do not have to spend
the time re-computing the initial order.
Reviewers: MatzeB, atrick, efriedma, niravd, paquette
Reviewed By: paquette
Differential Revision: https://reviews.llvm.org/D59722
Kang Zhang [Sun, 31 May 2020 09:24:21 +0000 (09:24 +0000)]
Revert "[NFC][PowerPC] Add a new case to test phi-node-elimination pass"
This case wll be failed on some machines which enable expensive-checks.
This reverts commit
af3abbf7bd2213003a133c361c212ac6efb1bd2b.
Kang Zhang [Sun, 31 May 2020 08:05:27 +0000 (08:05 +0000)]
[NFC][PowerPC] Add a new case to test phi-node-elimination pass
Jay Foad [Fri, 29 May 2020 16:02:13 +0000 (17:02 +0100)]
[AMDGPU] Propagate fast-math flags when lowering FSIN and FCOS
Differential Revision: https://reviews.llvm.org/D80813
Jay Foad [Fri, 29 May 2020 15:52:43 +0000 (16:52 +0100)]
[AMDGPU] Precommit tests for D80813
Changpeng Fang [Sun, 31 May 2020 03:45:27 +0000 (20:45 -0700)]
AMDGPU: Add setTruncStoreAction for vector i64 types made legal recently
Reviewers:
rampitec, arsenm
Differential Revision:
https://reviews.llvm.org/D80853
Craig Topper [Sun, 31 May 2020 03:24:51 +0000 (20:24 -0700)]
[X86] Remove unneeded bitconverts from isel patterns. NFC
The types already match so TableGen is removing the bitconvert.
Craig Topper [Sun, 31 May 2020 01:51:20 +0000 (18:51 -0700)]
[X86] Add DAG combine to turn (v2i64 (scalar_to_vector (i64 (bitconvert (mmx))))) to MOVQ2DQ. Remove unneeded isel patterns.
We already had a DAG combine for (mmx (bitconvert (i64 (extractelement v2i64))))
to MOVDQ2Q.
Remove patterns for MMX_MOVQ2DQrr/MMX_MOVDQ2Qrr that use
scalar_to_vector/extractelement involving i64 scalar type with
v2i64 and x86mmx.
Craig Topper [Sun, 31 May 2020 01:40:17 +0000 (18:40 -0700)]
[DAGCombiner] Move debug message and statistic update into CommitTargetLoweringOpt.
This code was repeated in two callers of CommitTargetLoweringOpt.
But CommitTargetLoweringOpt is also called from TargetLowering.
We should print a message for those calls to. So sink the
repeated code into CommitTargetLoweringOpt to catch those calls.
Craig Topper [Sun, 31 May 2020 00:04:56 +0000 (17:04 -0700)]
[X86] Teach computeKnownBitsForTargetNode that the upper half of X86ISD::MOVQ2DQ is all zero.
Craig Topper [Sun, 31 May 2020 00:03:53 +0000 (17:03 -0700)]
[X86] Fix a place where we created MOVQ2DQ with a DstVT other than v2i64.
The type profile and isel pattern have this type declared as
being MVT::v2i64. But isel skips the explicit type check due to
the type profile.