Sanjay Patel [Tue, 13 Nov 2018 22:47:24 +0000 (22:47 +0000)]
[InstCombine] canonicalize rotate patterns with cmp/select
The cmp+branch variant of this pattern is shown in:
https://bugs.llvm.org/show_bug.cgi?id=34924
...and as discussed there, we probably can't transform
that without a rotate intrinsic. We do have that now
via funnel shift, but we're not quite ready to
canonicalize IR to that form yet. The case with 'select'
should already be transformed though, so that's this patch.
The sequence with negation followed by masking is what we
use in the backend and partly in clang (though that part
should be updated).
https://rise4fun.com/Alive/TplC
%cmp = icmp eq i32 %shamt, 0
%sub = sub i32 32, %shamt
%shr = lshr i32 %x, %shamt
%shl = shl i32 %x, %sub
%or = or i32 %shr, %shl
%r = select i1 %cmp, i32 %x, i32 %or
=>
%neg = sub i32 0, %shamt
%masked = and i32 %shamt, 31
%maskedneg = and i32 %neg, 31
%shl2 = lshr i32 %x, %masked
%shr2 = shl i32 %x, %maskedneg
%r = or i32 %shl2, %shr2
llvm-svn: 346807
Matt Arsenault [Tue, 13 Nov 2018 22:30:35 +0000 (22:30 +0000)]
OpenCL: Don't warn on v printf modifier
This avoids spurious warnings, but could use
a lot of work. For example the number of vector
elements is not verified, and the passed
value type is not checked.
Fixes bug 39486
llvm-svn: 346806
Marshall Clow [Tue, 13 Nov 2018 22:26:03 +0000 (22:26 +0000)]
Mark #2184 as complete; the tests are fine. (I thought that they were wrong before)
llvm-svn: 346805
George Karpenkov [Tue, 13 Nov 2018 22:17:16 +0000 (22:17 +0000)]
[lsan] [FIXUP] Fixup for reviews.llvm.org/D54484
After the change, the tests started failing, as skipped sections can be
equal in size to kMaxSegName.
Changing `<` to `<=` to address the off-by-one problem.
llvm-svn: 346804
Jessica Paquette [Tue, 13 Nov 2018 22:16:27 +0000 (22:16 +0000)]
[MachineOutliner][NFC] Exit getOutliningType if there are < 2 candidates
Since we never outline anything with fewer than 2 occurrences, there's no
reason to compute cost model information if there's less than that.
llvm-svn: 346803
David Greene [Tue, 13 Nov 2018 21:38:45 +0000 (21:38 +0000)]
[Driver] Support g++ headers in include/g++
ray's gcc installation puts C++ headers in PREFIX/include/g++ without
indicating a gcc version at all. Typically this is because the version
is encoded somewhere in PREFIX.
Differential Revision: https://reviews.llvm.org/D53770
llvm-svn: 346802
Bruno Ricci [Tue, 13 Nov 2018 21:33:22 +0000 (21:33 +0000)]
[AST] Revert r346793 and r346781
This somehow breaks the msan bots. Revert while I figure it out.
llvm-svn: 346801
Stanislav Mekhanoshin [Tue, 13 Nov 2018 21:18:21 +0000 (21:18 +0000)]
[AMDGPU] combine extractelement into several selects
An extractelement with non-constant index will be lowered either to
scratch or movrel loop in most cases. This patch converts such
instruction into a set of selects if vector size is not too big.
Differential Revision: https://reviews.llvm.org/D54351
llvm-svn: 346800
Louis Dionne [Tue, 13 Nov 2018 21:13:10 +0000 (21:13 +0000)]
[NFC] Mark LWG3128 and LWG3132 as requiring no work
Those LWG issues were adopted in San Diego and require no work
on our side.
llvm-svn: 346799
Alina Sbirlea [Tue, 13 Nov 2018 21:12:49 +0000 (21:12 +0000)]
[MemorySSA] Create query after checking if instruction is a fence.
The alternative is checking if I is a fence in the Query constructor, so
as to not attempt to get a non-existent MemoryLocation.
llvm-svn: 346798
Fangrui Song [Tue, 13 Nov 2018 20:59:25 +0000 (20:59 +0000)]
[AsmPrinter] Fix DebugInfo/X86/gnu-public-names.ll after rL346790
llvm-svn: 346797
Fangrui Song [Tue, 13 Nov 2018 20:49:36 +0000 (20:49 +0000)]
[ELF] Add a better test for the multi-CU .gdb_index bug that D54361 fixed
gdb-index-multiple-cu-2.s puts the symbol in question to another object file %t1.o, so that its CuIndex is affected by the number of CUs in %t.o
Also change `Kind:` in a comment to `Attributes:` as a follow-up of D54480 and D54481
llvm-svn: 346796
Stanislav Mekhanoshin [Tue, 13 Nov 2018 20:26:27 +0000 (20:26 +0000)]
Fixed DAGTypeLegalizer::SplitVecOp_EXTRACT_VECTOR_ELT i1 handling
Legalizer used to request an ext load from i8 to i1 when promoting
vector element type to i8. Fixed.
Differential Revision: https://reviews.llvm.org/D54440
llvm-svn: 346795
Fangrui Song [Tue, 13 Nov 2018 20:25:51 +0000 (20:25 +0000)]
[ELF] Rename NameTypeEntry to NameAttrEntry and its field "Type" to CuIndexAndAttrs
Summary:
NameTypeEntry::Type is a bit-packed value of CU index+attributes (https://sourceware.org/gdb//onlinedocs/gdb/Index-Section-Format.html), which is named cu_index_and_attrs in a local variable in gdb/dwarf2read.c:dw2_symtab_iter_next
The new name CuIndexAndAttrs is more meaningful.
Reviewers: ruiu, dblaikie, espindola
Reviewed By: dblaikie
Subscribers: emaste, aprantl, arichardson, JDevlieghere, arphaman, llvm-commits
Differential Revision: https://reviews.llvm.org/D54481
llvm-svn: 346794
Bruno Ricci [Tue, 13 Nov 2018 20:23:11 +0000 (20:23 +0000)]
[AST][NFC] Order the bit-field classes of Stmt like in StmtNodes.td
Reorder the bit-field classes and the members of the anonymous union
so that they both match the order in StmtNodes.td.
There is already a fair amount of them, and this is not going to
improve. Therefore lets try to keep some order here.
Strictly NFC.
llvm-svn: 346793
George Karpenkov [Tue, 13 Nov 2018 20:19:38 +0000 (20:19 +0000)]
[lsan] [NFC] Change ARRAY_SIZE to internal_strnlen
Calling ARRAY_SIZE on a char* will not actually compute it's size, but just the pointer size.
A new Clang warning enabled by default warns about this.
Replaced the call with internal_strnlen.
Differential Revision: https://reviews.llvm.org/D54484
llvm-svn: 346792
Nico Weber [Tue, 13 Nov 2018 20:18:26 +0000 (20:18 +0000)]
[MS Demangler] Print public:, protected:, private: if set in FunctionClass or a variable's StorageClass.
undname prints them, and the information is in the decorated name, so we probably shouldn't lose it when undecorating.
I spot-checked a few of the funnier-looking outputs, and undname has the same output.
Differential Revision: https://reviews.llvm.org/D54396
llvm-svn: 346791
Fangrui Song [Tue, 13 Nov 2018 20:18:08 +0000 (20:18 +0000)]
[AsmPrinter] Rename a comment of .debug_gnu_pubnames entry
Summary:
The comment refers to the field as "Kind:". However, in gdb,
https://sourceware.org/gdb//onlinedocs/gdb/Index-Section-Format.html names it "attributes",
gdb/dwarf2read.c:dw2_symtab_iter_next refers to the whole value as "cu_index_and_attrs"
Change it to `Attributes:` for consistency.
Reviewers: dblaikie
Reviewed By: dblaikie
Subscribers: aprantl, JDevlieghere, arphaman, llvm-commits
Differential Revision: https://reviews.llvm.org/D54480
llvm-svn: 346790
David Blaikie [Tue, 13 Nov 2018 20:08:13 +0000 (20:08 +0000)]
DebugInfo: Add a driver flag for DWARF debug_ranges base address specifier use.
Summary:
This saves a lot of relocations in optimized object files (at the cost
of some cost/increase in linked executable bytes), but gold's 32 bit
gdb-index support has a bug (
https://sourceware.org/bugzilla/show_bug.cgi?id=21894 ) so we can't
switch to this unconditionally. (& even if it weren't for that bug, one
might argue that some users would want to optimize in one direction or
the other - prioritizing object size or linked executable size)
Differential Revision: https://reviews.llvm.org/D54243
llvm-svn: 346789
David Blaikie [Tue, 13 Nov 2018 20:08:10 +0000 (20:08 +0000)]
DebugInfo: Add a CU metadata attribute for use of DWARF ranges base address specifiers
Summary:
Ranges base address specifiers can save a lot of object size in
relocation records especially in optimized builds.
For an optimized self-host build of Clang with split DWARF and debug
info compression in object files, but uncompressed debug info in the
executable, this change produces about 18% smaller object files and 6%
larger executable.
While it would've been nice to turn this on by default, gold's 32 bit
gdb-index support crashes on this input & I don't think there's any
perfect heuristic to implement solely in LLVM that would suffice - so
we'll need a flag one way or another (also possible people might want to
aggressively optimized for executable size that contains debug info
(even with compression this would still come at some cost to executable
size)) - so let's plumb it through.
Differential Revision: https://reviews.llvm.org/D54242
llvm-svn: 346788
Zachary Turner [Tue, 13 Nov 2018 20:07:57 +0000 (20:07 +0000)]
[NativePDB] Add support for S_CONSTANT records.
clang-cl does not emit these, but MSVC does, so we need to be able to
handle them.
Because clang-cl does not generate them, it was a bit hard to write a
test. So what I had to do was get an PDB file with some S_CONSTANT
records in using cl and link, dump it using llvm-pdbutil dump -globals
-sym-data to get the bytes of the records, generate the same object file
using clang-cl but with -S to emit an assembly file, and replace all the
S_LDATA32 records with the bytes of the S_CONSTANT records. This way, we
can compile the file using llvm-mc and link it with lld-link.
Differential Revision: https://reviews.llvm.org/D54452
llvm-svn: 346787
Zachary Turner [Tue, 13 Nov 2018 20:07:32 +0000 (20:07 +0000)]
[NativePDB] Improved support for nested type reconstruction.
In a previous patch, we pre-processed the TPI stream in order to build
the reverse mapping from nested type -> parent type so that we could
accurately reconstruct a DeclContext hierarchy.
However, there were some issues. An LF_NESTTYPE record is really just a
typedef, so although it happens to be used to indicate the name of the
nested type and referring to the global record which defines the type,
it is also used for every other kind of nested typedef. When we rebuild
the DeclContext hierarchy, we want it to be as accurate as possible,
which means that if we have something like:
struct A {
struct B {};
using C = B;
};
We don't want to create two CXXRecordDecls in the AST each with the
exact same definition. We just want to create one for B and then
define C as an alias to B. Previously, however, it would not be able
to distinguish between the two cases and it would treat A::B and
A::C as being two classes each with separate definitions. We address
the first half of improving the pre-processing logic so that only
actual definitions are treated this way.
Later, in a followup patch, we can handle the case of nested
typedefs since we're already going to be enumerating the field list
anyway and this patch introduces the general framework for
distinguishing between the two cases.
Differential Revision: https://reviews.llvm.org/D54357
llvm-svn: 346786
Matt Arsenault [Tue, 13 Nov 2018 19:50:38 +0000 (19:50 +0000)]
Add fneg instruction to syntax highlighting lists
llvm-svn: 346785
Craig Topper [Tue, 13 Nov 2018 19:45:21 +0000 (19:45 +0000)]
[SelectionDAG][X86] Relax restriction on the width of an input to *_EXTEND_VECTOR_INREG. Use them and regular *_EXTEND to replace the X86 specific VSEXT/VZEXT opcodes
Previously, the extend_vector_inreg opcode required their input register to be the same total width as their output. But this doesn't match up with how the X86 instructions are defined. For X86 the input just needs to be a legal type with at least enough elements to cover the output.
This patch weakens the check on these nodes and allows them to be used as long as they have more input elements than output elements. I haven't changed type legalization behavior so it will still create them with matching input and output sizes.
X86 will custom legalize these nodes by shrinking the input to be a 128 bit vector and once we've done that we treat them as legal operations. We still have one case during type legalization where we must custom handle v64i8 on avx512f targets without avx512bw where v64i8 isn't a legal type. In this case we will custom type legalize to a *extend_vector_inreg with a v16i8 input. After that the input is a legal type so type legalization should ignore the node and doesn't need to know about the relaxed restriction. We are no longer allowed to use the default expansion for these nodes during vector op legalization since the default expansion uses a shuffle which required the widths to match. Custom legalization for all types will prevent us from reaching the default expansion code.
I believe DAG combine works correctly with the released restriction because it doesn't check the number of input elements.
The rest of the patch is changing X86 to use either the vector_inreg nodes or the regular zero_extend/sign_extend nodes. I had to add additional isel patterns to handle any_extend during isel since simplifydemandedbits can create them at any time so we can't legalize to zero_extend before isel. We don't yet create any_extend_vector_inreg in simplifydemandedbits.
Differential Revision: https://reviews.llvm.org/D54346
llvm-svn: 346784
Davide Italiano [Tue, 13 Nov 2018 19:43:43 +0000 (19:43 +0000)]
[Cocoa] Implement formatter for the new NSDate representation.
<rdar://problem/
46002786>
llvm-svn: 346783
Jordan Rupprecht [Tue, 13 Nov 2018 19:32:27 +0000 (19:32 +0000)]
[llvm-objcopy] Rename --keep to --keep-section.
Summary:
llvm-objcopy/strip support `--keep` (for sections) and `--keep-symbols` (for symbols). For consistency and clarity, rename `--keep` to `--keep-section`.
In fact, for GNU compatability, -K is --keep-symbol, so it's weird that the alias `-K` is not the same as the short-ish `--keep`.
Reviewers: jakehehrlich, jhenderson, alexshap, MaskRay, espindola
Reviewed By: jakehehrlich, MaskRay
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D54477
llvm-svn: 346782
Bruno Ricci [Tue, 13 Nov 2018 19:27:39 +0000 (19:27 +0000)]
[AST][NFC] Style fixes for UnaryOperator
In preparation for the patch which will move some data to the bit-fields
of Stmt. In particular, rename the private variable "Val" -> "Operand"
since the substatement is the operand of the unary operator.
Run clang-format on UnaryOperator. NFC otherwise.
llvm-svn: 346781
Jonas Devlieghere [Tue, 13 Nov 2018 19:18:16 +0000 (19:18 +0000)]
Add GDB remote packet reproducer.
llvm-svn: 346780
Eric Fiselier [Tue, 13 Nov 2018 19:16:19 +0000 (19:16 +0000)]
Fix UB in string.bench.cpp.
The usage of aligned_storage failed to pass the alignment it wanted,
which caused it to have a larger size and alignment that the
std::string's it was intended to store.
This patch manually specifies the alignment, as well as cleaning up
type alias bugs.
llvm-svn: 346779
Sam Clegg [Tue, 13 Nov 2018 19:14:02 +0000 (19:14 +0000)]
[WebAssembly] Fix broken assumption that all bitcasts are to functions types
Specifically, we can bitcast to void.
Fixes PR39591
Differential Revision: https://reviews.llvm.org/D54447
llvm-svn: 346778
Reid Kleckner [Tue, 13 Nov 2018 18:30:31 +0000 (18:30 +0000)]
[COFF] Simplify relocation to discarded section diagnostic code, NFC
Move it out of the loop that applies relocations for readability.
llvm-svn: 346777
Jonas Devlieghere [Tue, 13 Nov 2018 18:23:32 +0000 (18:23 +0000)]
[FileSystem] Add expand_tilde function
In D54435 there was some discussion about the expand_tilde flag for
real_path that I wanted to expose through the VFS. The consensus is that
these two things should be separate functions. Since we already have the
code for this I went ahead and added a function expand_tilde that does
just that.
Differential revision: https://reviews.llvm.org/D54448
llvm-svn: 346776
Jim Ingham [Tue, 13 Nov 2018 18:18:32 +0000 (18:18 +0000)]
Since ABI's now hold a process WP, they should be handed
out one per process rather than keeping a single global instance.
Differential Revision: https://reviews.llvm.org/D54460
llvm-svn: 346775
Cameron McInally [Tue, 13 Nov 2018 18:15:47 +0000 (18:15 +0000)]
[IR] Add a dedicated FNeg IR Instruction
The IEEE-754 Standard makes it clear that fneg(x) and
fsub(-0.0, x) are two different operations. The former is a bitwise
operation, while the latter is an arithmetic operation. This patch
creates a dedicated FNeg IR Instruction to model that behavior.
Differential Revision: https://reviews.llvm.org/D53877
llvm-svn: 346774
Simon Atanasyan [Tue, 13 Nov 2018 18:14:29 +0000 (18:14 +0000)]
[WebAssembly] Mark immediates.ll as XFAILed on MIPS hosts
Usually MIPS hosts uses a legacy (non IEEE 754-2008) encoding for NaNs.
Tests like `nan_f32` failed in attempt to compare hard-coded IEEE
754-2008 NaN value and a legacy NaN value provided by a system.
llvm-svn: 346773
Marshall Clow [Tue, 13 Nov 2018 18:07:51 +0000 (18:07 +0000)]
Remove duplicate entry for issue 3134
llvm-svn: 346772
Marshall Clow [Tue, 13 Nov 2018 18:05:10 +0000 (18:05 +0000)]
Update status for issue 3122
llvm-svn: 346771
Bruno Ricci [Tue, 13 Nov 2018 17:56:44 +0000 (17:56 +0000)]
[AST][NFC] Pack DeclRefExpr
Move the SourceLocation to the bit-fields of Stmt + clang-format.
This saves one pointer per DeclRefExpr but otherwise NFC.
llvm-svn: 346770
Florian Hahn [Tue, 13 Nov 2018 17:54:43 +0000 (17:54 +0000)]
[CSP, Cloning] Update DuplicateInstructionsInSplitBetween to use DomTreeUpdater.
This patch updates DuplicateInstructionsInSplitBetween to update a DTU
instead of applying updates to the DT directly.
Given that there only are 2 users, also updated them in this patch to
avoid churn.
I slightly moved the code in CallSiteSplitting around to reduce the
places where we have to pass in DTU. If necessary, I could split those
changes in a separate patch.
This fixes missing DT updates when dealing with musttail calls in
CallSiteSplitting, by using DTU->deleteBB.
Reviewers: junbuml, kuhar, NutshellySima, indutny, brzycki
Reviewed By: NutshellySima
llvm-svn: 346769
Steven Wu [Tue, 13 Nov 2018 17:35:04 +0000 (17:35 +0000)]
Revert "[ThinLTO] Internalize readonly globals"
This reverts commit
10c84a8f35cae4a9fc421648d9608fccda3925f2.
llvm-svn: 346768
Louis Dionne [Tue, 13 Nov 2018 17:33:11 +0000 (17:33 +0000)]
[NFC][libcxx] Mark P1006R1 as complete
llvm-svn: 346767
Marshall Clow [Tue, 13 Nov 2018 17:22:41 +0000 (17:22 +0000)]
Implement P0972R0: <chrono> zero(), min(), and max() should be noexcept. Reviewed as https://reviews.llvm.org/D53828
llvm-svn: 346766
Louis Dionne [Tue, 13 Nov 2018 17:09:25 +0000 (17:09 +0000)]
[NFC][libcxx] Mark P1006 as implemented in LLVM 8.0
It was implemented in https://reviews.llvm.org/D53867
llvm-svn: 346765
Louis Dionne [Tue, 13 Nov 2018 17:04:05 +0000 (17:04 +0000)]
[libcxx] Implement wg21.link/p1006, constexpr in pointer_traits
Summary:
P1006 adds support for constexpr in the specialization of pointer_traits
for raw pointers. This is necessary in order to use pointer_traits in
the upcoming constexpr containers. We expect P1006 to be voted into the
working draft for C++20 at the San Diego meeting.
Reviewers: mclow.lists, EricWF
Subscribers: christof, dexonsmith, libcxx-commits
Differential Revision: https://reviews.llvm.org/D53867
llvm-svn: 346764
Louis Dionne [Tue, 13 Nov 2018 17:00:04 +0000 (17:00 +0000)]
[libcxx] GNU/Hurd uses BSD-based interfaces, but does not (and won't) provide <sys/sysctl.h>
Reviewed as https://reviews.llvm.org/D54338.
Thanks to sthibaul for the patch.
llvm-svn: 346763
Sanjay Patel [Tue, 13 Nov 2018 16:47:16 +0000 (16:47 +0000)]
[InstCombine] add tests for funnel shift demanded bits; NFC
llvm-svn: 346762
Alexander Kornienko [Tue, 13 Nov 2018 16:41:05 +0000 (16:41 +0000)]
Fix uninitialized variable.
Flags variable was not initialized and later used (both isMBBSafeToOutlineFrom
implementations assume it's initialized), which breaks
test/CodeGen/AArch64/machine-outliner.mir. under memory sanitizer:
MemorySanitizer: use-of-uninitialized-value
#0 in llvm::AArch64InstrInfo::getOutliningType(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&, unsigned int) const llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:5494:9
#1 in (anonymous namespace)::InstructionMapper::convertToUnsignedVec(llvm::MachineBasicBlock&, llvm::TargetInstrInfo const&) llvm/lib/CodeGen/MachineOutliner.cpp:772:19
#2 in (anonymous namespace)::MachineOutliner::populateMapper((anonymous namespace)::InstructionMapper&, llvm::Module&, llvm::MachineModuleInfo&) llvm/lib/CodeGen/MachineOutliner.cpp:1543:14
#3 in (anonymous namespace)::MachineOutliner::runOnModule(llvm::Module&) llvm/lib/CodeGen/MachineOutliner.cpp:1645:3
#4 in (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) llvm/lib/IR/LegacyPassManager.cpp:1744:27
#5 in llvm::legacy::PassManagerImpl::run(llvm::Module&) llvm/lib/IR/LegacyPassManager.cpp:1857:44
#6 in compileModule(char**, llvm::LLVMContext&) llvm/tools/llc/llc.cpp:597:8
llvm-svn: 346761
Simon Pilgrim [Tue, 13 Nov 2018 16:40:10 +0000 (16:40 +0000)]
[CostModel][X86] Fix constant vector XOP rights shifts
We'll constant fold these cases so they are as cheap as vector left shift cases.
Noticed while improving funnel shift costs.
llvm-svn: 346760
Florian Hahn [Tue, 13 Nov 2018 16:26:34 +0000 (16:26 +0000)]
[VectorUtils] Use namespace for InterleaveGroup template specialization.
llvm-svn: 346759
Florian Hahn [Tue, 13 Nov 2018 15:58:18 +0000 (15:58 +0000)]
[VPlan] VPlan version of InterleavedAccessInfo.
This patch turns InterleaveGroup into a template with the instruction type
being a template parameter. It also adds a VPInterleavedAccessInfo class, which
only contains a mapping from VPInstructions to their respective InterleaveGroup.
As we do not have access to scalar evolution in VPlan, we can re-use
convert InterleavedAccessInfo to VPInterleavedAccess info.
Reviewers: Ayal, mssimpso, hfinkel, dcaballe, rengolin, mkuper, hsaito
Reviewed By: rengolin
Differential Revision: https://reviews.llvm.org/D49489
llvm-svn: 346758
Erich Keane [Tue, 13 Nov 2018 15:48:08 +0000 (15:48 +0000)]
[NFC] Move storage of dispatch-version to GlobalDecl
As suggested by Richard Smith, and initially put up for review here:
https://reviews.llvm.org/D53341, this patch removes a hack that was used
to ensure that proper target-feature lists were used when emitting
cpu-dispatch (and eventually, target-clones) implementations. As a part
of this, the GlobalDecl object is proliferated to a bunch more
locations.
Originally, this was put up for review (see above) to get acceptance on
the approach, though discussion with Richard in San Diego showed he
approved of the approach taken here. Thus, I believe this is acceptable
for Review-After-commit
Differential Revision: https://reviews.llvm.org/D53341
Change-Id: I0a0bd673340d334d93feac789d653e03d9f6b1d5
llvm-svn: 346757
Krasimir Georgiev [Tue, 13 Nov 2018 15:38:12 +0000 (15:38 +0000)]
[clang-format] Do not treat the asm clobber [ as ObjCExpr
Summary:
The opening square of an inline asm clobber was being annotated as an ObjCExpr.
This caused, amongst other things, the ObjCGuesser to guess header files
containing that pattern as ObjC files.
Reviewers: benhamilton
Reviewed By: benhamilton
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D54111
llvm-svn: 346756
Simon Pilgrim [Tue, 13 Nov 2018 13:45:10 +0000 (13:45 +0000)]
[TTI] Make TargetTransformInfo::getOperandInfo static. NFCI.
It has no member dependencies and this makes it easier to reuse in other cost analysis code.
llvm-svn: 346755
Simon Pilgrim [Tue, 13 Nov 2018 12:11:15 +0000 (12:11 +0000)]
[CostModel][X86] Add more cost tests for funnel shifts
Added full uniform/constant coverage for funnel shifts + rotates
llvm-svn: 346754
Simon Pilgrim [Tue, 13 Nov 2018 12:09:27 +0000 (12:09 +0000)]
Fix comment for XOP rotates. NFCI.
llvm-svn: 346753
Simon Pilgrim [Tue, 13 Nov 2018 11:28:46 +0000 (11:28 +0000)]
Add bracket that was lost in rL346727 and has been causing buildbot failures for some time.
llvm-svn: 346752
Alexander Richardson [Tue, 13 Nov 2018 10:54:49 +0000 (10:54 +0000)]
Fix .cfi_restore with register numbers > 64
Summary:
DW_CFA_restore can only encode register numbers up to 64 (6 bits unsigned
int). For regsiter numbers > 64 we have to use DW_CFA_restore_extended
instead which uses a ULEB128 value.
I discovered this problem in the out-of-tree CHERI target since we use
DWARF register number 89 for our return capability register.
Reviewers: probinson, dblaikie, aprantl, espindola
Reviewed By: dblaikie
Subscribers: JohnReagan, emaste, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D54420
llvm-svn: 346751
Alexander Richardson [Tue, 13 Nov 2018 10:54:44 +0000 (10:54 +0000)]
Fix modules build of AVRAsmParser.cpp
Summary:
Without this change I get the following error:
lib/Target/AVR/AVRGenAsmMatcher.inc:1135:1: error: redundant #include of module 'LLVM_Utils.Support.Format' appears within namespace 'llvm' [-Wmodules-import-nested-redundant]
Reviewers: dylanmckay
Reviewed By: dylanmckay
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53425
llvm-svn: 346750
George Rimar [Tue, 13 Nov 2018 10:16:36 +0000 (10:16 +0000)]
[ELF] - Renamed AArch64 specific relocations expressions. NFC.
They did not have AArch64 prefix. Now they do.
llvm-svn: 346749
Hans Wennborg [Tue, 13 Nov 2018 09:05:12 +0000 (09:05 +0000)]
UserManual: Tweak the /Zc:dllexportInlines- docs some
Addressing comments on https://reviews.llvm.org/D54319
llvm-svn: 346748
Fangrui Song [Tue, 13 Nov 2018 08:43:07 +0000 (08:43 +0000)]
[ELF] .gdb_index: fix CuOff when a .debug_info section contains more than 1 DW_TAG_compile_unit
Summary:
Idx passed to readPubNamesAndTypes was an index into Chunks, not an
index into the CU list. This would be incorrect if some .debug_info
section contained more than 1 DW_TAG_compile_unit.
In real world, glibc Scrt1.o is a partial link of start.os abi-note.o init.o and contains 2 CUs in debug builds.
Without this patch, any application linking such Scrt1.o would have invalid .gdb_index
The issue could be demonstrated by:
(gdb) py print(gdb.lookup_global_symbol('main'))
None
Reviewers: espindola, ruiu
Reviewed By: ruiu
Subscribers: Higuoxing, grimar, dblaikie, emaste, aprantl, arichardson, JDevlieghere, arphaman, llvm-commits
Differential Revision: https://reviews.llvm.org/D54361
llvm-svn: 346747
Jonas Paulsson [Tue, 13 Nov 2018 08:37:09 +0000 (08:37 +0000)]
[SystemZ] Increase the number of VLREPs
If a loaded value is replicated it is best to combine these two operations
into a VLREP (load and replicate), but isel will not produce this if the load
has other users as well.
This patch handles this by putting the other users of the load to use the
REPLICATE 0-element instead of the load. This way the load has only the
REPLICATE node as user, and we get a VLREP.
Review: Ulrich Weigand
https://reviews.llvm.org/D54264
llvm-svn: 346746
Craig Topper [Tue, 13 Nov 2018 07:47:52 +0000 (07:47 +0000)]
[X86] Add more tests for -x86-experimental-vector-widening-legalization
I'm looking into whether we can make this the default legalization strategy. Adding these tests to help cover the changes that will be necessary.
This patch adds copies of some tests with the command line switch enabled. By making copies its easier to compare the two legalization strategies.
I've also removed RUN lines from some of these tests that already had -x86-experimental-vector-widening-legalization
llvm-svn: 346745
Eric Fiselier [Tue, 13 Nov 2018 07:03:16 +0000 (07:03 +0000)]
Attempt to make benchmarks fall back to -std=c++1z when C++17 isn't supported.
The benchmarks currently require C++17, however Clang 3.9 doesn't
support -std=c++17 while still supporting all the C++17 features needed
to compile the benchmarks.
This patch makes the benchmark build attempt to fall back to -std=c++1z
when -std=c++17 isn't supported.
See llvm.org/PR39629
llvm-svn: 346744
Eric Fiselier [Tue, 13 Nov 2018 06:30:36 +0000 (06:30 +0000)]
Add emplace tests for multiset/unordered_multiset.
This patch adds tests to ensure that multiset/unordered_multiset's emplace
method correctly constructs the elements without any intervening
constructions.
llvm-svn: 346743
Fedor Sergeev [Tue, 13 Nov 2018 05:47:01 +0000 (05:47 +0000)]
[FileCheck] fixing docs buildbot - use proper code-block type
llvm-svn: 346740
Marshall Clow [Tue, 13 Nov 2018 05:33:31 +0000 (05:33 +0000)]
Fix PR39619 - iterator_traits isn't SFINAE-friendly enough. Thanks to Eric for the report
llvm-svn: 346738
Takuto Ikuta [Tue, 13 Nov 2018 04:14:09 +0000 (04:14 +0000)]
[clang-cl] Do not allow using both /Zc:dllexportInlines- and /fallback flag
Summary: /Zc:dllexportInlines with /fallback may cause unexpected linker error. It is better to disallow compile rather than warn for this combination.
Reviewers: hans, thakis
Reviewed By: hans
Subscribers: cfe-commits, llvm-commits
Differential Revision: https://reviews.llvm.org/D54426
llvm-svn: 346733
Tom Stellard [Tue, 13 Nov 2018 03:42:46 +0000 (03:42 +0000)]
CMake: Deprecate using llvm-config to detect llvm installation
Summary:
clang currently uses llvm-config to determine the installation paths
for llvm's headers and binaries. clang is also using LLVM's cmake
files to determine other information about the LLVM build, like
LLVM_LIBDIR_SUFFIX, LLVM_VERSION_*, etc. Since the installation
paths are also available via the cmake files, we can simplify the code
by only relying on information from cmake about the LLVM install and
dropping the use of llvm-config altogether.
In addition to simplifying the code, the cmake files have more
accurate information about the llvm installation paths. llvm-config
assumes that the lib, bin, and cmake directories are always located
in the same place relative to the path of the llvm-config executable.
This can be wrong if a user decides to install headers, binaries
or libraries to a non-standard location: e.g. static libraries
installed to /usr/lib/llvm6.0/
This patch takes the first step towards dropping llvm-config by
removing the automatic detection of llvm-config (users can still
manually supply a path to llvm-config by passing
-DLLVM_CONFIG=/usr/bin/llvm-config to cmake) and adding a
deprecation warning when users try to use this option.
Reviewers: chandlerc, beanz, mgorny, chapuni
Subscribers: mehdi_amini, dexonsmith, cfe-commits
Differential Revision: https://reviews.llvm.org/D51714
llvm-svn: 346732
Tom Stellard [Tue, 13 Nov 2018 03:16:45 +0000 (03:16 +0000)]
CMake: Replace open-coded find_package
Reviewers: beanz, mgorny
Reviewed By: mgorny
Subscribers: cfe-commits, chapuni, llvm-commits
Differential Revision: https://reviews.llvm.org/D32577
llvm-svn: 346731
George Karpenkov [Tue, 13 Nov 2018 02:59:27 +0000 (02:59 +0000)]
[BuildingAJIT] Fixing the build by inserting a forgotten paren.
llvm-svn: 346730
Xing GUO [Tue, 13 Nov 2018 02:14:38 +0000 (02:14 +0000)]
[commit test] Add blank line to test/tools/llvm-objdump/full-contents.test
llvm-svn: 346729
Craig Topper [Tue, 13 Nov 2018 01:59:32 +0000 (01:59 +0000)]
[DAGCombiner] Enable tryToFoldExtendOfConstant to run after legalize vector ops
It should be ok to create a new build_vector after legal operations so long as it doesn't cause an infinite loop in DAG combiner.
Unfortunately, X86's custom constant folding in combineVSZext is hiding any test changes from this. But I'm trying to get to a point where that X86 specific code isn't necessary at all.
Differential Revision: https://reviews.llvm.org/D54285
llvm-svn: 346728
Lang Hames [Tue, 13 Nov 2018 01:26:25 +0000 (01:26 +0000)]
[BuildingAJIT] Clang-format chapters 1 and 2.
llvm-svn: 346727
Lang Hames [Tue, 13 Nov 2018 01:25:34 +0000 (01:25 +0000)]
[BuildingAJIT] Update chapter 2 to use the ORCv2 APIs.
llvm-svn: 346726
Fedor Sergeev [Tue, 13 Nov 2018 01:12:19 +0000 (01:12 +0000)]
[FileCheck] fixing small formatting error in docs
llvm-svn: 346725
Jake Ehrlich [Tue, 13 Nov 2018 01:10:35 +0000 (01:10 +0000)]
[libObject] Fix getDesc for Elf_Note_Impl
This change fixes a bug in Elf_Note_Impl in which Elf_Word was used
where uint8_t should have been used.
llvm-svn: 346724
Fedor Sergeev [Tue, 13 Nov 2018 01:09:53 +0000 (01:09 +0000)]
[FileCheck] fixing typo in assert
llvm-svn: 346723
Fedor Sergeev [Tue, 13 Nov 2018 00:46:13 +0000 (00:46 +0000)]
[FileCheck] introduce CHECK-COUNT-<num> repetition directive
In some cases it is desirable to match the same pattern repeatedly
many times. Currently the only way to do it is to copy the same
check pattern as many times as needed. And that gets pretty unwieldy
when its more than count is big.
Introducing CHECK-COUNT-<num> directive which acts like a plain CHECK
directive yet matches the same pattern exactly <num> times.
Extended FileCheckType to a struct to add Count there.
Changed some parsing routines to handle non-fixed length of directive
(all currently existing directives were fixed-length).
The code is generic enough to allow future support for COUNT in more
than just PlainCheck directives.
See motivating example for this feature in reviews.llvm.org/D54223.
Reviewed By: chandlerc, dblaikie
Differential Revision: https://reviews.llvm.org/D54336
llvm-svn: 346722
Jessica Paquette [Tue, 13 Nov 2018 00:32:09 +0000 (00:32 +0000)]
[MachineOutliner][NFC] Simplify isMBBSafeToOutlineFrom check in AArch64 outliner
Turns out it's way simpler to do this check with one LRU. Instead of
maintaining two, just keep one. Check if each of the registers is available,
and then check if it's a live out from the block. If it's a live out, but
available in the block, we know we're in an unsafe case.
llvm-svn: 346721
Zhizhou Yang [Tue, 13 Nov 2018 00:31:22 +0000 (00:31 +0000)]
Introduce DebugCounter into ConstProp pass
Summary:
This patch introduces DebugCounter into ConstProp pass at per-transformation level.
It will provide an option to skip first n or stop after n transformations for the whole ConstProp pass.
This will make debug easier for the pass, also providing chance to do transformation level bisecting.
Reviewers: davide, fhahn
Reviewed By: fhahn
Subscribers: llozano, george.burgess.iv, llvm-commits
Differential Revision: https://reviews.llvm.org/D50094
llvm-svn: 346720
Sanjay Patel [Mon, 12 Nov 2018 23:58:59 +0000 (23:58 +0000)]
[InstCombine] add rotate variants that include select; NFC
llvm-svn: 346719
Jessica Paquette [Mon, 12 Nov 2018 23:51:32 +0000 (23:51 +0000)]
[MachineOutliner][NFC] Change getMachineOutlinerMBBFlags to isMBBSafeToOutlineFrom
Instead of returning Flags, return true if the MBB is safe to outline from.
This lets us check for unsafe situations, like say, in AArch64, X17 is live
across a MBB without being defined in that MBB. In that case, there's no point
in performing an instruction mapping.
llvm-svn: 346718
Fangrui Song [Mon, 12 Nov 2018 23:46:22 +0000 (23:46 +0000)]
[llvm-objcopy] Don't copy Config when processing --keep
llvm-svn: 346717
Sanjay Patel [Mon, 12 Nov 2018 22:52:25 +0000 (22:52 +0000)]
[InstCombine] narrow width of rotate patterns, part 3
This is a longer variant for the pattern handled in
rL346713
This one includes zexts.
Eventually, we should canonicalize all rotate patterns
to the funnel shift intrinsics, but we need a bit more
infrastructure to make sure the vectorizers handle those
intrinsics as well as the shift+logic ops.
https://rise4fun.com/Alive/FMn
Name: narrow rotateright
%neg = sub i8 0, %shamt
%rshamt = and i8 %shamt, 7
%rshamtconv = zext i8 %rshamt to i32
%lshamt = and i8 %neg, 7
%lshamtconv = zext i8 %lshamt to i32
%conv = zext i8 %x to i32
%shr = lshr i32 %conv, %rshamtconv
%shl = shl i32 %conv, %lshamtconv
%or = or i32 %shl, %shr
%r = trunc i32 %or to i8
=>
%maskedShAmt2 = and i8 %shamt, 7
%negShAmt2 = sub i8 0, %shamt
%maskedNegShAmt2 = and i8 %negShAmt2, 7
%shl2 = lshr i8 %x, %maskedShAmt2
%shr2 = shl i8 %x, %maskedNegShAmt2
%r = or i8 %shl2, %shr2
llvm-svn: 346716
Simon Atanasyan [Mon, 12 Nov 2018 22:43:17 +0000 (22:43 +0000)]
[DWARF] Do not use PRIx32 for printing uint64_t values
The `DWARFDebugAddrTable::dump` routine prints 32/64-bits addresses.
These values are stored in a vector of `uint64_t` independently of their
original sizes. But `format` function gets format string with PRIx32
suffix in case of 32-bit address size. At least on MIPS 32-bit targets
that leads to incorrect output.
This patch changes formats strings and always use PRIx64 to print
`uint64_t` values.
Differential Revision: http://reviews.llvm.org/D54424
llvm-svn: 346715
Aaron Ballman [Mon, 12 Nov 2018 22:32:38 +0000 (22:32 +0000)]
Convert a condition into an assertion per post-review feedback; NFC intended.
llvm-svn: 346714
Sanjay Patel [Mon, 12 Nov 2018 22:11:09 +0000 (22:11 +0000)]
[InstCombine] narrow width of rotate patterns, part 2 (PR39624)
The sub-pattern for the shift amount in a rotate can take on
several different forms, and there's apparently no way to
canonicalize those without seeing the entire rotate sequence.
This is the form noted in:
https://bugs.llvm.org/show_bug.cgi?id=39624
https://rise4fun.com/Alive/qnT
%zx = zext i8 %x to i32
%maskedShAmt = and i32 %shAmt, 7
%shl = shl i32 %zx, %maskedShAmt
%negShAmt = sub i32 0, %shAmt
%maskedNegShAmt = and i32 %negShAmt, 7
%shr = lshr i32 %zx, %maskedNegShAmt
%rot = or i32 %shl, %shr
%r = trunc i32 %rot to i8
=>
%truncShAmt = trunc i32 %shAmt to i8
%maskedShAmt2 = and i8 %truncShAmt, 7
%shl2 = shl i8 %x, %maskedShAmt2
%negShAmt2 = sub i8 0, %truncShAmt
%maskedNegShAmt2 = and i8 %negShAmt2, 7
%shr2 = lshr i8 %x, %maskedNegShAmt2
%r = or i8 %shl2, %shr2
llvm-svn: 346713
Philip Reames [Mon, 12 Nov 2018 22:03:53 +0000 (22:03 +0000)]
[GC][NFC] Simplify code now that we only have one safepoint kind
This is the NFC follow up to exploit the semantic simplification from r346701
llvm-svn: 346712
Sanjay Patel [Mon, 12 Nov 2018 22:00:00 +0000 (22:00 +0000)]
[InstCombine] refactor code for matching shift amount of a rotate; NFC
As shown in existing test cases and with:
https://bugs.llvm.org/show_bug.cgi?id=39624
...we're missing at least 2 more patterns for rotate narrowing.
llvm-svn: 346711
Ali Tamur [Mon, 12 Nov 2018 21:43:43 +0000 (21:43 +0000)]
Use a data structure better suited for large sets in SimplificationTracker.
Summary:
D44571 changed SimplificationTracker to use SmallSetVector to keep phi nodes. As a result, when the number of phi nodes is large, the build time performance suffers badly. When building for power pc, we have a case where there are more than 600.000 nodes, and it takes too long to compile.
In this change, I partially revert D44571 to use SmallPtrSet, which does an acceptable job with any number of elements. In the original patch, having a deterministic iteration order was mentioned as a motivation, however I think it only applies to the nodes already matched in MatchPhiSet method, which I did not touch.
Reviewers: bjope, skatkov
Reviewed By: bjope, skatkov
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54007
llvm-svn: 346710
Erik Pilkington [Mon, 12 Nov 2018 21:31:06 +0000 (21:31 +0000)]
[Sema] Make sure we substitute an instantiation-dependent default template argument
Fixes llvm.org/PR39623
Differential revision: https://reviews.llvm.org/D54414
llvm-svn: 346709
Kuba Mracek [Mon, 12 Nov 2018 21:26:03 +0000 (21:26 +0000)]
[lldb] Add synthetic frontend for _NSCallStackArray
An Obj-C array type _NSCallStackArray is used in NSException backtraces. This patch adds a synthetic frontend for _NSCallStackArray, which now correctly returns frame PCs.
Differential Revision: https://reviews.llvm.org/D44081
llvm-svn: 346708
Jonas Devlieghere [Mon, 12 Nov 2018 21:24:50 +0000 (21:24 +0000)]
Re-land "Extract construction of DataBufferLLVM into FileSystem"
This fixes some UB in isLocal detected by the sanitized bot.
llvm-svn: 346707
Simon Pilgrim [Mon, 12 Nov 2018 21:12:38 +0000 (21:12 +0000)]
[X86][SSE] Add lowerVectorShuffleAsByteRotateAndPermute (PR39387)
This patch adds the ability to use a PALIGNR to rotate a pair of inputs to select a range containing all the referenced elements, followed by a single input permute to put them in the right location.
Differential Revision: https://reviews.llvm.org/D54267
llvm-svn: 346706
Erich Keane [Mon, 12 Nov 2018 21:08:41 +0000 (21:08 +0000)]
Fix the 'fixit' for inline namespace replacement.
I'd neglected to add to the fixit for r346677. Richard Smith mentioned
this in a review-after-commit, so fixing it here.
Change-Id: I77e612be978d4eedda8d5bbd60b812b88f875cda
llvm-svn: 346705
Aakanksha Patil [Mon, 12 Nov 2018 21:04:06 +0000 (21:04 +0000)]
AMDGPU: Adding more median3 patterns
min(max(a, b), max(min(a, b), c)) -> med3 a, b, c
Differential Revision: https://reviews.llvm.org/D54331
llvm-svn: 346704
Sanjay Patel [Mon, 12 Nov 2018 20:32:59 +0000 (20:32 +0000)]
[InstCombine] add more tests for rotate narrowing; NFC
llvm-svn: 346703
Philip Reames [Mon, 12 Nov 2018 20:30:50 +0000 (20:30 +0000)]
[GC docs] Update the gcroot documentation to reflect recent simplifcations to GCStrategy configurability
llvm-svn: 346702
Philip Reames [Mon, 12 Nov 2018 20:15:34 +0000 (20:15 +0000)]
[GC] Remove so called PreCall safepoints
Remove another bit of unused configuration potential from GCStrategy. It's not entirely clear what the intention here was, but from the docs, it sounds like this may have been subsumed by patchable call support.
Note: This change is deliberately small to make it clear that while implemented, there's nothing using the option. A following NFC will do most of the simplifications.
llvm-svn: 346701