Kamil Rytarowski [Tue, 4 Dec 2018 01:45:52 +0000 (01:45 +0000)]
Add interceptors for the fts(3) API family from NetBSD
Summary:
fts(3) is API to traverse a file hierarchy.
Cover this interface with interceptors.
Add a test to validate the interface reading
the number of regular files in /etc.
Based on original work by Yang Zheng.
Reviewers: joerg, vitalybuka
Reviewed By: vitalybuka
Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D54247
llvm-svn: 348227
Evandro Menezes [Tue, 4 Dec 2018 01:43:22 +0000 (01:43 +0000)]
[TableGen] Improve the formatting of the emitted predicates (NFC)
llvm-svn: 348226
Evandro Menezes [Tue, 4 Dec 2018 01:43:19 +0000 (01:43 +0000)]
[TableGen] Fix typo in emitted comment (NFC)
llvm-svn: 348225
Kamil Rytarowski [Tue, 4 Dec 2018 01:41:42 +0000 (01:41 +0000)]
Add new interceptor for regex(3) in NetBSD
Summary:
Add interceptors for the NetBSD style of regex(3) present inside libc:
- regcomp
- regexec
- regerror
- regfree
- regnsub
- regasub
Add a dedicated test verifying the installed interceptors.
Reviewers: vitalybuka, joerg
Reviewed By: vitalybuka
Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D54584
llvm-svn: 348224
Lang Hames [Tue, 4 Dec 2018 00:55:15 +0000 (00:55 +0000)]
[ExecutionEngine] Change NotifyObjectEmitted/NotifyObjectFreed API.
This patch renames both methods (NotifyObjectEmitted -> notifyObjectLoaded, and
NotifyObjectFreed -> notifyObjectFreed), adds an abstract "ObjectKey" (uint64_t)
parameter to notifyObjectLoaded, and replaces the ObjectFile parameter for
notifyObjectFreed with an ObjectKey. Using an ObjectKey to track identify
events, rather than a reference to the ObjectFile, allows us to free the
ObjectFile after notifyObjectLoaded is called, saving memory.
https://reviews.llvm.org/D53773
llvm-svn: 348223
Sanjin Sijaric [Tue, 4 Dec 2018 00:54:52 +0000 (00:54 +0000)]
[ARM64][Windows] Fix local stack size for funclets
The comment was misplaced, and the code didn't do what the comment indicated,
namely ignoring the varargs portion when computing the local stack size of a
funclet in emitEpilogue. This results in incorrect offset computations within
funclets that are contained in vararg functions.
Differential Revision: https://reviews.llvm.org/D55096
llvm-svn: 348222
Vitaly Buka [Tue, 4 Dec 2018 00:36:14 +0000 (00:36 +0000)]
[asan] Reduce binary size by using unnamed private aliases
Summary:
--asan-use-private-alias increases binary sizes by 10% or more.
Most of this space was long names of aliases and new symbols.
These symbols are not needed for the ODC check at all.
Reviewers: eugenis
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D55146
llvm-svn: 348221
Jessica Paquette [Tue, 4 Dec 2018 00:31:55 +0000 (00:31 +0000)]
[MachineOutliner] Move stack instr check logic to getOutliningCandidateInfo
This moves the stack check logic into a lambda within getOutliningCandidateInfo.
This allows us to be less conservative with stack checks. Whether or not a
stack instruction is safe to outline is dependent on the frame variant and call
variant of the outlined function; only in cases where we modify the stack can
these be unsafe.
So, if we move that logic later, when we're looking at an individual candidate,
we can make better decisions here.
This gives some code size savings as a result.
llvm-svn: 348220
Jessica Paquette [Tue, 4 Dec 2018 00:31:47 +0000 (00:31 +0000)]
[MachineOutliner][AArch64][NFC] Add early exit to candidate discarding logic
If we dropped too many candidates to be beneficial when dropping candidates
that modify the stack, there's no reason to check for other cost model
qualities.
llvm-svn: 348219
Erik Pilkington [Tue, 4 Dec 2018 00:31:31 +0000 (00:31 +0000)]
NFC: Make this test kinder on downstream forks
Downstream forks that have their own attributes often run into this
test failing when a new attribute is added to clang because the
number of supported attributes no longer match. This is redundant
information for this test, so we can get by without it.
rdar://
46288577
llvm-svn: 348218
Shoaib Meenai [Tue, 4 Dec 2018 00:12:03 +0000 (00:12 +0000)]
[projects] Use directory name for add_llvm_external_projects
add_llvm_external_projects expects the directory name instead of the
full path, otherwise the check for an in-tree subproject will fail and
the project won't be configured.
llvm-svn: 348217
George Burgess IV [Tue, 4 Dec 2018 00:02:33 +0000 (00:02 +0000)]
[ThinLTO] Look through aliases when computing hash keys
Without this, we don't consider types used by aliasees in our cache key.
This caused issues when using the same cache for thin-linking the same
TU with different sets of virtual call candidates for a virtual call
inside of a constructor. That's sort of a mouthful. :)
Differential Revision: https://reviews.llvm.org/D55060
llvm-svn: 348216
Ranjeet Singh [Tue, 4 Dec 2018 00:01:23 +0000 (00:01 +0000)]
[IR] Don't assume all functions are 4 byte aligned
In some cases different alignments for function might be used to save
space e.g. thumb mode with -Oz will try to use 2 byte function
alignment. Similar patch that fixed this in other areas exists here
https://reviews.llvm.org/D46110
Differential Revision: https://reviews.llvm.org/D55115
llvm-svn: 348215
Krzysztof Parzyszek [Mon, 3 Dec 2018 23:52:33 +0000 (23:52 +0000)]
[Hexagon] Fix intrinsic test
llvm-svn: 348214
Adrian Prantl [Mon, 3 Dec 2018 23:40:51 +0000 (23:40 +0000)]
Relax test even more for Windows
llvm-svn: 348213
Yi Kong [Mon, 3 Dec 2018 23:37:51 +0000 (23:37 +0000)]
Remove unused empty arm64 directory
llvm-svn: 348212
Adrian Prantl [Mon, 3 Dec 2018 23:11:19 +0000 (23:11 +0000)]
Relax tests to also work on Windows
llvm-svn: 348211
Artem Dergachev [Mon, 3 Dec 2018 23:06:07 +0000 (23:06 +0000)]
[analyzer] MoveChecker: Restrict to locals and std:: objects.
In general case there use-after-move is not a bug. It depends on how the
move-constructor or move-assignment is implemented.
In STL, the convention that applies to most classes is that the move-constructor
(-assignment) leaves an object in a "valid but unspecified" state. Using such
object without resetting it to a known state first is likely a bug. Objects
Local value-type variables are special because due to their automatic lifetime
there is no intention to reuse space. If you want a fresh object, you might
as well make a new variable, no need to move from a variable and than re-use it.
Therefore, it is not always a bug, but it is obviously easy to suppress when it
isn't, and in most cases it indeed is - as there's no valid intention behind
the intentional use of a local after move.
This applies not only to local variables but also to parameter variables,
not only of value type but also of rvalue reference type (but not to lvalue
references).
Differential Revision: https://reviews.llvm.org/D54557
llvm-svn: 348210
Gor Nishanov [Mon, 3 Dec 2018 22:51:07 +0000 (22:51 +0000)]
NFC: Add .vscode to .gitignore
llvm-svn: 348209
Artem Dergachev [Mon, 3 Dec 2018 22:44:16 +0000 (22:44 +0000)]
[analyzer] MoveChecker: NFC: Remove the workaround for the "zombie symbols" bug.
The checker had extra code to clean up memory regions that were sticking around
in the checker without ever being cleaned up due to the bug that was fixed in
r347953. Because of that, if a region was moved from, then became dead,
and then reincarnated, there were false positives.
Why regions are even allowed to reincarnate is a separate story. Luckily, this
only happens for local regions that don't produce symbols when loaded from.
No functional change intended. The newly added test demonstrates that even
though no cleanup is necessary upon destructor calls, the early return
cannot be removed. It was not failing before the patch.
Differential Revision: https://reviews.llvm.org/D54372
llvm-svn: 348208
Jonas Devlieghere [Mon, 3 Dec 2018 22:41:32 +0000 (22:41 +0000)]
[FileSystem] Migrate MonitoringProcessLauncher
Use the FileSystem helpers instead of using the file system directly.
llvm-svn: 348207
Krzysztof Parzyszek [Mon, 3 Dec 2018 22:40:36 +0000 (22:40 +0000)]
[Hexagon] Switch to auto-generated intrinsic definitions and patterns
llvm-svn: 348206
Vedant Kumar [Mon, 3 Dec 2018 22:40:21 +0000 (22:40 +0000)]
[CodeExtractor] Split PHI nodes with incoming values from outlined region (PR39433)
If a PHI node out of extracted region has multiple incoming values from it,
split this PHI on two parts. First PHI has incomings only from region and
extracts with it (they are placed to the separate basic block that added to the
list of outlined), and incoming values in original PHI are replaced by first
PHI. Similar solution is already used in CodeExtractor for PHIs in entry block
(severSplitPHINodes method). It covers PR39433 bug.
Patch by Sergei Kachkov!
Differential Revision: https://reviews.llvm.org/D55018
llvm-svn: 348205
Sam Clegg [Mon, 3 Dec 2018 22:37:55 +0000 (22:37 +0000)]
[WebAssembly] Don't set a maximum size when importing the table
We shouldn't be setting setting a max size for a table that is
being imported.
Differential Revision: https://reviews.llvm.org/D55231
llvm-svn: 348204
Adrian Prantl [Mon, 3 Dec 2018 22:37:48 +0000 (22:37 +0000)]
Adapt gcov to changes in CFE.
The clang frontend no longer emits the current working directory for
DIFiles containing an absolute path in the filename: and will move the
common prefix between current working directory and the file into the
directory: component.
This fixes the GCOV tests in compiler-rt that were broken by the Clang
change.
llvm-svn: 348203
Eugene Zelenko [Mon, 3 Dec 2018 22:35:40 +0000 (22:35 +0000)]
[Documentation] Fix formatting and wrap up to 80 characters in Clang-tidy readability-uppercase-literal-suffix documentation.
llvm-svn: 348202
Artem Dergachev [Mon, 3 Dec 2018 22:32:32 +0000 (22:32 +0000)]
[analyzer] Rename MisusedMovedObjectChecker to MoveChecker
This follows the Static Analyzer's tradition to name checkers after
things in which they find bugs, not after bugs they find.
Differential Revision: https://reviews.llvm.org/D54556
llvm-svn: 348201
Artem Dergachev [Mon, 3 Dec 2018 22:23:21 +0000 (22:23 +0000)]
[analyzer] Dump stable identifiers for objects under construction.
This continues the work that was started in r342313, which now gets applied to
object-under-construction tracking in C++. Makes it possible to debug
temporaries by dumping exploded graphs again.
Differential Revision: https://reviews.llvm.org/D54459
llvm-svn: 348200
Artem Dergachev [Mon, 3 Dec 2018 22:19:05 +0000 (22:19 +0000)]
[AST] [analyzer] NFC: Reuse code in stable ID dumping methods.
Use the new fancy method introduced in r348197 to simplify some code.
Differential Revision: https://reviews.llvm.org/D54488
llvm-svn: 348199
Artem Dergachev [Mon, 3 Dec 2018 22:15:34 +0000 (22:15 +0000)]
[AST] Generate unique identifiers for CXXCtorInitializer objects.
This continues the work started in r342309 and r342315 to provide identifiers
to AST objects that are shorter and easier to read and remember than pointers.
Differential Revision: https://reviews.llvm.org/D54457
llvm-svn: 348198
Artem Dergachev [Mon, 3 Dec 2018 22:05:24 +0000 (22:05 +0000)]
BumpPtrAllocator: Add a couple of convenient wrappers around identifyObject().
This allows obtaining smaller, more readable identifiers
in a more comfortable way.
Differential Revision: https://reviews.llvm.org/D54486
llvm-svn: 348197
Krzysztof Parzyszek [Mon, 3 Dec 2018 21:59:21 +0000 (21:59 +0000)]
[Hexagon] Extract operand decoders into a separate file, NFC
These decoders are automatically generated. Keeping them separated makes
updating architectures easier.
llvm-svn: 348196
Sanjay Patel [Mon, 3 Dec 2018 21:57:35 +0000 (21:57 +0000)]
[DAGCombiner] narrow truncated vector binops when legal
This is the smallest vector enhancement I could find to D54640.
Here, we're allowing narrowing to only legal vector ops because we'll see
regressions without that. All of the test diffs are wins from what I can tell.
With AVX/AVX512, we can shrink ymm/zmm ops to xmm.
x86 vector multiplies are the problem case that we're avoiding due to the
patchwork ISA, and it's not clear to me if we can dance around those
regressions using TLI hooks or if we need preliminary patches to plug those
holes.
Differential Revision: https://reviews.llvm.org/D55126
llvm-svn: 348195
Simon Atanasyan [Mon, 3 Dec 2018 21:54:43 +0000 (21:54 +0000)]
[mips] Fix TestDWARF32Version5Addr8AllForms test failure on MIPS hosts
The `DIEExpr` is used in debug information entries for either TLS variables
or call sites. For now the last case is unsupported for targets with delay
slots, for MIPS in particular.
The `DIEExpr::EmitValue` method calls a virtual `EmitDebugThreadLocal`
routine which, in case of MIPS, always emits either `.dtprelword` or
`.dtpreldword` directives. That is okay for "main" code, but in unit
tests `DIEExpr` instances can be created not for TLS variables only even
on MIPS hosts. That is a reason of the `TestDWARF32Version5Addr8AllForms`
failure because handling of the `R_MIPS_TLS_DTPREL` relocation writes
incorrect value into dwarf structures. And anyway unconditional emitting
of `.dtprelword` directives will be incorrect when/if debug information
entries for call sites become supported on MIPS.
The patch solves the problem by wrapping expression created in the
`MipsTargetObjectFile::getDebugThreadLocalSymbol` method in to the
`MipsMCExpr` expression with a new `MEK_DTPREL` tag. This tag is
recognized in the `MipsAsmPrinter::EmitDebugThreadLocal` method and
`.dtprelword` directives created in this case only. In other cases the
expression saved as a regular data.
Differential Revision: http://reviews.llvm.org/D54937
llvm-svn: 348194
Krzysztof Parzyszek [Mon, 3 Dec 2018 21:49:12 +0000 (21:49 +0000)]
[Hexagon] Remove unused encodings, NFC
llvm-svn: 348193
Aaron Ballman [Mon, 3 Dec 2018 21:27:15 +0000 (21:27 +0000)]
Typo correction; NFC.
llvm-svn: 348192
Sanjay Patel [Mon, 3 Dec 2018 21:15:17 +0000 (21:15 +0000)]
[InstCombine] fix undef propagation bug with shuffle+binop
When we have a shuffle that extends a source vector with undefs
and then do some binop on that, we must make sure that the extra
elements remain undef with that binop if we reverse the order of
the binop and shuffle.
'or' is probably the easiest example to show the bug because
'or C, undef --> -1' (not undef). But there are other
opcode/constant combinations where this is true as shown by
the 'shl' test.
llvm-svn: 348191
Nico Weber [Mon, 3 Dec 2018 21:10:19 +0000 (21:10 +0000)]
[gn build] Use print_function in write_cmake_config.py
No behavior change, just makes the script match the other scripts in
llvm/utils/gn/build.
Differential Revision: https://reviews.llvm.org/D55183
llvm-svn: 348190
Stephen Kelly [Mon, 3 Dec 2018 21:05:52 +0000 (21:05 +0000)]
NFC: Simplify dumpStmt child handling
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D55068
llvm-svn: 348189
Artem Dergachev [Mon, 3 Dec 2018 21:04:30 +0000 (21:04 +0000)]
Re-apply r347954 "[analyzer] Nullability: Don't detect post factum violation..."
Buildbot failures were caused by an unrelated UB that was introduced in r347943
and fixed in r347970.
Also the revision was incorrectly specified as r344580 during revert.
Differential Revision: https://reviews.llvm.org/D54017
llvm-svn: 348188
Vedant Kumar [Mon, 3 Dec 2018 20:53:58 +0000 (20:53 +0000)]
[gcov/Darwin] Ensure external symbols are exported when using an export list
Make sure that symbols needed to implement runtime support for gcov are
exported when using an export list on Darwin.
Without the clang driver exporting these symbols, the linker hides them,
resulting in tapi verification failures.
rdar://
45944768
Differential Revision: https://reviews.llvm.org/D55151
llvm-svn: 348187
Jonas Devlieghere [Mon, 3 Dec 2018 20:36:21 +0000 (20:36 +0000)]
Skip TestDriverOptions on Windows
It's not clear to me why this is failing on Windows. Maybe it has
something to do with the path?
llvm-svn: 348186
Wouter van Oortmerssen [Mon, 3 Dec 2018 20:30:28 +0000 (20:30 +0000)]
[WebAssembly] Enforce assembler emits to streamer in order.
Summary:
The assembler processes directives and instructions in whatever order
they are in the file, then directly emits them to the streamer. This
could cause badly written (or generated) .s files to produce
incorrect binaries.
It now has state that tracks what it has most recently seen, to
enforce they are emitted in a given order that always produces
correct wasm binaries.
Also added a new test that compares obj2yaml output from llc (the
backend) to that going via .s and the assembler to ensure both paths
generate the same binaries.
The features this test covers could be extended.
Passes all wasm Lit tests.
Fixes: https://bugs.llvm.org/show_bug.cgi?id=39557
Reviewers: sbc100, dschuff, aheejin
Subscribers: jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D55149
llvm-svn: 348185
Serge Guelton [Mon, 3 Dec 2018 20:26:51 +0000 (20:26 +0000)]
Portable Python script across Python version
Workaround naming and hierarchy changes in BaseHTTPServer and SimpleHTTPServer module.
Differential Revision: https://reviews.llvm.org/D55203
llvm-svn: 348184
Krzysztof Parzyszek [Mon, 3 Dec 2018 20:13:18 +0000 (20:13 +0000)]
[Hexagon] Update timing classes
llvm-svn: 348183
Serge Guelton [Mon, 3 Dec 2018 20:12:34 +0000 (20:12 +0000)]
Portable Python script across Python version
Python2 supports both backticks and `repr` to access the __repr__ slot. Python3 only supports `repr`.
Differential Revision: https://reviews.llvm.org/D55201
llvm-svn: 348182
Roman Lebedev [Mon, 3 Dec 2018 20:07:58 +0000 (20:07 +0000)]
[InstCombine] foldICmpWithLowBitMaskedVal(): disable 2 faulty folds.
These two folds are invalid for this non-constant pattern
when the mask ends up being all-ones:
https://rise4fun.com/Alive/9au
https://rise4fun.com/Alive/UcQM
Fixes https://bugs.llvm.org/show_bug.cgi?id=39861
llvm-svn: 348181
Shoaib Meenai [Mon, 3 Dec 2018 20:05:11 +0000 (20:05 +0000)]
[cmake] Clean up add_llvm_subdirectory
I found the pattern of setting the project_BUILD variable to OFF after
processing the project to be pretty confusing. Using global properties
to explicitly keep track of whether a project has been processed or not
seems much more straightforward, and it also allows us to convert the
macro into a function (which is required for the early return).
Factor the project+type+name combination out into a variable while I'm
here, since it's used a whole bunch of times.
I don't believe this should result in any functional changes.
Differential Revision: https://reviews.llvm.org/D55104
llvm-svn: 348180
Martin Storsjo [Mon, 3 Dec 2018 20:02:15 +0000 (20:02 +0000)]
[TextAPI] Remove a superfluous semicolon, fixing GCC warnings. NFC.
llvm-svn: 348179
Martin Storsjo [Mon, 3 Dec 2018 20:02:11 +0000 (20:02 +0000)]
[COFF] Remove an outdated/incorrect comment. NFC.
Making the section writable doesn't affect how windows does
base relocs in case a DLL can't be loaded at the intended base
address.
This comment dates back to SVN r79346.
Differential Revision:
llvm-svn: 348178
Martin Storsjo [Mon, 3 Dec 2018 20:02:05 +0000 (20:02 +0000)]
[COFF] Don't mark mingw .eh_frame sections writable
This improves compatibility with GCC produced object files, where
the .eh_frame sections are read only. With mixed flags for the
involved .eh_frame sections, LLD creates two separate .eh_frame
sections in the output binary, one for each flag combination,
while ld.bfd probably merges them.
The previous setup of flags can be traced back to SVN r79346.
Differential Revision: https://reviews.llvm.org/D55209
llvm-svn: 348177
Zachary Turner [Mon, 3 Dec 2018 19:59:00 +0000 (19:59 +0000)]
Fix compilation failure on Windows.
This was introduced earlier but apparently used an incorrect
class name so it doesn't compile on Windows.
llvm-svn: 348176
Sanjay Patel [Mon, 3 Dec 2018 19:53:04 +0000 (19:53 +0000)]
[InstCombine] rearrange shuffle+binop fold; NFC
This code has a bug dealing with undefs, so we need
to add another escape hatch, so doing some cleanup
ahead of that.
llvm-svn: 348175
Jake Ehrlich [Mon, 3 Dec 2018 19:49:23 +0000 (19:49 +0000)]
[llvm-objcopy] Add --build-id-link-dir flag
This flag does not exist in GNU objcopy but has a major use case.
Debugging tools support the .build-id directory structure to find
debug binaries. There is no easy way to build this structure up
however. One way to do it is by using llvm-readelf and some crazy
shell magic. This implements the feature directly. It is most often
the case that you'll want to strip a file and send the original to
the .build-id directory but if you just want to send a file to the
.build-id directory you can copy to /dev/null instead.
Differential Revision: https://reviews.llvm.org/D54384
llvm-svn: 348174
Sanjay Patel [Mon, 3 Dec 2018 19:41:21 +0000 (19:41 +0000)]
[InstCombine] add tests for shuffle+binop fold; NFC
llvm-svn: 348173
Jonas Toth [Mon, 3 Dec 2018 19:41:04 +0000 (19:41 +0000)]
[clang-tidy] Fix unordered_map failure with specializing std::hash<> and remove previous wrong attempt at doing so
llvm-svn: 348172
Krzysztof Parzyszek [Mon, 3 Dec 2018 19:34:04 +0000 (19:34 +0000)]
[Hexagon] Change instruction type field in TSFlags to 7 bits
llvm-svn: 348171
Armando Montanez [Mon, 3 Dec 2018 19:30:52 +0000 (19:30 +0000)]
[llvm-tapi] initial commit, supports ELF text stubs
http://lists.llvm.org/pipermail/llvm-dev/2018-September/126472.html
TextAPI is a library and accompanying tool that allows conversion between binary shared object stubs and textual counterparts. The motivations and uses cases for this are explained thoroughly in the llvm-dev proposal [1]. This initial commit proposes a potential structure for the TAPI library, also including support for reading/writing text-based ELF stubs (.tbe) in addition to preliminary support for reading binary ELF files. The goal for this patch is to ensure the project architecture appropriately welcomes integration of Mach-O stubbing from Apple's TAPI [2].
Added:
- TextAPI library
- .tbe read support
- .tbe write (to raw_ostream) support
[1] http://lists.llvm.org/pipermail/llvm-dev/2018-September/126472.html
[2] https://github.com/ributzka/tapi
Differential Revision: https://reviews.llvm.org/D53051
llvm-svn: 348170
Jonas Toth [Mon, 3 Dec 2018 19:22:08 +0000 (19:22 +0000)]
[clang-tidy] Recommit: Add the abseil-duration-comparison check
Summary:
This check finds instances where Duration values are being converted to a numeric value in a comparison expression, and suggests that the conversion happen on the other side of the expression to a Duration. See documentation for examples.
This also shuffles some code around so that the new check may perform in sone step simplifications also caught by other checks.
Compilation is unbroken, because the hash-function is now directly
specified for std::unordered_map, as 'enum class' does not compile as
key (seamingly only on some compilers).
Patch by hwright.
Reviewers: aaron.ballman, JonasToth, alexfh, hokein
Reviewed By: JonasToth
Subscribers: sammccall, Eugene.Zelenko, xazax.hun, cfe-commits, mgorny
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D54737
llvm-svn: 348169
Jessica Paquette [Mon, 3 Dec 2018 19:11:27 +0000 (19:11 +0000)]
[MachineOutliner] Drop candidates that require fixups if it's beneficial
If it's a bigger code size win to drop candidates that require stack fixups
than to demote every candidate to that variant, the outliner should do that.
This happens if the number of bytes taken by calls to functions that don't
require fixups, plus the number of bytes that'd be left is less than the
number of bytes that it'd take to emit a save + restore for all candidates.
Also add tests for each possible new behaviour.
- machine-outliner-compatible-candidates shows that when we have candidates
that don't use the stack, we can use the default call variant along with the
no save/regsave variant.
- machine-outliner-all-stack shows that when it's better to fix up the stack,
we still will demote all candidates to that case
- machine-outliner-drop-stack shows that we can discard candidates that
require stack fixups when it would be beneficial to do so.
llvm-svn: 348168
Krzysztof Parzyszek [Mon, 3 Dec 2018 19:05:42 +0000 (19:05 +0000)]
[Hexagon] Add HasV5 predicate for compatibility with auto-generated files
llvm-svn: 348167
Zachary Turner [Mon, 3 Dec 2018 19:05:12 +0000 (19:05 +0000)]
Fix issue with Tpi Stream hash map.
Part of the patch to not build the hash map eagerly was omitted
due to a merge conflict. Add it back, which should fix the failing
tests.
llvm-svn: 348166
Jonas Toth [Mon, 3 Dec 2018 18:59:27 +0000 (18:59 +0000)]
Revert "[clang-tidy] Add the abseil-duration-comparison check"
This commit broke buildbots and needs adjustments.
llvm-svn: 348165
Craig Topper [Mon, 3 Dec 2018 18:58:57 +0000 (18:58 +0000)]
[X86] Fix bad formatting. NFC
llvm-svn: 348164
Krzysztof Parzyszek [Mon, 3 Dec 2018 18:54:24 +0000 (18:54 +0000)]
[Hexagon] Remove unused operand definitions, NFC
llvm-svn: 348163
Krzysztof Parzyszek [Mon, 3 Dec 2018 18:40:15 +0000 (18:40 +0000)]
[Hexagon] Some formatting changes, NFC
llvm-svn: 348162
Jonas Toth [Mon, 3 Dec 2018 18:35:56 +0000 (18:35 +0000)]
[clang-tidy] Add the abseil-duration-comparison check
Summary:
This check finds instances where Duration values are being converted to a numeric value in a comparison expression, and suggests that the conversion happen on the other side of the expression to a Duration. See documentation for examples.
This also shuffles some code around so that the new check may perform in sone step simplifications also caught by other checks.
Patch by hwright.
Reviewers: aaron.ballman, JonasToth, alexfh, hokein
Reviewed By: JonasToth
Subscribers: sammccall, Eugene.Zelenko, xazax.hun, cfe-commits, mgorny
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D54737
llvm-svn: 348161
Zachary Turner [Mon, 3 Dec 2018 18:32:05 +0000 (18:32 +0000)]
Don't build the Tpi Hash map by default.
This is very slow and should be done for specific cases where
lookups will need to happen.
llvm-svn: 348160
Craig Topper [Mon, 3 Dec 2018 18:26:27 +0000 (18:26 +0000)]
[X86] Teach LowerMUL/LowerMULH for vXi8 to unpack constant RHS.
Summary:
We need to unpackl and unpackh the operands to use two vXi16 multiplies. Previously it looks like the low unpack would get constant folded at least in the 128-bit case after shuffle lowering turned the unpackl into ZERO_EXTEND_VECTOR_INREG and X86 custom DAG combined it. The same doesn't happen for the high half. So we'd load a constant and then shuffle it. But the low half would just be loaded and used by the multiply directly.
After this patch we now end up with a constant pool entry for the low and high unpacks separately with no shuffle operations.
This is a step towards removing custom constant folding for ZERO_EXTEND_VECTOR_INREG/SIGN_EXTEND_VECTOR_INREG in the X86 backend.
Reviewers: RKSimon, spatel
Reviewed By: RKSimon
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D55165
llvm-svn: 348159
Craig Topper [Mon, 3 Dec 2018 18:26:24 +0000 (18:26 +0000)]
[X86] Add DAG combine to combine a v8i32->v8i16 truncate with a packuswb that truncates v8i16->v8i8.
Summary:
Under -x86-experimental-vector-widening-legalization, fp_to_uint/fp_to_sint with a smaller than 128 bit vector type results are custom type legalized by promoting the result to a 128 bit vector by promoting the elements, inserting an assertzext/assertsext, then truncating back to original type. The truncate will be further legalizdd to a pack shuffle. In the case of a v8i8 result type, we'll end up with a v8i16 fp_to_sint. This will need to be further legalized during vector op legalization by promoting to v8i32 and then truncating again. Under avx2 this produces good code with two pack instructions, but Under avx512 this will result in a truncate instruction and a packuswb instruction. But we should be able to get away with a single truncate instruction.
The other option is to promote all the way to vXi32 result type during the first type legalization. But in some experimentation that seemed to require more work to produce good code for other configurations.
Reviewers: RKSimon, spatel
Reviewed By: RKSimon
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54836
llvm-svn: 348158
Adrian Prantl [Mon, 3 Dec 2018 18:07:03 +0000 (18:07 +0000)]
Fix non-modular build.
llvm-svn: 348157
Aaron Ballman [Mon, 3 Dec 2018 18:00:31 +0000 (18:00 +0000)]
Adding tests for -ast-dump; NFC.
This adds tests for struct and union declarations in C++.
llvm-svn: 348156
Adrian Prantl [Mon, 3 Dec 2018 17:55:29 +0000 (17:55 +0000)]
Update Diagnostic handling for changes in CFE.
The clang frontend no longer emits the current working directory for
DIFiles containing an absolute path in the filename: and will move the
common prefix between current working directory and the file into the
directory: component.
https://reviews.llvm.org/D55085
llvm-svn: 348155
Adrian Prantl [Mon, 3 Dec 2018 17:55:27 +0000 (17:55 +0000)]
Avoid emitting redundant or unusable directories in DIFile metadata entries.
As discussed on llvm-dev recently, Clang currently emits redundant
directories in DIFile entries, such as
.file 1 "/Volumes/Data/llvm" "/Volumes/Data/llvm/tools/clang/test/CodeGen/debug-info-abspath.c"
This patch looks at any common prefix between the compilation
directory and the (absolute) file path and strips the redundant
part. More importantly it leaves the compilation directory empty if
the two paths have no common prefix.
After this patch the above entry is (assuming a compilation dir of "/Volumes/Data/llvm/_build"):
.file 1 "/Volumes/Data/llvm" "tools/clang/test/CodeGen/debug-info-abspath.c"
When building the FileCheck binary with debug info, this patch makes
the build artifacts ~1kb smaller.
Differential Revision: https://reviews.llvm.org/D55085
llvm-svn: 348154
Rui Ueyama [Mon, 3 Dec 2018 17:42:57 +0000 (17:42 +0000)]
Show a proper error message if output file is too large.
At least on Linux, if a file size given to FileOutputBuffer is greater
than 2^63, it fails with "Invalid argument" error, which is not a
user-friendly error message. With this patch, lld prints out "output
file too large" instead.
llvm-svn: 348153
Jonas Devlieghere [Mon, 3 Dec 2018 17:28:29 +0000 (17:28 +0000)]
[Reproducers] Change how reproducers are initialized.
This patch changes the way the reproducer is initialized. Rather than
making changes at run time we now do everything at initialization time.
To make this happen we had to introduce initializer options and their SB
variant. This allows us to tell the initializer that we're running in
reproducer capture/replay mode.
Because of this change we also had to alter our testing strategy. We
cannot reinitialize LLDB when using the dotest infrastructure. Instead
we use lit and invoke two instances of the driver.
Another consequence is that we can no longer enable capture or replay
through commands. This was bound to go away form the beginning, but I
had something in mind where you could enable/disable specific providers.
However this seems like it adds very little value right now so the
corresponding commands were removed.
Finally this change also means you now have to control this through the
driver, for which I replaced --reproducer with --capture and --replay to
differentiate between the two modes.
Differential revision: https://reviews.llvm.org/D55038
llvm-svn: 348152
Sanjay Patel [Mon, 3 Dec 2018 16:55:29 +0000 (16:55 +0000)]
[SimplifyCFG] add tests for cross block compare folding; NFC
These are the baseline tests for D54827.
Patch based on code originally written by: @yinyuefengyi (luo xionghu)
Differential Revision: https://reviews.llvm.org/D54994
llvm-svn: 348151
Bruno Ricci [Mon, 3 Dec 2018 16:17:45 +0000 (16:17 +0000)]
[Serialization][NFC] Remove pointless "+ 0" in ASTReader
Remove the pointless "+ 0" which I added for some reason when
modifying these statement/expression classes since it looks
like this is a typo. Following the suggestion of aaron.ballman
in D54902. NFC.
llvm-svn: 348150
Sanjay Patel [Mon, 3 Dec 2018 15:48:30 +0000 (15:48 +0000)]
[CmpInstAnalysis] fix formatting; NFC
There are potential improvements to the structure of this API
raised by D54994, but remove some cosmetic blemishes before
making any functional changes.
llvm-svn: 348149
Gheorghe-Teodor Bercea [Mon, 3 Dec 2018 15:21:49 +0000 (15:21 +0000)]
[OpenMP][libomptarget] Flush intermediate values during team reduction
Summary: Ensure intermediate values of a team reduction are flushed to memory.
Reviewers: ABataev, caomhin
Reviewed By: ABataev
Subscribers: guansong, jfb, openmp-commits
Differential Revision: https://reviews.llvm.org/D55219
llvm-svn: 348148
Ilya Biryukov [Mon, 3 Dec 2018 15:21:49 +0000 (15:21 +0000)]
[clangd] Avoid memory-mapping files on Windows
Summary:
Memory-mapping files on Windows leads to them being locked and prevents
editors from saving changes to those files on disk. This is fine for the
compiler, but not acceptable for an interactive tool like clangd.
Therefore, we choose to avoid using memory-mapped files on Windows.
Reviewers: hokein, kadircet
Reviewed By: kadircet
Subscribers: yvvan, zturner, nik, malaperle, mgorny, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D55139
llvm-svn: 348147
Simon Pilgrim [Mon, 3 Dec 2018 14:55:09 +0000 (14:55 +0000)]
Fix line endings. NFCI.
llvm-svn: 348146
Bruno Ricci [Mon, 3 Dec 2018 14:54:03 +0000 (14:54 +0000)]
[AST][Sema] Remove CallExpr::setNumArgs
CallExpr::setNumArgs is the only thing that prevents storing the arguments
in a trailing array. There is only 3 places in Sema where setNumArgs is called.
D54900 dealt with one of them.
This patch remove the other two calls to setNumArgs in ConvertArgumentsForCall.
To do this we do the following changes:
1.) Replace the first call to setNumArgs by an assertion since we are moving the
responsability to allocate enough space for the arguments from
Sema::ConvertArgumentsForCall to its callers
(which are Sema::BuildCallToMemberFunction, and Sema::BuildResolvedCallExpr).
2.) Add a new member function CallExpr::shrinkNumArgs, which can only be used
to drop arguments and then replace the second call to setNumArgs by
shrinkNumArgs.
3.) Add a new defaulted parameter MinNumArgs to CallExpr and its derived
classes which specifies a minimum number of argument slots to allocate.
The actual number of arguments slots allocated will be
max(number of args, MinNumArgs) with the extra args nulled. Note that
after the creation of the call expression all of the arguments will be
non-null. It is just during the creation of the call expression that some of
the last arguments can be temporarily null, until filled by default arguments.
4.) Update Sema::BuildCallToMemberFunction by passing the number of parameters
in the function prototype to the constructor of CXXMemberCallExpr. Here the
change is pretty straightforward.
5.) Update Sema::BuildResolvedCallExpr. Here the change is more complicated
since the type-checking for the function type was done after the creation of
the call expression. We need to move this before the creation of the call
expression, and then pass the number of parameters in the function prototype
(if any) to the constructor of the call expression.
6.) Update the deserialization of CallExpr and its derived classes.
Differential Revision: https://reviews.llvm.org/D54902
Reviewed By: aaron.ballman
llvm-svn: 348145
Fedor Sergeev [Mon, 3 Dec 2018 14:48:15 +0000 (14:48 +0000)]
Fixing -print-module-scope for legacy SCC passes
It appears that print-module-scope was not implemented for legacy SCC passes.
Fixed to print a whole module instead of just current SCC.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D54793
llvm-svn: 348144
George Rimar [Mon, 3 Dec 2018 14:44:02 +0000 (14:44 +0000)]
[LLD][ELF] - Remove the excessive condition. NFC.
There is no need to check that In.DynSymTab != nullptr,
because `includeInDynsym` already checks for `!Config->HasDynSymTab`
and `HasDynSymTab` is the pre-condition for In.DynSymTab creation.
llvm-svn: 348143
Pablo Barrio [Mon, 3 Dec 2018 14:40:37 +0000 (14:40 +0000)]
[AArch64] Add command-line option for SSBS
Summary:
SSBS (Speculative Store Bypass Safe) is only mandatory from 8.5
onwards but is optional from Armv8.0-A. This patch adds testing for
the ssbs command line option, added to allow enabling the feature
in previous Armv8-A architectures to 8.5.
Reviewers: olista01, samparker, aemerson
Reviewed By: samparker
Subscribers: javed.absar, kristof.beyls, cfe-commits
Differential Revision: https://reviews.llvm.org/D54961
llvm-svn: 348142
Jonas Paulsson [Mon, 3 Dec 2018 14:30:18 +0000 (14:30 +0000)]
[SystemZ::TTI] Return zero cost for ICmp that becomes Load And Test.
A loaded value with multiple users compared with 0 will become a load and
test single instruction. The load is not folded in this case (multiple
users), but the compare instruction is eliminated.
This patch returns 0 cost for the icmp in these cases.
Review: Ulrich Weigand
https://reviews.llvm.org/D55111
llvm-svn: 348141
Eugene Leviant [Mon, 3 Dec 2018 14:03:51 +0000 (14:03 +0000)]
[SanitizerCommon] Remove RenameFile
This function seems to be no longer used by compiler-rt
libraries
Differential revision: https://reviews.llvm.org/D55123
llvm-svn: 348140
Marco Antognini [Mon, 3 Dec 2018 14:03:49 +0000 (14:03 +0000)]
[OpenCL][Sema] Improving formatting
Reformat comment added in r348120 following
review https://reviews.llvm.org/D55136.
llvm-svn: 348139
Louis Dionne [Mon, 3 Dec 2018 14:03:27 +0000 (14:03 +0000)]
[libcxx] Implement P0318: unwrap_ref_decay and unwrap_reference
Summary:
This was voted into C++20 in San Diego. Note that there was a revision
D0318R2 which did include unwrap_reference_t, but we mistakingly voted
P0318R1 into the C++20 Working Draft (which does not include
unwrap_reference_t). This patch implements D0318R2, which is what
we'll end up with in the Working Draft once this mistake has been
fixed.
Reviewers: EricWF, mclow.lists
Subscribers: christof, dexonsmith, libcxx-commits
Differential Revision: https://reviews.llvm.org/D54485
llvm-svn: 348138
Pablo Barrio [Mon, 3 Dec 2018 14:00:47 +0000 (14:00 +0000)]
[AArch64] Add command-line option for SSBS
Summary:
SSBS (Speculative Store Bypass Safe) is only mandatory from 8.5
onwards but is optional from Armv8.0-A. This patch adds a command
line option to enable SSBS, as it was previously only possible to
enable by selecting -march=armv8.5-a.
Similar patch upstream in GNU binutils:
https://sourceware.org/ml/binutils/2018-09/msg00274.html
Reviewers: olista01, samparker, aemerson
Reviewed By: samparker
Subscribers: javed.absar, kristof.beyls, kristina, llvm-commits
Differential Revision: https://reviews.llvm.org/D54629
llvm-svn: 348137
Aleksandr Urakov [Mon, 3 Dec 2018 13:31:13 +0000 (13:31 +0000)]
[PDB] Support PDB-backed expressions evaluation (+ fix stuck test)
Summary:
This patch contains several small fixes, which makes it possible to evaluate
expressions on Windows using information from PDB. The changes are:
- several sanitize checks;
- make IRExecutionUnit::MemoryManager::getSymbolAddress to not return a magic
value on a failure, because callers wait 0 in this case;
- entry point required to be a file address, not RVA, in the ObjectFilePECOFF;
- do not crash on a debuggee second chance exception - it may be an expression
evaluation crash. Also fix detection of "crushed" threads in tests;
- create parameter declarations for functions in AST to make it possible to call
debugee functions from expressions;
- relax name searching rules for variables, functions, namespaces and types. Now
it works just like in the DWARF plugin;
- fix endless recursion in SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc.
Reviewers: zturner, asmith, stella.stamenova
Reviewed By: stella.stamenova, asmith
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D53759
llvm-svn: 348136
Ilya Biryukov [Mon, 3 Dec 2018 13:29:17 +0000 (13:29 +0000)]
[CodeComplete] Cleanup access checking in code completion
Summary: Also fixes a crash (see the added 'accessibility-crash.cpp' test).
Reviewers: ioeric, kadircet
Reviewed By: kadircet
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D55124
llvm-svn: 348135
Bruno Ricci [Mon, 3 Dec 2018 13:23:56 +0000 (13:23 +0000)]
[Sema] Avoid CallExpr::setNumArgs in Sema::BuildCallToObjectOfClassType
CallExpr::setNumArgs is the only thing that prevents storing the arguments
of a call expression in a trailing array since it might resize the argument
array. setNumArgs is only called in 3 places in Sema, and for all of them it
is possible to avoid it.
This deals with the call to setNumArgs in BuildCallToObjectOfClassType.
Instead of constructing the CXXOperatorCallExpr first and later calling
setNumArgs if we have default arguments, we first construct a large
enough SmallVector, do the promotion/check of the arguments, and
then construct the CXXOperatorCallExpr.
Incidentally this also avoid reallocating the arguments when the
call operator has default arguments but this is not the primary goal.
Differential Revision: https://reviews.llvm.org/D54900
Reviewed By: aaron.ballman
llvm-svn: 348134
Haojian Wu [Mon, 3 Dec 2018 13:16:04 +0000 (13:16 +0000)]
[clangd] Fix a stale comment, NFC.
llvm-svn: 348133
Ron Lieberman [Mon, 3 Dec 2018 13:04:54 +0000 (13:04 +0000)]
[AMDGPU] Add sdwa support for ADD|SUB U64 decomposed Pseudos
The introduction of S_{ADD|SUB}_U64_PSEUDO instructions which are decomposed
into VOP3 instruction pairs for S_ADD_U64_PSEUDO:
V_ADD_I32_e64
V_ADDC_U32_e64
and for S_SUB_U64_PSEUDO
V_SUB_I32_e64
V_SUBB_U32_e64
preclude the use of SDWA to encode a constant.
SDWA: Sub-Dword addressing is supported on VOP1 and VOP2 instructions,
but not on VOP3 instructions.
We desire to fold the bit-and operand into the instruction encoding
for the V_ADD_I32 instruction. This requires that we transform the
VOP3 into a VOP2 form of the instruction (_e32).
%19:vgpr_32 = V_AND_B32_e32 255,
killed %16:vgpr_32, implicit $exec
%47:vgpr_32, %49:sreg_64_xexec = V_ADD_I32_e64
%26.sub0:vreg_64, %19:vgpr_32, implicit $exec
%48:vgpr_32, dead %50:sreg_64_xexec = V_ADDC_U32_e64
%26.sub1:vreg_64, %54:vgpr_32, killed %49:sreg_64_xexec, implicit $exec
which then allows the SDWA encoding and becomes
%47:vgpr_32 = V_ADD_I32_sdwa
0, %26.sub0:vreg_64, 0, killed %16:vgpr_32, 0, 6, 0, 6, 0,
implicit-def $vcc, implicit $exec
%48:vgpr_32 = V_ADDC_U32_e32
0, %26.sub1:vreg_64, implicit-def $vcc, implicit $vcc, implicit $exec
Differential Revision: https://reviews.llvm.org/D54882
llvm-svn: 348132
Bruno Ricci [Mon, 3 Dec 2018 13:04:10 +0000 (13:04 +0000)]
[AST] Fix an uninitialized bug in the bits of FunctionDecl
FunctionDeclBits.IsCopyDeductionCandidate was not initialized.
This caused a warning with valgrind.
llvm-svn: 348131
Haojian Wu [Mon, 3 Dec 2018 12:53:19 +0000 (12:53 +0000)]
[clangd] Get rid of AST matchers in CodeComplete, NFC
Summary:
The isIndexedForCodeCompletion is called in the code patch of
SymbolCollector.
Reviewers: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D55206
llvm-svn: 348130
Serge Guelton [Mon, 3 Dec 2018 12:41:35 +0000 (12:41 +0000)]
Portable Python script across Python version
Python3 does not support type destructuring in function parameters.
Differential Revision: https://reviews.llvm.org/D55198
llvm-svn: 348129
Bruno Ricci [Mon, 3 Dec 2018 12:32:32 +0000 (12:32 +0000)]
[AST][NFC] Pack CXXDeleteExpr
Use the newly available space in the bit-fields of Stmt.
This saves 8 bytes per CXXDeleteExpr. NFC.
llvm-svn: 348128