Craig Topper [Thu, 21 Dec 2017 05:58:31 +0000 (05:58 +0000)]
[X86] Use VPERMB/VPERMI2B for v32i8 shuffle lowering if VBMI and VLX are supported.
llvm-svn: 321248
Craig Topper [Thu, 21 Dec 2017 03:58:31 +0000 (03:58 +0000)]
[X86] Add avx512vbmi command lines to vector-shuffle-256-v32.ll
llvm-svn: 321247
Sam Clegg [Thu, 21 Dec 2017 03:16:34 +0000 (03:16 +0000)]
[WebAssembly] Remove unneeded sub-directory
This is the only wasm def (and likely likely will be
for the foreseeable) file so no need for a sub-directory
Differential Revision: https://reviews.llvm.org/D41476
llvm-svn: 321246
Sam Clegg [Thu, 21 Dec 2017 02:43:39 +0000 (02:43 +0000)]
[WebAssmebly] Fix references to weak aliases
Corresponding LLVM change: https://reviews.llvm.org/D41472
Differential Revision: https://reviews.llvm.org/D41473
llvm-svn: 321244
Sanjoy Das [Thu, 21 Dec 2017 02:34:39 +0000 (02:34 +0000)]
Revert "Expose a TargetMachine::getTargetTransformInfo function"
This reverts commit r321234. It breaks the -DBUILD_SHARED_LIBS=ON build.
llvm-svn: 321243
Sam Clegg [Thu, 21 Dec 2017 02:30:38 +0000 (02:30 +0000)]
[WebAssembly] Fix local references to weak aliases
When weak aliases are used with in same translation
unit we need to be able to directly reference to alias
and not just the thing it is aliases. We do this by
defining both a wasm import and a wasm export in this
case that result in a single Symbol. This change is
a partial revert of rL314245. A corresponding lld
change address the previous issues we had with this.
See: https://github.com/WebAssembly/tool-conventions/issues/34
Differential Revision: https://reviews.llvm.org/D41472
llvm-svn: 321242
Sam Clegg [Thu, 21 Dec 2017 02:30:09 +0000 (02:30 +0000)]
[WebAssembly] Improve weak alias tests cases
Based on: https://github.com/WebAssembly/tool-conventions/issues/34
Currently weak-alias-overide.ll exhibits incorrect
behaviour in that call_direct() calls the wrong function.
Differential Revision: https://reviews.llvm.org/D41460
llvm-svn: 321241
Rafael Espindola [Thu, 21 Dec 2017 02:11:51 +0000 (02:11 +0000)]
Pass an InputFile to the InputSection constructor.
This simplifies toRegularSection and reduces the noise in a followup
patch.
llvm-svn: 321240
Erich Keane [Thu, 21 Dec 2017 02:07:46 +0000 (02:07 +0000)]
Fix for PR32990
This fixes the bug in https://bugs.llvm.org/show_bug.cgi?id=32990.
Patch By: zahiraam
Differential Revision: https://reviews.llvm.org/D39063
llvm-svn: 321239
Rafael Espindola [Thu, 21 Dec 2017 02:03:39 +0000 (02:03 +0000)]
Convert a few more InputFiles to references.
We use null files in sections to represent linker created sections,
so ObjFile<ELFT> is never null.
llvm-svn: 321238
Aaron Ballman [Thu, 21 Dec 2017 01:34:46 +0000 (01:34 +0000)]
Reverting a file that snuck in with r321229 by accident.
llvm-svn: 321237
Michael Zolotukhin [Thu, 21 Dec 2017 01:22:13 +0000 (01:22 +0000)]
[SimplifyCFG] Avoid quadratic on a predecessors number behavior in instruction sinking.
If a block has N predecessors, then the current algorithm will try to
sink common code to this block N times (whenever we visit a
predecessor). Every attempt to sink the common code includes going
through all predecessors, so the complexity of the algorithm becomes
O(N^2).
With this patch we try to sink common code only when we visit the block
itself. With this, the complexity goes down to O(N).
As a side effect, the moment the code is sunk is slightly different than
before (the order of simplifications has been changed), that's why I had
to adjust two tests (note that neither of the tests is supposed to test
SimplifyCFG):
* test/CodeGen/AArch64/arm64-jumptable.ll - changes in this test mimic
the changes that previous implementation of SimplifyCFG would do.
* test/CodeGen/ARM/avoid-cpsr-rmw.ll - in this test I disabled common
code sinking by a command line flag.
llvm-svn: 321236
Rafael Espindola [Thu, 21 Dec 2017 01:21:59 +0000 (01:21 +0000)]
Detemplate createCommentSection.
It was only templated so it could create a dummy section header that
was immediately parsed back.
llvm-svn: 321235
Sanjoy Das [Thu, 21 Dec 2017 01:06:58 +0000 (01:06 +0000)]
Expose a TargetMachine::getTargetTransformInfo function
Summary:
This makes the TargetMachine interface a bit simpler. We still need
the std::function in TargetIRAnalysis to avoid having to add a
dependency from Analysis to Target.
See discussion:
http://lists.llvm.org/pipermail/llvm-dev/2017-December/119749.html
I avoided adding all of the backend owners to this review since the
change is simple, but let me know if you feel differently about this.
Reviewers: echristo, MatzeB, hfinkel
Reviewed By: hfinkel
Subscribers: jholewinski, jfb, arsenm, dschuff, mcrosier, sdardis, nemanjai, nhaehnle, javed.absar, sbc100, jgravelle-google, aheejin, kbarton, llvm-commits
Differential Revision: https://reviews.llvm.org/D41464
llvm-svn: 321234
Reid Kleckner [Thu, 21 Dec 2017 00:28:34 +0000 (00:28 +0000)]
Attempt to pacify 4.8.5 with makeArrayRef
llvm-svn: 321233
Vedant Kumar [Thu, 21 Dec 2017 00:10:36 +0000 (00:10 +0000)]
[ubsan] Diagnose noreturn functions which return (compiler-rt)
This is paired with the clang change: https://reviews.llvm.org/D40698
Differential Revision: https://reviews.llvm.org/D40700
llvm-svn: 321232
Vedant Kumar [Thu, 21 Dec 2017 00:10:25 +0000 (00:10 +0000)]
[ubsan] Diagnose noreturn functions which return
Diagnose 'unreachable' UB when a noreturn function returns.
1. Insert a check at the end of functions marked noreturn.
2. A decl may be marked noreturn in the caller TU, but not marked in
the TU where it's defined. To diagnose this scenario, strip away the
noreturn attribute on the callee and insert check after calls to it.
Testing: check-clang, check-ubsan, check-ubsan-minimal, D40700
rdar://
33660464
Differential Revision: https://reviews.llvm.org/D40698
llvm-svn: 321231
Vedant Kumar [Thu, 21 Dec 2017 00:10:24 +0000 (00:10 +0000)]
[Driver] Ensure no overlap between trapping & recoverable sanitizers. NFC.
This is NFC because in EmitCheck(), -fsanitize-trap=X overrides
-fsanitize-recover=X.
llvm-svn: 321230
Aaron Ballman [Wed, 20 Dec 2017 23:17:29 +0000 (23:17 +0000)]
Reverting r321223 and its follow-up commit because of failing bots due to Misc/ast-dump-color.cpp.
llvm-svn: 321229
Aaron Ballman [Wed, 20 Dec 2017 23:11:05 +0000 (23:11 +0000)]
Silence a -Wreorder warning from r321223.
llvm-svn: 321228
Matt Morehouse [Wed, 20 Dec 2017 22:29:23 +0000 (22:29 +0000)]
[clangd-fuzzer] Update ClangdLSPServer constructor call.
Build was broken by r321092.
llvm-svn: 321226
Simon Dardis [Wed, 20 Dec 2017 22:26:41 +0000 (22:26 +0000)]
[orc][cmake] Check if 8 byte atomics require libatomic for unittest
rL319838 introduced SymbolStringPool which uses 8 byte atomics for
reference counters. On systems which do not support such atomics
natively such as MIPS32, explicitly add libatomic as one of the
libraries for SymbolStringPool's unittest.
Reviewers: lhames, beanz
Differential Revision: https://reviews.llvm.org/D41010
llvm-svn: 321225
Joel Galenson [Wed, 20 Dec 2017 22:25:39 +0000 (22:25 +0000)]
[ARM] Optimize {s,u}{add,sub}.with.overflow.
The AArch64 backend contains code to optimize {s,u}{add,sub}.with.overflow during SelectionDAG. This commit ports that code to the ARM backend.
Differential revision: https://reviews.llvm.org/D35635
llvm-svn: 321224
Aaron Ballman [Wed, 20 Dec 2017 22:04:54 +0000 (22:04 +0000)]
Add a printing policy to the ASTDumper.
This allows you to dump C++ code that spells bool instead of _Bool, leaves off the elaborated type specifiers when printing struct or class names, and other C-isms.
llvm-svn: 321223
Alex Lorenz [Wed, 20 Dec 2017 21:03:38 +0000 (21:03 +0000)]
Fix an assertion failure regression in isDesignatorAtObjectEnd for
__builtin_object_size with incomplete array type in struct
The commit r316245 introduced a regression that causes an assertion failure when
Clang tries to cast an IncompleteArrayType to a PointerType when evaluating
__builtin_object_size.
rdar://
36094951
Differential Revision: https://reviews.llvm.org/D41405
llvm-svn: 321222
Krzysztof Parzyszek [Wed, 20 Dec 2017 20:54:13 +0000 (20:54 +0000)]
[Hexagon] Use ArrayRef member functions instead of custom ones
llvm-svn: 321221
Krzysztof Parzyszek [Wed, 20 Dec 2017 20:49:43 +0000 (20:49 +0000)]
[Hexagon] Allow construction of HVX vector predicates
Handle BUILD_VECTOR of boolean values.
llvm-svn: 321220
Rafael Espindola [Wed, 20 Dec 2017 20:46:08 +0000 (20:46 +0000)]
Use dyn_cast instead of dyn_cast_or_null.
There should be no null sections in InputSections.
llvm-svn: 321219
Krzysztof Parzyszek [Wed, 20 Dec 2017 20:33:49 +0000 (20:33 +0000)]
[Hexagon] Legalize vector elements to i32 in buildVector32/64
llvm-svn: 321218
Aaron Ballman [Wed, 20 Dec 2017 20:09:30 +0000 (20:09 +0000)]
Do not generate an empty switch statement as it causes MSVC to issue diagnostics about switch statements without case or default labels.
llvm-svn: 321217
Rafael Espindola [Wed, 20 Dec 2017 19:59:47 +0000 (19:59 +0000)]
clang-format. NFC.
llvm-svn: 321216
Yonghong Song [Wed, 20 Dec 2017 19:39:58 +0000 (19:39 +0000)]
bpf: add support for objdump -print-imm-hex
Add support for 'objdump -print-imm-hex' for imm64, operand imm
and branch target. If user programs encode immediate values
as hex numbers, such an option will make it easy to correlate
asm insns with source code. This option also makes it easy
to correlate imm values with insn encoding.
There is one changed behavior in this patch. In old way, we
print the 64bit imm as u64:
O << (uint64_t)Op.getImm();
and the new way is:
O << formatImm(Op.getImm());
The formatImm is defined in llvm/MC/MCInstPrinter.h as
format_object<int64_t> formatImm(int64_t Value)
So the new way to print 64bit imm is i64 type.
If a 64bit value has the highest bit set, the old way
will print the value as a positive value and the
new way will print as a negative value. The new way
is consistent with x86_64.
For the code (see the test program):
...
if (a == 0xABCDABCDabcdabcdULL)
...
x86_64 objdump, with and without -print-imm-hex, looks like:
48 b8 cd ab cd ab cd ab cd ab movabsq $-
6067004223159161907, %rax
48 b8 cd ab cd ab cd ab cd ab movabsq $-0x5432543254325433, %rax
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 321215
David Blaikie [Wed, 20 Dec 2017 19:36:54 +0000 (19:36 +0000)]
PR35705: Fix Chapter 9 example code for API changes to DIBuilder
llvm-svn: 321214
Craig Topper [Wed, 20 Dec 2017 19:36:43 +0000 (19:36 +0000)]
[X86] Refactor DomainReassignment pass to make the Closure class not stores references to the main data structures of the pass itself
Multiple Closure objects can be created and stored for a single function. It's not a good idea to devote so many fields of it to storing pointers and references to global data structures of the pass. The closure class should only store the things needed to represent the closure itself.
This patch refactors many of the methods of Closure to belong to the pass object and to pass around a reference to the current Closure. The Closure class gains a few simple methods to add instructions and edges, and to return iterators to edges and instructions
Differential Revision: https://reviews.llvm.org/D41327
llvm-svn: 321213
Matt Arsenault [Wed, 20 Dec 2017 19:36:28 +0000 (19:36 +0000)]
TableGen: Allow setting SDNodeProperties on intrinsics
Allows preserving MachineMemOperands on intrinsics
through selection. For reasons I don't understand, this
is a static property of the pattern and the selector
deliberately goes out of its way to drop if not present.
Intrinsics already inherit from SDPatternOperator allowing
them to be used directly in instruction patterns. SDPatternOperator
has a list of SDNodeProperty, but you currently can't set them on
the intrinsic. Without SDNPMemOperand, when the node is selected
any memory operands are always dropped. Allowing setting this
on the intrinsics avoids needing to introduce another equivalent
target node just to have SDNPMemOperand set.
llvm-svn: 321212
Max Moroz [Wed, 20 Dec 2017 19:31:51 +0000 (19:31 +0000)]
[libfuzzer] Fix UB when calculating Log(0) in StackDepthStepFunction().
Summary:
__builtin_clz used for Log calculation returns an undefined result
when argument is 0. I noticed that issue when was testing some fuzzers:
```
/src/libfuzzer/FuzzerTracePC.h:282:33: runtime error: shift exponent 450349 is too large for 32-bit type 'uint32_t' (aka 'unsigned int')
#0 0x43d83f in operator() /src/libfuzzer/FuzzerTracePC.h:283:33
#1 0x43d83f in void fuzzer::TracePC::CollectFeatures<fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*)::$_1>(fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*)::$_1) const /src/libfuzzer/FuzzerTracePC.h:290
#2 0x43cbd4 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:445:7
#3 0x43e5f1 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:706:5
#4 0x43e9e1 in fuzzer::Fuzzer::Loop(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:739:3
#5 0x432f8c in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:754:6
#6 0x42ee18 in main /src/libfuzzer/FuzzerMain.cpp:20:10
#7 0x7f17ffeb182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#8 0x407838 in _start (/out/rotate_fuzzer+0x407838)
Reviewers: kcc
Reviewed By: kcc
Subscribers: llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D41457
llvm-svn: 321211
Matthew Simpson [Wed, 20 Dec 2017 19:26:37 +0000 (19:26 +0000)]
[ICP] Expose unconditional call promotion interface
This patch modifies the indirect call promotion utilities by exposing and using
an unconditional call promotion interface. The unconditional promotion
interface (i.e., call promotion without creating an if-then-else) can be used
if it's known that an indirect call has only one possible callee. The existing
conditional promotion interface uses this unconditional interface to promote an
indirect call after it has been versioned and placed within the "then" block.
A consequence of unconditional promotion is that the fix-up operations for phi
nodes in the normal destination of invoke instructions are changed. This is
necessary because the existing implementation assumed that an invoke had been
versioned, creating a "merge" block where a return value bitcast could be
placed. In the new implementation, the edge between a promoted invoke's parent
block and its normal destination is split if needed to add a bitcast for the
return value. If the invoke is also versioned, the phi node merging the return
value of the promoted and original invoke instructions is placed in the "merge"
block.
Differential Revision: https://reviews.llvm.org/D40751
llvm-svn: 321210
Craig Topper [Wed, 20 Dec 2017 19:25:33 +0000 (19:25 +0000)]
[X86] Remove zext from vXi32 to vXi64 on indices of gather/scatter instructions if we can prove the pre-extended value is positive.
Gather/scatter can implicitly sign extend from i32->i64 on indices. So if we know the sign bit of the input to a zext is 0 we can use the implicit extension.
llvm-svn: 321209
Matt Arsenault [Wed, 20 Dec 2017 19:11:59 +0000 (19:11 +0000)]
DAG: Tolerate non-MemSDNodes for OPC_RecordMemRef
When intrinsics are allowed to have mem operands, there
are two ways this can happen. First is an intrinsic
that is marked has having a mem operand, but is not handled
by getTgtMemIntrinsic.
The second way can occur even for intrinsics which do not
have a mem operand. It seems the selector table does
some kind of sorting based on the opcode, and the
mem ref recording can happen in the same scope for
intrinsics that both do and do not have mem refs.
I haven't been able to figure out exactly why this happens
(although it happens even with the matcher optimizations disabled).
I'm not sure if it's worth trying to avoid hitting this for
these nodes since I think it's still reasonable to handle
this in case getTgtMemIntrinic is not implemented.
llvm-svn: 321208
Warren Ristow [Wed, 20 Dec 2017 19:11:31 +0000 (19:11 +0000)]
Improve the test for r320216. NFC.
Patch by Matthew Voss!
llvm-svn: 321207
Adam Nemet [Wed, 20 Dec 2017 19:08:12 +0000 (19:08 +0000)]
[opt-viewer] Also demangle indirect-call promotion targets
llvm-svn: 321206
Stefan Pintilie [Wed, 20 Dec 2017 19:07:44 +0000 (19:07 +0000)]
[PowerPC] Added an assert to make sure that the MBBI iterator is valid.
The function createTailCallBranchInstr assumes that the iterator MBBI is valid.
However, only one use of MBBI is guarded in the function.
Fix this by adding an assert.
Differential Revision: https://reviews.llvm.org/D41358
llvm-svn: 321205
Nirav Dave [Wed, 20 Dec 2017 19:06:47 +0000 (19:06 +0000)]
[DAG] Fix condition on overlapping store check.
Prevent overlapping store elision when overlapping store is
pre-inc/dec as analysis is wrong in these cases.
llvm-svn: 321204
Evgeniy Stepanov [Wed, 20 Dec 2017 19:05:44 +0000 (19:05 +0000)]
[hwasan] Implement -fsanitize-recover=hwaddress.
Summary: Very similar to AddressSanitizer, with the exception of the error type encoding.
Reviewers: kcc, alekseyshl
Subscribers: cfe-commits, kubamracek, llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D41417
llvm-svn: 321203
Matt Arsenault [Wed, 20 Dec 2017 18:52:57 +0000 (18:52 +0000)]
[AMDGPU, AsmParser] Enable the mnemonic spell corrector.
Patch by Dmitry Venikov
llvm-svn: 321202
Erich Keane [Wed, 20 Dec 2017 18:51:08 +0000 (18:51 +0000)]
Add support for ObjectFormat to TargetSpecificAttr
Looking through the code, I saw a FIXME on IFunc to switch it
to a target specific attribute. In looking through it, i saw that
the no-longer-appropriately-named TargetArch didn't support ObjectFormat
checking.
This patch changes the name of TargetArch to TargetSpecific
(since it checks much more than just Arch), makes "Arch" optional, adds
support for ObjectFormat, better documents the TargetSpecific type, and
changes IFunc over to a TargetSpecificAttr.
Differential Revision: https://reviews.llvm.org/D41303
llvm-svn: 321201
Craig Topper [Wed, 20 Dec 2017 18:05:15 +0000 (18:05 +0000)]
[X86] Implement the fusing of MUL+SUBADD to FMSUBADD
This patch turns shuffles of fadd/fsub with fmul into fmsubadd.
Patch by Dmitry Venikov
Differential Revision: https://reviews.llvm.org/D40335
llvm-svn: 321200
Rafael Espindola [Wed, 20 Dec 2017 18:01:32 +0000 (18:01 +0000)]
Pass a InputFile reference to the Lazy constructor. NFC.
llvm-svn: 321199
Rafael Espindola [Wed, 20 Dec 2017 17:59:43 +0000 (17:59 +0000)]
Use a reference to a file in the LazyArchive symbol.
It is never null.
llvm-svn: 321198
Teresa Johnson [Wed, 20 Dec 2017 17:53:10 +0000 (17:53 +0000)]
[PGO] Function section hotness prefix should look at all blocks
Summary:
The function section prefix for PGO based layout (e.g. hot/unlikely)
should look at the hotness of all blocks not just the entry BB.
A function with a cold entry but a very hot loop should be placed in the
hot section, for example, so that it is located close to other hot
functions it may call. For SamplePGO it was already looking at the
branch weights on calls, and I made that code conditional on whether
this is SamplePGO since it was essentially a noop for instrumentation
PGO anyway.
Reviewers: davidxl
Subscribers: eraman, llvm-commits
Differential Revision: https://reviews.llvm.org/D41395
llvm-svn: 321197
Rafael Espindola [Wed, 20 Dec 2017 17:52:36 +0000 (17:52 +0000)]
LazyObject's file is never null, use a reference.
llvm-svn: 321196
Rafael Espindola [Wed, 20 Dec 2017 17:48:28 +0000 (17:48 +0000)]
Use a reference in addLazyArchive. NFC.
llvm-svn: 321194
Eric Liu [Wed, 20 Dec 2017 17:24:31 +0000 (17:24 +0000)]
[clangd] Pull CodeCompletionString handling logic into its own file and add unit test.
Reviewers: sammccall
Subscribers: klimek, mgorny, ilya-biryukov, cfe-commits
Differential Revision: https://reviews.llvm.org/D41450
llvm-svn: 321193
Eric Liu [Wed, 20 Dec 2017 17:22:56 +0000 (17:22 +0000)]
[clangd] Remove an unused lambda capture.
llvm-svn: 321192
Florian Hahn [Wed, 20 Dec 2017 17:16:59 +0000 (17:16 +0000)]
[InstCombine] Add debug location to new caller.
Reviewers: rnk, aprantl, majnemer
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D414
llvm-svn: 321191
Gabor Horvath [Wed, 20 Dec 2017 16:55:41 +0000 (16:55 +0000)]
Make DiagnosticIDs::getAllDiagnostics use std::vector. NFC.
The size of the result vector is currently around 4600 with
Flavor::WarningOrError, which makes std::vector a better candidate than
llvm::SmallVector.
Patch by: Andras Leitereg!
Differential Revision: https://reviews.llvm.org/D39372
llvm-svn: 321190
Ilya Biryukov [Wed, 20 Dec 2017 16:48:56 +0000 (16:48 +0000)]
[clang] Add BeforeExecute method to PrecompiledPreamble
Summary: Adds BeforeExecute method to PrecompiledPreamble to be called
before Execute(). This method can be overriden.
Patch by William Enright.
Reviewers: malaperle, ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: arphaman, cfe-commits, ilya-biryukov
Differential Revision: https://reviews.llvm.org/D41365
llvm-svn: 321189
Marshall Clow [Wed, 20 Dec 2017 16:31:40 +0000 (16:31 +0000)]
Fix the definitions of 'reference' and 'pointer' in string_view that no one uses :-). Thanks to K-ballo for the catch.
llvm-svn: 321188
Rafael Espindola [Wed, 20 Dec 2017 16:28:19 +0000 (16:28 +0000)]
Use a reference for the shared symbol file.
Every shared symbol has a file, so we can use a reference.
llvm-svn: 321187
Rafael Espindola [Wed, 20 Dec 2017 16:19:48 +0000 (16:19 +0000)]
Use a reference for a value that is never null. NFC.
llvm-svn: 321186
Rafael Espindola [Wed, 20 Dec 2017 16:16:40 +0000 (16:16 +0000)]
Use a reference for a value that is never null. NFC.
llvm-svn: 321185
Sam McCall [Wed, 20 Dec 2017 16:06:05 +0000 (16:06 +0000)]
[clangd] Switch xrefs and documenthighlight to annotated-code unit tests. NFC
Summary:
The goal here is again to make it easier to read and write the tests.
I've extracted `parseTextMarker` from CodeCompleteTests into an `Annotations`
class, adding features to it:
- as well as points `^s` it allows ranges `[[...]]`
- multiple points and ranges are supported
- points and ranges may be named: `$name^` and `$name[[...]]`
These features are used for the xrefs tests. This also paves the way for
replacing the lit diagnostics.test with more readable unit tests, using named
ranges.
Alternative considered: `TestSelectionRange` in clang-refactor/TestSupport
Main problems were:
- delimiting the end of ranges is awkward, requiring counting
- comment syntax is long and at least as cryptic for most cases
- no separate syntax for point vs range, which keeps xrefs tests concise
- Still need to convert to Position everywhere
- Still need helpers for common case of expecting exactly one point/range
(I'll probably promote the extra `PrintTo`s from some of the core Protocol types
into `operator<<` in `Protocol.h` itself in a separate, prior patch...)
Reviewers: ioeric
Subscribers: klimek, mgorny, ilya-biryukov, cfe-commits
Differential Revision: https://reviews.llvm.org/D41432
llvm-svn: 321184
Florian Hahn [Wed, 20 Dec 2017 15:50:52 +0000 (15:50 +0000)]
[Complex] Don't use __div?c3 when building with fast-math.
Summary: Plant an inline version of "((ac+bd)/(cc+dd)) + i((bc-ad)/(cc+dd))" instead.
Patch by Paul Walker.
Reviewed By: hfinkel
Differential Revision: https://reviews.llvm.org/D40299
llvm-svn: 321183
Nemanja Ivanovic [Wed, 20 Dec 2017 15:44:32 +0000 (15:44 +0000)]
[JumpTables] Let targets decide which switch instructions are suitable
This commits the non-controversial part of https://reviews.llvm.org/D41029
(making the queries virtual). The PPC-specific portion of this will be
committed in a subsequent patch once some of the finer points are ironed out.
llvm-svn: 321182
Mohammad Shahid [Wed, 20 Dec 2017 15:26:59 +0000 (15:26 +0000)]
Revert r320548:[SLP] Vectorize jumbled memory loads
llvm-svn: 321181
Krzysztof Parzyszek [Wed, 20 Dec 2017 15:15:04 +0000 (15:15 +0000)]
Add optional SelectionDAG* parameter to SValue::dump and SDValue::dumpr
These functions simply call their counterparts in the associated SDNode,
which do take an optional SelectionDAG. This change makes the legalization
debug trace a little easier to read, since target-specific nodes will
now have their names shown instead of "Unknown node #123".
llvm-svn: 321180
Javed Absar [Wed, 20 Dec 2017 15:06:26 +0000 (15:06 +0000)]
[SCEV] Fix Typo. NFC.
llvm-svn: 321179
Alexey Bataev [Wed, 20 Dec 2017 14:55:10 +0000 (14:55 +0000)]
[NVPTX] Initial adaptation of MCAsmStreamer/MCTargetStreamer for debug info in Cuda.
Summary:
Initial changes in interfaces of MCAsmStreamer/MCTargetStreamer for
correct debug info emission for Cuda.
1. PTX foramt does not support `.ascii` directives. Added the ability to
nullify it.
2. The initial function label must follow the first debug `.loc`
directive, not be followed by.
3. DWARF sections must be enclosed in braces.
Reviewers: hfinkel, probinson, jlebar, rafael, echristo
Subscribers: sdardis, nemanjai, llvm-commits, aprantl
Differential Revision: https://reviews.llvm.org/D40033
llvm-svn: 321178
Krzysztof Parzyszek [Wed, 20 Dec 2017 14:44:05 +0000 (14:44 +0000)]
[Hexagon] Adjust the value type for BCvt in LowerFormalArguments
llvm-svn: 321177
Daniel Sanders [Wed, 20 Dec 2017 14:41:51 +0000 (14:41 +0000)]
[globalisel][tablegen] Allow ImmLeaf predicates to use InstructionSelector members
NFC for currently supported targets. This resolves a problem encountered by
targets such as RISCV that reference `Subtarget` in ImmLeaf predicates.
llvm-svn: 321176
Ilya Biryukov [Wed, 20 Dec 2017 14:39:07 +0000 (14:39 +0000)]
Allow to apply cherry-picks when building Docker images.
Reviewers: mehdi_amini, ioeric, klimek
Reviewed By: ioeric
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D41393
llvm-svn: 321175
Ilya Biryukov [Wed, 20 Dec 2017 14:32:38 +0000 (14:32 +0000)]
[Frontend] Handle skipped bodies in template instantiations
Summary:
- Fixed an assert in Sema::InstantiateFunctionDefinition and added
support for instantiating a function template with skipped body.
- Properly call setHasSkippedBody for FunctionTemplateDecl passed to
Sema::ActOnSkippedFunctionBody.
Reviewers: sepavloff, bkramer
Reviewed By: sepavloff
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D41237
llvm-svn: 321174
Ilya Biryukov [Wed, 20 Dec 2017 14:06:05 +0000 (14:06 +0000)]
[clangd] Made UniqueFunction's bool conversion explicit
llvm-svn: 321173
Florian Hahn [Wed, 20 Dec 2017 13:28:38 +0000 (13:28 +0000)]
[LV] Remove unnecessary DoExtraAnalysis guard (silent bug)
canVectorize is only checking if the loop has a normalized pre-header if DoExtraAnalysis is true.
This doesn't make sense to me because reporting analysis information shouldn't alter legality
checks. This is probably the result of a last minute minor change before committing (?).
Patch by Diego Caballero.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D40973
llvm-svn: 321172
Simon Pilgrim [Wed, 20 Dec 2017 13:12:34 +0000 (13:12 +0000)]
[X86][AVX2] Split more shuffle tests into 'slow' and 'fast' variable shuffles
llvm-svn: 321171
Sander de Smalen [Wed, 20 Dec 2017 12:45:40 +0000 (12:45 +0000)]
Trivial commit to force LLVM to run TableGen for Mips target after
a change to the AsmMatcherEmitter, and should fix the buildbot
failure on llvm-clang-x86_64-expensive-checks-win.
The issue is also described here:
http://lists.llvm.org/pipermail/llvm-dev/2017-December/119617.html
llvm-svn: 321170
Gabor Horvath [Wed, 20 Dec 2017 12:30:27 +0000 (12:30 +0000)]
Fix an error in the release notes.
llvm-svn: 321169
Gabor Horvath [Wed, 20 Dec 2017 12:22:16 +0000 (12:22 +0000)]
[clang-tidy] Misc redundant expression checker updated for ineffective bitwise operator expressions
Examples:
* Always evaluates to 0:
```
int X;
if (0 & X) return;
```
* Always evaluates to ~0:
```
int Y;
if (Y | ~0) return;
```
* The symbol is unmodified:
```
int Z;
Z &= ~0;
```
Patch by: Lilla Barancsuk!
Differential Revision: https://reviews.llvm.org/D39285
llvm-svn: 321168
Pavel Labath [Wed, 20 Dec 2017 11:34:38 +0000 (11:34 +0000)]
Remove llvm::MemoryBuffer const_casts
Summary:
llvm has grown a WritableMemoryBuffer class, which is convertible
(inherits from) a MemoryBuffer. We can use it to avoid conts_casting the
buffer contents when we want to write to it.
Reviewers: dblaikie, rsmith
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D41387
llvm-svn: 321167
Florian Hahn [Wed, 20 Dec 2017 11:32:43 +0000 (11:32 +0000)]
[TargetParser] Check size before accessing architecture version.
Summary:
This fixes a crash when invalid -march options like `armv` are provided.
Based on a patch by Will Lovett.
Reviewers: rengolin, samparker, mcrosier
Reviewed By: samparker
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D41429
llvm-svn: 321166
Diana Picus [Wed, 20 Dec 2017 11:27:10 +0000 (11:27 +0000)]
[ARM GlobalISel] Fix assertion in RegBankSelect
We get an assertion in RegBankSelect for code along the lines of
my_32_bit_int = my_64_bit_int, which tends to translate into a 64-bit
load, followed by a G_TRUNC, followed by a 32-bit store. This appears in
a couple of places in the test-suite.
At the moment, the legalizer doesn't distinguish between integer and
floating point scalars, so a 64-bit load will be marked as legal for
targets with VFP, and so will the rest of the sequence, leading to a
slightly bizarre G_TRUNC reaching RegBankSelect.
Since the current support for 64-bit integers is rather immature, this
patch works around the issue by explicitly handling this case in
RegBankSelect and InstructionSelect. In the future, we may want to
revisit this decision and make sure 64-bit integer loads are narrowed
before reaching RegBankSelect.
llvm-svn: 321165
Florian Hahn [Wed, 20 Dec 2017 11:13:57 +0000 (11:13 +0000)]
[ARM] Lower unsigned saturation to USAT
Summary:
Implement lower of unsigned saturation on an interval [0, k] where k + 1 is a power of two using USAT instruction in a similar way to how [~k, k] is lowered using SSAT on ARM models that supports it.
Patch by Marten Svanfeldt
Reviewers: t.p.northover, pbarrio, eastig, SjoerdMeijer, javed.absar, fhahn
Reviewed By: fhahn
Subscribers: fhahn, aemerson, javed.absar, llvm-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D41348
llvm-svn: 321164
Sander de Smalen [Wed, 20 Dec 2017 11:02:42 +0000 (11:02 +0000)]
[AArch64][SVE] Re-submit patch series for ZIP1/ZIP2
This patch resubmits the SVE ZIP1/ZIP2 patch series consisting of
of r320992, r320986, r320973, and r320970 by reverting
https://reviews.llvm.org/rL321024.
The issue that caused r321024 has been addressed in https://reviews.llvm.org/rL321158,
so this patch-series should be safe to resubmit.
llvm-svn: 321163
Tim Northover [Wed, 20 Dec 2017 10:45:39 +0000 (10:45 +0000)]
AArch64: fix one more place movi.2d could be created.
Somehow got missed out of r320965.
llvm-svn: 321162
Sam McCall [Wed, 20 Dec 2017 10:26:53 +0000 (10:26 +0000)]
[clangd] Add debug printers for basic protocol types. NFC
llvm-svn: 321161
Bjorn Steinbrink [Wed, 20 Dec 2017 10:01:30 +0000 (10:01 +0000)]
Give up on array allocas in getPointerDereferenceableBytes
Summary:
As suggested by Eli Friedman, don't try to handle array allocas here,
because of possible overflows, instead rely on instcombine converting
them to allocations of array types.
Reviewers: efriedma
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D41398
llvm-svn: 321159
Sander de Smalen [Wed, 20 Dec 2017 09:45:45 +0000 (09:45 +0000)]
[AArch64] Asm: Fix parsing of register aliases that have a name starting with 'z'
Summary: This fixes an issue as identified by @rnk in https://reviews.llvm.org/rL321029.
Reviewers: rnk, fhahn, rengolin, efriedma, echristo, olista01
Reviewed By: rnk, fhahn
Subscribers: aemerson, javed.absar, kristof.beyls, llvm-commits, rnk
Differential Revision: https://reviews.llvm.org/D41382
llvm-svn: 321158
Eric Liu [Wed, 20 Dec 2017 09:29:54 +0000 (09:29 +0000)]
[clangd] Igore cases in index fuzzy find.
llvm-svn: 321157
Martin Bohme [Wed, 20 Dec 2017 09:17:31 +0000 (09:17 +0000)]
[clangd] Add "../" to Logger.h included from parent directory.
llvm-svn: 321156
Sam Parker [Wed, 20 Dec 2017 08:56:41 +0000 (08:56 +0000)]
[AArch64] CCSIDR2 system register
Implement the 'Current Cache Size' register that has been introduced
as part of the Armv8.3 architecture. I originally missed this, and
(hopefully) should be the final patch for assembler support.
Differential Revision: https://reviews.llvm.org/D41396
llvm-svn: 321155
Igor Kudrin [Wed, 20 Dec 2017 08:56:10 +0000 (08:56 +0000)]
[ELF] Fix an assignment command at the end of an .ARM.exidx section.
The value of the symbol in the assignment should include the sentinel entry.
Differential Revision: https://reviews.llvm.org/D41234
llvm-svn: 321154
Gadi Haber [Wed, 20 Dec 2017 08:28:24 +0000 (08:28 +0000)]
[X86][CLFLUSH]: Adding full coverage of MC encoding for the CLFLUSH isa sets.<NFC>
NFC.
Adding MC regressions tests to cover the CLFLSH and CLFLUSHOPT isa sets.
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
Reviewers: zvi, RKSimon, craig.topper, m_zuckerman
Differential Revision: https://reviews.llvm.org/D41331
Change-Id: Ifa643dd52f1b7184c52bc1806038dc74b234fc65
llvm-svn: 321153
Craig Topper [Wed, 20 Dec 2017 07:36:59 +0000 (07:36 +0000)]
[X86] Optimize sign extends on index operand to gather/scatter to not sign extend past i32.
The gather instruction will implicitly sign extend to the pointer width, we don't need to further extend it. This can prevent unnecessary splitting in some cases.
There's still an issue that lowering on non-VLX can introduce another sign extend that doesn't get combined with shifts from a lowered sign_extend_inreg.
llvm-svn: 321152
Martin Storsjo [Wed, 20 Dec 2017 06:52:52 +0000 (06:52 +0000)]
[builtins] Implement __chkstk for arm64 windows
Differential Revision: https://reviews.llvm.org/D41134
llvm-svn: 321151
Martin Storsjo [Wed, 20 Dec 2017 06:51:45 +0000 (06:51 +0000)]
[AArch64] Implement stack probing for windows
Differential Revision: https://reviews.llvm.org/D41131
llvm-svn: 321150
Martin Storsjo [Wed, 20 Dec 2017 06:50:45 +0000 (06:50 +0000)]
[COFF] Don't set the thumb bit in address table entries for data symbols
The thumb bit should only be set for executable code.
Differential Revision: https://reviews.llvm.org/D41379
llvm-svn: 321149
Craig Topper [Wed, 20 Dec 2017 06:44:50 +0000 (06:44 +0000)]
[X86] Add a missing return to combineGatherScatter after sucessful combine.
Not sure how to test this cause I think the worst that happens is that we don't revisit the node a second time to look for additional combines. We used UpdateNodeOperands so the updating the DAG work was already done.
llvm-svn: 321148
Hiroshi Inoue [Wed, 20 Dec 2017 05:18:19 +0000 (05:18 +0000)]
[PowerPC] fix a bug in redundant compare elimination
This patch fixes a bug in the redundant compare elimination reported in https://reviews.llvm.org/rL320786 and re-enables the optimization.
The redundant compare elimination assumes that we can replace signed comparison with unsigned comparison for the equality check. But due to the difference in the sign extension behavior we cannot change the opcode if the comparison is against an immediate and the most significant bit of the immediate is one.
Differential Revision: https://reviews.llvm.org/D41385
llvm-svn: 321147
Sam Clegg [Wed, 20 Dec 2017 05:14:48 +0000 (05:14 +0000)]
[WebAssembly] Improve toString(OutputSection). NFC.
llvm-svn: 321146
Alex Lorenz [Wed, 20 Dec 2017 02:31:30 +0000 (02:31 +0000)]
[darwin][driver] Warn about mismatching -<os>-version-min rather than
superfluous -<os>-version-min compiler option
rdar://
35813850
Differential Revision: https://reviews.llvm.org/D41425
llvm-svn: 321145