Martin Storsjo [Thu, 3 Jan 2019 08:08:23 +0000 (08:08 +0000)]
[llvm-readobj] [COFF] Print the symbol index for relocations
There can be multiple local symbols with the same name (for e.g.
comdat sections), and thus the symbol name itself isn't enough
to disambiguate symbols.
Differential Revision: https://reviews.llvm.org/D56140
llvm-svn: 350288
Craig Topper [Thu, 3 Jan 2019 07:12:54 +0000 (07:12 +0000)]
[X86] Add test cases for opportunities to use KTEST when check if the result of ANDing two mask registers is zero.
The test cases are constructed to avoid folding the AND into a masked compare operation.
Currently we emit a KAND and a KORTEST for these cases.
llvm-svn: 350287
Kristina Brooks [Thu, 3 Jan 2019 06:06:38 +0000 (06:06 +0000)]
Don't go over 80 chars in MCStreamer.cpp. NFC.
Fixing up style issues around the area to prepare for
a larger differential.
llvm-svn: 350286
QingShan Zhang [Thu, 3 Jan 2019 05:04:18 +0000 (05:04 +0000)]
[Power9] Enable the Out-of-Order scheduling model for P9 hw
When switched to the MI scheduler for P9, the hardware is modeled as out of order.
However, inside the MI Scheduler algorithm, we still use the in-order scheduling model
as the MicroOpBufferSize isn't set. The MI scheduler take it as the hw cannot buffer
the op. So, only when all the available instructions issued, the pending instruction
could be scheduled. That is not true for our P9 hw in fact.
This patch is trying to enable the Out-of-Order scheduling model. The buffer size 44 is
picked from the P9 hw spec, and the perf test indicate that, its value won't hurt the cpu2017.
With this patch, there are 3 specs improved over 3% and 1 spec deg over 3%. The detail is as follows:
x264_r: +6.95%
cactuBSSN_r: +6.94%
lbm_r: +4.11%
xz_r: -3.85%
And the GEOMEAN for all the C/C++ spec in spec2017 is about 0.18% improved.
Reviewer: Nemanjai
Differential Revision: https://reviews.llvm.org/D55810
llvm-svn: 350285
Pete Cooper [Thu, 3 Jan 2019 01:38:08 +0000 (01:38 +0000)]
Teach ObjCARC optimizer about equivalent PHIs when eliminating autoreleaseRV/retainRV pairs
OptimizeAutoreleaseRVCall skips optimizing llvm.objc.autoreleaseReturnValue if it
sees a user which is llvm.objc.retainAutoreleasedReturnValue, and if they have
equivalent arguments (either identical or equivalent PHIs). It then assumes that
ObjCARCOpt::OptimizeRetainRVCall will optimize the pair instead.
Trouble is, ObjCARCOpt::OptimizeRetainRVCall doesn't know about equivalent PHIs
so optimizes in a different way and we are left with an unoptimized llvm.objc.autoreleaseReturnValue.
This teaches ObjCARCOpt::OptimizeRetainRVCall to also understand PHI equivalence.
rdar://problem/
47005143
Reviewed By: ahatanak
Differential Revision: https://reviews.llvm.org/D56235
llvm-svn: 350284
Alex Lorenz [Thu, 3 Jan 2019 01:30:50 +0000 (01:30 +0000)]
Fix incorrect column numbers in test from r350282.
After the test was reformatted using clang-format the numbers became invalid.
llvm-svn: 350283
Alex Lorenz [Thu, 3 Jan 2019 01:13:33 +0000 (01:13 +0000)]
[libclang] CoroutineBody/Coreturn statements are UnexposedStmts and not Exprs
This change ensures that the libclang CXCursor represents the CoroutineBody
and the Coreturn statement using the appropriate CXCursor_UnexposedStmt kind
instead of CXCursor_UnexposedExpr. The problem with CXCursor_UnexposedExpr is
that the consumer functions assumed that CoroutineBody/Coreturn statements
were valid expressions and performed an invalid downcast to Expr causing
assertion failures or other crashes.
rdar://
40204290
llvm-svn: 350282
Aaron Smith [Thu, 3 Jan 2019 00:54:08 +0000 (00:54 +0000)]
Check that a pointer is valid and fix a log message on Windows
llvm-svn: 350281
Mike Spertus [Thu, 3 Jan 2019 00:52:54 +0000 (00:52 +0000)]
Fix MSVC visualizer for PointerUnion4
Calculate which item is being held and then display it with the appropriate type. We also
optimize the display of PointerUnion3 to take advantage of our knowing that the IntMask is
always 1 in PointerUnion types
llvm-svn: 350280
Robert Widmann [Thu, 3 Jan 2019 00:33:44 +0000 (00:33 +0000)]
[LLVM-C] Expand LLVMRelocMode
Summary: Add read[only|write] PIC relocation models to the C API and teach the TargetMachine API about it.
Reviewers: whitequark, deadalnix
Reviewed By: whitequark
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D56187
llvm-svn: 350279
Nico Weber [Thu, 3 Jan 2019 00:17:02 +0000 (00:17 +0000)]
Make test/Driver/darwin-sdk-version.c pass if the host triple is 32-bit
For some reason, the cmake build on my macbook has
LLVM_HOST_TRIPLE:STRING=i386-apple-darwin16.7.0 .
test/Driver/darwin-sdk-version.c assumed that the host triple is 64-bit, so
make it resilient against 32-bit host triples.
Differential Revision: https://reviews.llvm.org/D56067
llvm-svn: 350278
Daniel Sanders [Thu, 3 Jan 2019 00:14:33 +0000 (00:14 +0000)]
[tblgen][disasm] Emit record names again when decoder conflicts occur.
And add a test for it.
llvm-svn: 350277
Teresa Johnson [Wed, 2 Jan 2019 23:48:00 +0000 (23:48 +0000)]
[gold] emit assembly listing from gold plugin on LTO stage
Summary:
Sometimes it's useful to emit assembly after LTO stage to modify it manually. Emitting precodegen bitcode file (via save-temps plugin option) and then feeding it to llc doesn't always give the same binary as original.
This patch is simpler alternative to https://reviews.llvm.org/D24020.
Patch by Denis Bakhvalov.
Reviewers: mehdi_amini, tejohnson
Reviewed By: tejohnson
Subscribers: MaskRay, inglorion, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D56114
llvm-svn: 350276
Mike Spertus [Wed, 2 Jan 2019 23:46:59 +0000 (23:46 +0000)]
MSVC Visualizer for PointerUnion3
llvm-svn: 350275
Adrian Prantl [Wed, 2 Jan 2019 23:37:54 +0000 (23:37 +0000)]
Rearrange bitfield to allow for more space in file_idx.
This is an alternate patch for the bug reported in
https://bugs.llvm.org/show_bug.cgi?id=39816 ("lldb doesn't show a file
of line entry for big project"). This limits the number of lines in a
source file to 32M, which I think is reasonable even for preprocessed
source inputs.
Differential Revision: https://reviews.llvm.org/D56218
llvm-svn: 350274
Eugene Zelenko [Wed, 2 Jan 2019 23:35:57 +0000 (23:35 +0000)]
[Documentation] Alphabetical order in Clang-tidy checks changes list.
llvm-svn: 350273
Craig Topper [Wed, 2 Jan 2019 23:24:08 +0000 (23:24 +0000)]
[X86] Add load folding support to the custom isel we do for X86ISD::UMUL/SMUL.
The peephole pass isn't always able to fold the load because it can't commute the implicit usage of AL/AX/EAX/RAX.
llvm-svn: 350272
Craig Topper [Wed, 2 Jan 2019 23:24:03 +0000 (23:24 +0000)]
[X86] Add test cases to show that we fail to fold loads into i8 smulo and i8/i16/i32/i64 umulo lowering without the assistance of the peephole pass. NFC
llvm-svn: 350271
Wouter van Oortmerssen [Wed, 2 Jan 2019 23:23:51 +0000 (23:23 +0000)]
[WebAssembly] made assembler parse block_type
Summary:
This was previously ignored and an incorrect value generated.
Also fixed Disassembler's handling of block_type.
Reviewers: dschuff, aheejin
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D56092
llvm-svn: 350270
Xin Tong [Wed, 2 Jan 2019 23:18:20 +0000 (23:18 +0000)]
[ThinLTO] Scan all variants of vague symbol for reachability.
Summary:
Alias can make one (but not all) live, we still need to scan all others if this symbol is reachable
from somewhere else.
Reviewers: tejohnson, grimar
Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D56117
llvm-svn: 350269
Jonas Devlieghere [Wed, 2 Jan 2019 22:38:16 +0000 (22:38 +0000)]
[Driver] Remove unused imports
Removes some unneeded includes from the driver.
llvm-svn: 350267
Adrian Prantl [Wed, 2 Jan 2019 22:37:28 +0000 (22:37 +0000)]
Add file-based synching to places missed in r350247.
llvm-svn: 350266
Nikita Popov [Wed, 2 Jan 2019 22:34:32 +0000 (22:34 +0000)]
[BDCE] Fix typo in test; NFC
shl by 32 is undefined. This was intended to be a shl by 31 as part
of a rotate sequence.
llvm-svn: 350265
Adrian Prantl [Wed, 2 Jan 2019 22:23:51 +0000 (22:23 +0000)]
Remove Range.* from Xcode project
llvm-svn: 350264
Zachary Turner [Wed, 2 Jan 2019 21:04:22 +0000 (21:04 +0000)]
Try to fix Green Dragon bot.
It doesn't like this std::tie() for some reason, hopefuly this
fixes it.
llvm-svn: 350262
Pete Cooper [Wed, 2 Jan 2019 21:00:02 +0000 (21:00 +0000)]
Fix assert in ObjCARC optimizer when deleting retainBlock of null or undef.
The caller to EraseInstruction had this conditional:
// ARC calls with null are no-ops. Delete them.
if (IsNullOrUndef(Arg))
but the assert inside EraseInstruction only allowed ConstantPointerNull and not
undef or bitcasts.
This adds support for both of these cases.
rdar://problem/
47003805
llvm-svn: 350261
Thomas Lively [Wed, 2 Jan 2019 20:43:08 +0000 (20:43 +0000)]
[WebAssembly][NFC] Elaborate on simd-noopt test comment
llvm-svn: 350260
David Carlier [Wed, 2 Jan 2019 20:23:47 +0000 (20:23 +0000)]
[Sanitizer] Fix typo in funopen unit test.
llvm-svn: 350259
Julian Lettner [Wed, 2 Jan 2019 20:10:30 +0000 (20:10 +0000)]
[TSan] Enable detection of lock-order-inversions for Objective-C @synchronized
Summary:
@synchronized semantics can be synthesized by using existing mutex_[un]lock operations.
```
@synchronized(obj) {
// ...
}
=>
{
mutex_lock(obj);
// ...
mutex_unlock(obj);
}
```
Let me know whether you think this a good idea.
Reviewers: dcoughlin, dvyukov, kubamracek, delcypher
Reviewed By: dvyukov
Subscribers: llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D55959
llvm-svn: 350258
Nikita Popov [Wed, 2 Jan 2019 20:02:14 +0000 (20:02 +0000)]
[BDCE] Remove instructions without demanded bits
If an instruction has no demanded bits, remove it directly during BDCE,
instead of leaving it for something else to clean up.
Differential Revision: https://reviews.llvm.org/D56185
llvm-svn: 350257
Pawel Bylica [Wed, 2 Jan 2019 19:58:07 +0000 (19:58 +0000)]
Git ignore CLion project configuration files. NFC
llvm-svn: 350256
Pawel Bylica [Wed, 2 Jan 2019 19:51:46 +0000 (19:51 +0000)]
Format AggresiveInstCombine.cpp. NFC
llvm-svn: 350255
Vyacheslav Zakharin [Wed, 2 Jan 2019 19:39:49 +0000 (19:39 +0000)]
[libomptarget] Added install component for libomptarget
Differential Revision: https://reviews.llvm.org/D56108
llvm-svn: 350254
Michal Gorny [Wed, 2 Jan 2019 19:39:26 +0000 (19:39 +0000)]
[test] Enable system-linker-elf feature on NetBSD [NFC]
Since NetBSD uses ELF linker, enable the relevant feature. It's not
currently used for anything, though.
llvm-svn: 350253
Patrick Lyster [Wed, 2 Jan 2019 19:28:48 +0000 (19:28 +0000)]
[OpenMP] Added support for explicit mapping of classes using 'this' pointer. Differential revision: https://reviews.llvm.org/D55982
llvm-svn: 350252
Thomas Anderson [Wed, 2 Jan 2019 19:28:00 +0000 (19:28 +0000)]
Fix linker-defined symbols possibly not being defined when -wrap is used
Fixes https://bugs.llvm.org/show_bug.cgi?id=40134
addWrappedSymbols() must be called before addReservedSymbols() because the
latter only defines reserved symbols when they are undefined in the symbol
table. If addWrappedSymbols() is called after, then addUndefined() is called
which may lazily pull in more object files that could reference reserved
symbols.
Differential Revision: https://reviews.llvm.org/D56110
llvm-svn: 350251
Mike Spertus [Wed, 2 Jan 2019 19:26:50 +0000 (19:26 +0000)]
Fix MSVC PointerUnion visualizer
Differential Revision: https://reviews.llvm.org/D56186
llvm-svn: 350250
David Carlier [Wed, 2 Jan 2019 19:11:44 +0000 (19:11 +0000)]
[Sanitizer] Disable arc4random seeding apis on for Non NetBSD platforms.
- arc4random_stir / arc4random_addrandom had been made obsolete (and removed) from FreeBSD 12.
Reviewers: krytarowski
Reviewed By: krytarowski
Differential Revision: https://reviews.llvm.org/D56210
llvm-svn: 350249
David Carlier [Wed, 2 Jan 2019 19:07:27 +0000 (19:07 +0000)]
[Sanitizer] Enable funopen on FreeBSD
Reviewers: krytarowski
Reviewed By: krytarowski
Differential Revision: https://reviews.llvm.org/D56209
llvm-svn: 350248
Adrian Prantl [Wed, 2 Jan 2019 19:06:22 +0000 (19:06 +0000)]
Add file-based synchronization to flaky test
TestQueues is failing randomly on green dragon and I suspect it is
because the enqueued threads haven't executed by the time we expect
them. This patch adds file-based synchronization to the queues.
Differential Revision: https://reviews.llvm.org/D56208
llvm-svn: 350247
Evgeniy Stepanov [Wed, 2 Jan 2019 19:05:26 +0000 (19:05 +0000)]
[sanitizer] Android does not provide <fstab.h>
llvm-svn: 350246
Craig Topper [Wed, 2 Jan 2019 19:01:05 +0000 (19:01 +0000)]
[X86] Remove X86ISD::INC/DEC. Just select them from X86ISD::ADD/SUB at isel time
INC/DEC are pretty much the same as ADD/SUB except that they don't update the C flag.
This patch removes the special nodes and just pattern matches from ADD/SUB during isel if the C flag isn't being used.
I had to avoid selecting DEC is the result isn't used. This will become a SUB immediate which will turned into a CMP later by optimizeCompareInstr. This lead to the one test change where we use a CMP instead of a DEC for an overflow intrinsic since we only checked the flag.
This also exposed a hole in our RMW flag matching use of hasNoCarryFlagUses. Our root node for the match is a store and there's no guarantee that all the flag users have been selected yet. So hasNoCarryFlagUses needs to check copyToReg and machine opcodes, but it also needs to check for the pre-match SETCC, SETCC_CARRY, BRCOND, and CMOV opcodes.
Differential Revision: https://reviews.llvm.org/D55975
llvm-svn: 350245
Zachary Turner [Wed, 2 Jan 2019 18:53:11 +0000 (18:53 +0000)]
Use map::insert instead of try_emplace.
try_emplace is C++17.
llvm-svn: 350244
Zachary Turner [Wed, 2 Jan 2019 18:33:54 +0000 (18:33 +0000)]
[NativePDB] Implement ParseDeclsForContext.
This is a first step towards getting lldb-test symbols working
with the native plugin. There is a remaining issue, which is
that the plugin expects that ParseDeclsForContext will also
create lldb symbols rather than just the decls, but the native
pdb plugin doesn't currently do this. This will be addressed
in a followup patch.
llvm-svn: 350243
Zachary Turner [Wed, 2 Jan 2019 18:33:32 +0000 (18:33 +0000)]
[NativePDB] Update function-types-classes test to check VarDecls.
A Previous patch added support for creating VarDecls for global
variables. This patch updates this test to be more strict and
actually check these, not just the types.
llvm-svn: 350242
Zachary Turner [Wed, 2 Jan 2019 18:33:12 +0000 (18:33 +0000)]
[MS Demangler] Add a flag for dumping types without tag specifier.
Sometimes it's useful to be able to output demangled names without
tag specifiers like "struct", "class", etc. This patch adds a
flag enabling this.
llvm-svn: 350241
Zachary Turner [Wed, 2 Jan 2019 18:32:50 +0000 (18:32 +0000)]
[NativePDB] Fix setting breakpoint by file and line.
There were several problems preventing this from working. The
first is that when the PDB had an absolute path to the main
source file, we would construct an invalid path by prepending the
compilation directory to it anyway. So we needed to check if the
path is already absolute first.
Second, LLDB assumes that the zero'th item in the support file list
is the main compilation unit. We were respecting this requirement,
but LLDB *also* requires that file to appear somewhere in the list
starting from index 1 as well. So the main compilation file should
appear in the support file list twice. And when parsing a line
table, it expects the LineEntry records to be constructed using
the 1-based index. With these two fixes we can now set breakpoints
by file and line using the native PDB reader.
llvm-svn: 350240
Craig Topper [Wed, 2 Jan 2019 18:19:07 +0000 (18:19 +0000)]
[DAGCombiner] After performing the division by constant optimization for a DIV or REM node, replace the users of the corresponding REM or DIV node if it exists.
Currently we expand the two nodes separately. This gives DAG combiner an opportunity to optimize the expanded sequence taking into account only one set of users. When we expand the other node we'll create the expansion again, but might not be able to optimize it the same way. So the nodes won't CSE and we'll have two similarish sequences in the same basic block. By expanding both nodes at the same time we'll avoid prematurely optimizing the expansion until both the division and remainder have been replaced.
Improves the test case from PR38217. There may be additional opportunities after this.
Differential Revision: https://reviews.llvm.org/D56145
llvm-svn: 350239
Nico Weber [Wed, 2 Jan 2019 18:13:14 +0000 (18:13 +0000)]
[gn build] Add fuzzers in llvm/tools that are needed for check-llvm
Also add a fuzzer() template for defining fuzzers that's similar to
add_llvm_fuzzer in the CMake build, and a build file for dependency
llvm/lib/FuzzMutate.
Also make `assert(defined(...` error strings a bit more self-consistent.
Differential Revision: https://reviews.llvm.org/D56194
llvm-svn: 350238
Craig Topper [Wed, 2 Jan 2019 18:09:41 +0000 (18:09 +0000)]
[X86] Adding full coverage of MC encoding for the XOP and LWP ISAs.
Adding MC regressions tests to cover the XOP isa set.
This patch is part of a larger task to cover MC encoding of all X86 isa sets started in revision: https://reviews.llvm.org/D39952
Differential Revision: https://reviews.llvm.org/D41392
llvm-svn: 350237
Craig Topper [Wed, 2 Jan 2019 17:58:30 +0000 (17:58 +0000)]
[LegalizeIntegerTypes] When promoting the result of an extract_vector_elt also promote the input type if necessary
By also promoting the input type we get a better idea for what scalar type to use. This can provide better results if the result of the extract is sign extended. What was previously happening is that the extract result would be legalized, sometime later the input of the sign extend would be legalized using the result of the extract. Then later the extract input would be legalized forcing a truncate into the input of the sign extend using a replace all uses. This requires DAG combine to combine out the sext/truncate pair. But sometimes we visited the truncate first and messed things up before the sext could be combined.
By creating the extract with the correct scalar type when we create legalize the result type, the truncate will be added right away. Then when the sign_extend input is legalized it will create an any_extend of the truncate which can be optimized by getNode to maybe remove the truncate. And then a sign_extend_inreg. Now DAG combine doesn't have to worry about getting rid of the extend.
This fixes the regression on X86 in D56156.
Differential Revision: https://reviews.llvm.org/D56176
llvm-svn: 350236
Craig Topper [Wed, 2 Jan 2019 17:58:27 +0000 (17:58 +0000)]
[DAGCombiner][X86][PowerPC] Teach visitSIGN_EXTEND_INREG to fold (sext_in_reg (aext/sext x)) -> (sext x) when x has more than 1 sign bit and the sext_inreg is from one of them.
If x has multiple sign bits than it doesn't matter which one we extend from so we can sext from x's msb instead.
The X86 setcc-combine.ll changes are a little weird. It appears we ended up with a (sext_inreg (aext (trunc (extractelt)))) after type legalization. The sext_inreg+aext now gets optimized by this combine to leave (sext (trunc (extractelt))). Then we visit the trunc before we visit the sext. This ends up changing the truncate to an extractvectorelt from a bitcasted vector. I have a follow up patch to fix this.
Differential Revision: https://reviews.llvm.org/D56156
llvm-svn: 350235
Nico Weber [Wed, 2 Jan 2019 17:38:22 +0000 (17:38 +0000)]
[gn build] Add build files for bugpoint-passes and LLVMHello plugins
These two plugins are loaded into a host process that contains all LLVM
symbols, so they don't link against anything. This required minor readjustments
to the tablegen() setup of IR.
Needed for check-llvm.
Differential Revision: https://reviews.llvm.org/D56204
llvm-svn: 350234
Michal Gorny [Wed, 2 Jan 2019 17:37:14 +0000 (17:37 +0000)]
[sanitizer_common] Implement funopen*() interceptors for NetBSD
Differential Revision: https://reviews.llvm.org/D56158
llvm-svn: 350233
Michal Gorny [Wed, 2 Jan 2019 17:37:09 +0000 (17:37 +0000)]
[sanitizer_common] Implement popen, popenve, pclose interceptors
Implement the interceptors for popen(), pclose() and popenve()
functions. The first two are POSIX, the third one is specific
to NetBSD. popen() spawns a process and creates a FILE object piping
data from/to that process. pclose() closes the pipe and waits for
the process to terminate appropriately.
For the purpose of popen(), the COMMON_INTERCEPTOR_FILE_OPEN macro is
modified to allow null path parameter.
Differential Revision: https://reviews.llvm.org/D56157
llvm-svn: 350232
Michal Gorny [Wed, 2 Jan 2019 17:37:04 +0000 (17:37 +0000)]
[sanitizer_common] Add tests for NetBSD funopen*() functions
Differential Revision: https://reviews.llvm.org/D56154
llvm-svn: 350231
Michal Gorny [Wed, 2 Jan 2019 17:37:00 +0000 (17:37 +0000)]
[sanitizer_common] Add test for popen()
Differential Revision: https://reviews.llvm.org/D56153
llvm-svn: 350230
Michal Gorny [Wed, 2 Jan 2019 17:36:55 +0000 (17:36 +0000)]
[sanitizer_common] Add tests for more *putc and *getc variants
Add tests for the more character-oriented functions, that is:
- fputc(), putc() and putchar()
- getc_unlocked()
- putc_unlocked() and putchar_unlocked()
Differential Revision: https://reviews.llvm.org/D56152
llvm-svn: 350229
Michal Gorny [Wed, 2 Jan 2019 17:36:50 +0000 (17:36 +0000)]
[sanitizer_common] Fix devname_r() return type on !NetBSD
Update the interceptor for devname_r() to account for correct return
types on different platforms. This function returns int on NetBSD
but char* on FreeBSD/OSX. Noticed by @krytarowski.
Differential Revision: https://reviews.llvm.org/D56150
llvm-svn: 350228
Michal Gorny [Wed, 2 Jan 2019 17:36:46 +0000 (17:36 +0000)]
[sanitizer_common] Rewrite more Posix tests to use asserts
Rewrite the tests for Posix functions that silently 'return 1'
or 'exit(1)' on error, to instead verbosely report the error using
assert. This is based on requests made in review of D56136.
Differential Revision: https://reviews.llvm.org/D56149
llvm-svn: 350227
Nico Weber [Wed, 2 Jan 2019 17:36:41 +0000 (17:36 +0000)]
[gn build] Add some llvm/tools: lli, lli-child-target
Also add build files for dependencies llvm/lib/ExecutionEngine/{Interpreter,Orc}
Needed for check-llvm.
Differential Revision: https://reviews.llvm.org/D56193
llvm-svn: 350226
Michal Gorny [Wed, 2 Jan 2019 17:36:37 +0000 (17:36 +0000)]
[sanitizer_common] Add tests for more stdio.h functions
Add two new test cases that test the following stdio.h functions:
- clearerr()
- feof()
- ferror()
- fileno()
- fgetc()
- getc()
- ungetc()
Differential Revision: https://reviews.llvm.org/D56136
llvm-svn: 350225
Pete Cooper [Wed, 2 Jan 2019 17:25:30 +0000 (17:25 +0000)]
Only convert objc messages to alloc to objc_alloc if the receiver is a class.
r348687 converted [Foo alloc] to objc_alloc(Foo). However the objc runtime method only takes a Class, not an arbitrary pointer.
This makes sure we are messaging a class before we convert these messages.
rdar://problem/
46943703
llvm-svn: 350224
Wei Mi [Wed, 2 Jan 2019 17:07:23 +0000 (17:07 +0000)]
[PowerPC] Remove SeenUse check when optimizing conditional branch in
PPCPreEmitPeephole pass.
PPCPreEmitPeephole will convert a BC to B when the conditional branch is
based on a constant CR by CRSET or CRUNSET. This is added in
https://reviews.llvm.org/rL343100.
When the conditional branch is known to be always taken, all branches will
be removed and a new unconditional branch will be inserted. However, when
SeenUse is false the original patch will not remove the branches, but still
insert the new unconditional branch, update the successors and create
inconsistent IR. Compiling the synthetic testcase included can show the
problem we run into.
The patch simply removes the SeenUse condition when adding branches into
InstrsToErase set.
Differential Revision: https://reviews.llvm.org/D56041
llvm-svn: 350223
Simon Pilgrim [Wed, 2 Jan 2019 17:05:37 +0000 (17:05 +0000)]
[X86] Support SHLD/SHRD masked shift-counts (PR34641)
Peek through shift modulo masks while matching double shift patterns.
I was hoping to delay this until I could remove the X86 code with generic funnel shift matching (PR40081) but this will do for now.
Differential Revision: https://reviews.llvm.org/D56199
llvm-svn: 350222
Sanjay Patel [Wed, 2 Jan 2019 16:36:04 +0000 (16:36 +0000)]
[x86] add more tests for potential horizontal ops; NFC
As discussed in D56011 - add runs for AVX512 and tests with extra uses.
llvm-svn: 350221
Hal Finkel [Wed, 2 Jan 2019 16:28:09 +0000 (16:28 +0000)]
[BasicAA] Support arbitrary pointer sizes (and fix an overflow bug)
Motivated by the discussion in D38499, this patch updates BasicAA to support
arbitrary pointer sizes by switching most remaining non-APInt calculations to
use APInt. The size of these APInts is set to the maximum pointer size (maximum
over all address spaces described by the data layout string).
Most of this translation is straightforward, but this patch contains a fix for
a bug that revealed itself during this translation process. In order for
test/Analysis/BasicAA/gep-and-alias.ll to pass, which is run with 32-bit
pointers, the intermediate calculations must be performed using 64-bit
integers. This is because, as noted in the patch, when GetLinearExpression
decomposes an expression into C1*V+C2, and we then multiply this by Scale, and
distribute, to get (C1*Scale)*V + C2*Scale, it can be the case that, even
through C1*V+C2 does not overflow for relevant values of V, (C2*Scale) can
overflow. If this happens, later logic will draw invalid conclusions from the
(base) offset value. Thus, when initially applying the APInt conversion,
because the maximum pointer size in this test is 32 bits, it started failing.
Suspicious, I created a 64-bit version of this test (included here), and that
failed (miscompiled) on trunk for a similar reason (the multiplication can
overflow).
After fixing this overflow bug, the first test case (at least) in
Analysis/BasicAA/q.bad.ll started failing. This is also a 32-bit test, and was
relying on having 64-bit intermediate values to have BasicAA return an accurate
result. In order to fix this problem, and because I believe that it is not
uncommon to use i64 indexing expressions in 32-bit code (especially portable
code using int64_t), it seems reasonable to always use at least 64-bit
integers. In this way, we won't regress our analysis capabilities (and there's
a command-line option added, so experimenting with this should be easy).
As pointed out by Eli during the review, there are other potential overflow
conditions that this patch does not address. Fixing those is left to follow-up
work.
Patch by me with contributions from Michael Ferguson (mferguson@cray.com).
Differential Revision: https://reviews.llvm.org/D38662
llvm-svn: 350220
Philip Pfaffe [Wed, 2 Jan 2019 15:41:47 +0000 (15:41 +0000)]
Extend Module::getOrInsertGlobal to control the construction of the
GlobalVariable
Summary:
Extend Module::getOrInsertGlobal to accept a callback for creating a new
GlobalVariable if necessary instead of calling the GV constructor
directly using default arguments. Additionally overload
getOrInsertGlobal for the previous default behavior.
Reviewers: chandlerc
Subscribers: hiraditya, llvm-commits, bollu
Differential Revision: https://reviews.llvm.org/D56130
llvm-svn: 350219
Andrea Di Biagio [Wed, 2 Jan 2019 15:40:52 +0000 (15:40 +0000)]
[MCA] Minor refactoring of method DefaultResourceStrategy::select. NFCI
Common code used by the default resource strategy to select pipeline resources
has been moved to an helper function.
The new selection logic has been slightly rewritten to get rid of a redundant
zero check on the `ReadyMask` value. Before this patch, method select internally
called function `PowerOf2Floor` to compute the next ready pipeline resource.
However, `PowerOf2Floor` forces an implicit (redundant) zero check on the input
value. By construction, `ReadyMask` can never be zero. This patch replaces the
call to `PowerOf2Floor` with an equivalent block of code which avoids the
redundant zero check. This gives a minor 3-3.5% speedup on a release build.
No functional change intended.
llvm-svn: 350218
Nico Weber [Wed, 2 Jan 2019 12:43:56 +0000 (12:43 +0000)]
[gn build] Add some llvm/tools: bugpoint, dsymutil, llvm-opt-report
Also add build file for dependency llvm/lib/OptRemarks.
Needed for check-llvm.
Differential Revision: https://reviews.llvm.org/D56192
llvm-svn: 350217
Nico Weber [Wed, 2 Jan 2019 12:42:39 +0000 (12:42 +0000)]
[gn build] Add some llvm/tools: llvm-c-test, llvm-cfi-verify, llvm-cov, llvm-cvtres
Needed for check-llvm.
Differential Revision: https://reviews.llvm.org/D56191
llvm-svn: 350216
Nico Weber [Wed, 2 Jan 2019 12:40:04 +0000 (12:40 +0000)]
[gn build] Add some llvm/tools: llvm-cxxdump, llvm-cxxfilt, llvm-cxxmap
Needed for check-llvm.
This is the last target reading llvm_install_binutils_symlinks.
Differential Revision: https://reviews.llvm.org/D56190
llvm-svn: 350215
Nico Weber [Wed, 2 Jan 2019 12:39:05 +0000 (12:39 +0000)]
[gn build] Add some llvm/tools: llvm-diff, llvm-dwp
Needed for check-llvm.
Differential Revision: https://reviews.llvm.org/D56189
llvm-svn: 350214
Nico Weber [Wed, 2 Jan 2019 12:37:52 +0000 (12:37 +0000)]
[gn build] Add some llvm/tools: llvm-mca, llvm-mt
Also add build file for dependency llvm/lib/MCA.
Needed for check-llvm.
Differential Revision: https://reviews.llvm.org/D56166
llvm-svn: 350213
Nico Weber [Wed, 2 Jan 2019 12:34:57 +0000 (12:34 +0000)]
[gn build] Add some llvm/tools: llvm-size, llvm-split, llvm-strings
Needed for check-llvm.
Differential Revision: https://reviews.llvm.org/D56164
llvm-svn: 350212
Nico Weber [Wed, 2 Jan 2019 12:32:49 +0000 (12:32 +0000)]
[gn build] Add some llvm/tools: llvm-xray, sancov, sanstats, verify-uselistorder, yaml-bench
Also add build file for dependency llvm/lib/XRay.
Needed for check-llvm.
(yaml-bench is an llvm/util, not an llvm/tool.)
Differential Revision: https://reviews.llvm.org/D56163
llvm-svn: 350211
Haojian Wu [Wed, 2 Jan 2019 11:25:37 +0000 (11:25 +0000)]
[clangd] Show FileStatus in vscode-clangd.
Summary:
The file status will be shown in the status bar.
Depends on D55363.
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D55374
llvm-svn: 350210
Pavel Labath [Wed, 2 Jan 2019 10:37:38 +0000 (10:37 +0000)]
NativeProcessProtocolTest: fix -Winconsistent-missing-override warning
The warning comes from the fact that the MOCK_METHOD macros don't use the
override keyword internally. This makes us not use it in the manually overriden
methods either, to be consistent.
llvm-svn: 350209
Piotr Sobczak [Wed, 2 Jan 2019 09:47:41 +0000 (09:47 +0000)]
[AMDGPU] Handle OR as operand of raw load/store
Summary:
Use isBaseWithConstantOffset() which handles OR as an operand
to llvm.amdgcn.raw.buffer.load and llvm.amdgcn.raw.buffer.store.
Change-Id: Ifefb9dc5ded8710d333df07ab1900b230e33539a
Reviewers: nhaehnle, mareko, arsenm
Reviewed By: arsenm
Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D55999
llvm-svn: 350208
Clement Courbet [Wed, 2 Jan 2019 09:21:00 +0000 (09:21 +0000)]
Revert rL350035 "[llvm-exegesis] Clustering: don't enqueue a point multiple times"
Let's discuss this on the review thread before submitting.
llvm-svn: 350207
Craig Topper [Wed, 2 Jan 2019 06:40:11 +0000 (06:40 +0000)]
[X86] Remove the separate SMUL8/UMUL8 X86ISD opcodes by merging with SMUL/UMUL. Remove the second result from X86ISD::UMUL.
All of these use custom isel so we can pretty easily detect the differences in the custom code in X86ISelDAGToDAG. The ISD opcodes just need to express the desired semantics not the details of how they would be selected by isel. So unifying them lets us remove the special casing from lowering.
llvm-svn: 350206
Craig Topper [Wed, 2 Jan 2019 05:46:03 +0000 (05:46 +0000)]
[X86] Allow LowerSELECT and LowerBRCOND to directly lower i8 UMULO/SMULO.
These require a different X86ISD node to be created than i16/i32/i64. I guess no one wanted to add the special code for that except in LowerXALUO. But now LowerXALUO, LowerSELECT, and LowerBRCOND all use a common helper function so they all share the special code.
Unfortunately, there are no test changes because we seem to correct the miss in a DAG combine later. I did verify it manually using test cases from xmulo.ll
llvm-svn: 350205
Craig Topper [Wed, 2 Jan 2019 05:46:02 +0000 (05:46 +0000)]
[X86] Add i8/i16 smulo/umulo test cases where the overflow indication is used by a mask.
llvm-svn: 350204
Craig Topper [Wed, 2 Jan 2019 05:46:00 +0000 (05:46 +0000)]
[X86] Remove KNL specific check prefix from xmulo.ll test. NFC
This was added at a time when i1 was a legal type with avx512f and there was a bug. i1 is no longer considered a legal type with avx512f so there should be no codegen difference.
llvm-svn: 350203
Petr Hosek [Wed, 2 Jan 2019 05:11:57 +0000 (05:11 +0000)]
[CMake][Fuchsia] Include check-lld in the list of bootstrap targets
This allows running lld tests when doing 2-stage toolchain build.
Differential Revision: https://reviews.llvm.org/D56181
llvm-svn: 350202
Sanjay Patel [Tue, 1 Jan 2019 21:51:39 +0000 (21:51 +0000)]
[InstCombine] canonicalize raw IR rotate patterns to funnel shift
The final piece of IR-level analysis to allow this was committed with:
rL350188
Using the intrinsics should improve transforms based on cost models
like vectorization and inlining.
The backend should be prepared too, so we can now canonicalize more
sequences of shift/logic to the intrinsics and know that the end
result should be equal or better to the original code even if the
target does not have an actual rotate instruction.
llvm-svn: 350199
Craig Topper [Tue, 1 Jan 2019 19:34:11 +0000 (19:34 +0000)]
[X86] Factor the core code out of LowerXALUO into a helper function. Use it in LowerBRCOND and LowerSELECT to avoid some duplicated code.
This makes it easier to keep the LowerBRCOND and LowerSELECT code in sync with LowerXALUO so they always pick the same operation for overflowing instructions.
This is inspired by the helper functions used by ARM and AArch64 for the same purpose.
The test change is because LowerSELECT was not in sync with LowerXALUO with regard to INC/DEC for SADDO/SSUBO.
llvm-svn: 350198
Robert Widmann [Tue, 1 Jan 2019 19:03:37 +0000 (19:03 +0000)]
[LLVM-C] bool -> LLVMBool
llvm-svn: 350197
Robert Widmann [Tue, 1 Jan 2019 18:56:51 +0000 (18:56 +0000)]
[LLVM-C] Add Accessors for Discarding Value Names in the IR
Summary: Add accessors so the performance improvement from this setting is accessible to third parties.
Reviewers: whitequark, deadalnix
Reviewed By: whitequark
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D56179
llvm-svn: 350196
Craig Topper [Tue, 1 Jan 2019 18:44:44 +0000 (18:44 +0000)]
[X86] Remove KNL specific check prefix from xaluo.ll test. NFC
This was added at a time when i1 was a legal type with avx512f and there was a bug. i1 is no longer considered a legal type with avx512f so there should be no codegen difference.
llvm-svn: 350195
Craig Topper [Tue, 1 Jan 2019 18:44:42 +0000 (18:44 +0000)]
[X86] Add test cases to show where LowerSELECT doesn't select SADDO/SSUBO to INC/DEC, but LowerXALUOOp does. Leading to duplicate code.
When SADDO/SSUBO is used as a part of a condition, the X86 backend has to lower the instruction twice. One for the flags use and then once for the data use. These two selections should be kept in sync so they end up with one node providing the data and the flags. This doesn't seem to be happening for INC/DEC.
llvm-svn: 350194
Sanjay Patel [Tue, 1 Jan 2019 16:08:36 +0000 (16:08 +0000)]
[x86] move/rename helper for horizontal op codegen; NFC
Preliminary commit as suggested in D56011.
llvm-svn: 350193
Sylvestre Ledru [Tue, 1 Jan 2019 12:51:14 +0000 (12:51 +0000)]
Fix some typos in the clang doc.
Fixed with:
$ codespell -w ClangFormatStyleOptions.rst Toolchain.rst LanguageExtensions.rst ClangCommandLineReference.rst
llvm-svn: 350192
Sylvestre Ledru [Tue, 1 Jan 2019 12:32:08 +0000 (12:32 +0000)]
clang-format-diff: add an example with hg
llvm-svn: 350191
Nikita Popov [Tue, 1 Jan 2019 12:27:23 +0000 (12:27 +0000)]
[BDCE] Regenerate test checks; NFC
llvm-svn: 350190
Nikita Popov [Tue, 1 Jan 2019 10:17:35 +0000 (10:17 +0000)]
[BDCE] Remove -instsimplify from BDCE test; NFC
To make it more obvious which part of the transformation is carried
out by BDCE. Also drop the CHECK-IO lines which only run -instsimplify
as they don't really seem meaningful if the main check doesn't run
-instsimplify either.
llvm-svn: 350189
Nikita Popov [Tue, 1 Jan 2019 10:05:26 +0000 (10:05 +0000)]
Reapply "[BDCE][DemandedBits] Detect dead uses of undead instructions"
This (mostly) fixes https://bugs.llvm.org/show_bug.cgi?id=39771.
BDCE currently detects instructions that don't have any demanded bits
and replaces their uses with zero. However, if an instruction has
multiple uses, then some of the uses may be dead (have no demanded bits)
even though the instruction itself is still live. This patch extends
DemandedBits/BDCE to detect such uses and replace them with zero.
While this will not immediately render any instructions dead, it may
lead to simplifications (in the motivating case, by converting a rotate
into a simple shift), break dependencies, etc.
The implementation tries to strike a balance between analysis power and
complexity/memory usage. Originally I wanted to track demanded bits on
a per-use level, but ultimately we're only really interested in whether
a use is entirely dead or not. I'm using an extra set to track which uses
are dead. However, as initially all uses are dead, I'm not storing uses
those user is also dead. This case is checked separately instead.
The previous attempt to land this lead to miscompiles, because cases
where uses were initially dead but were later found to be live during
further analysis were not always correctly removed from the DeadUses
set. This is fixed now and the added test case demanstrates such an
instance.
Differential Revision: https://reviews.llvm.org/D55563
llvm-svn: 350188
Ayonam Ray [Tue, 1 Jan 2019 07:28:55 +0000 (07:28 +0000)]
Reversing the commit in revision 350186. Revision causes regression in 4
tests.
llvm-svn: 350187
Ayonam Ray [Tue, 1 Jan 2019 06:37:50 +0000 (06:37 +0000)]
Omit range checks from jump tables when lowering switches with unreachable
default
During the lowering of a switch that would result in the generation of a jump
table, a range check is performed before indexing into the jump table, for the
switch value being outside the jump table range and a conditional branch is
inserted to jump to the default block. In case the default block is
unreachable, this conditional jump can be omitted. This patch implements
omitting this conditional branch for unreachable defaults.
Review Reference: D52002
llvm-svn: 350186
Chen Zheng [Tue, 1 Jan 2019 01:09:20 +0000 (01:09 +0000)]
[InstCombine] canonicalize MUL with NEG operand
-X * Y --> -(X * Y)
X * -Y --> -(X * Y)
Differential Revision: https://reviews.llvm.org/D55961
llvm-svn: 350185