Commit Graph

299086 Commits

Author SHA1 Message Date
David Carlier 38a20c2a52 [Xray] llvm-xray fix possible segfault
top argument when superior to the instrumentated code list capacity can lead to a segfault.

Reviewers: dberris

Reviewed By: dberris

Differential Revision: https://reviews.llvm.org/D52224

llvm-svn: 342461
2018-09-18 10:31:10 +00:00
Eric Liu 821a116818 [clangd] Merge ClangdServer::DynamicIndex into FileIndex. NFC.
Summary:
FileIndex now provides explicit interfaces for preamble and main file updates.
This avoids growing parameter list when preamble and main symbols diverge
further (e.g. D52078). This also gets rid of the hack in `indexAST` that
inferred main file index based on `TopLevelDecls`.

Also separate `indexMainDecls` from `indexAST`.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D52222

llvm-svn: 342460
2018-09-18 10:30:44 +00:00
Jonas Toth e8b31285aa [clang-tidy] use CHECK-NOTES in bugprone-forwarding-reference-overload
Reviewers: aaron.ballman, alexfh, hokein

Reviewed By: alexfh

Subscribers: xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D52186

llvm-svn: 342459
2018-09-18 10:21:33 +00:00
Jonas Toth ebf03001c1 [clang-tidy] use CHECK-NOTES in tests for bugprone-argument-comment
Summary:
This patch uses CHECK-NOTES for the tests.
Its part of an effort to test *ALL* generated diagnostics in clang-tidy,
as emitted notes were previously ignored.

Reviewers: alexfh, aaron.ballman, hokein

Reviewed By: alexfh

Subscribers: xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D52178

llvm-svn: 342458
2018-09-18 10:15:15 +00:00
Yury Gribov 53db663afb Fixes removal of dead elements from PressureDiff (PR37252).
Reviewed By: MatzeB

Differential Revision: https://reviews.llvm.org/D51495

llvm-svn: 342457
2018-09-18 09:53:42 +00:00
Sam McCall 3bf9b6d920 [clangd] dexp tool uses llvm::cl to parse its flags.
Summary:
We can use cl::ResetCommandLineParser() to support different types of
command-lines, as long as we're careful about option lifetimes.
(I tried using subcommands, but the error messages were bad)
I found a mostly-reasonable pattern to isolate the fiddly parts.

Added -scope and -limit flags to the `find` command to demonstrate.
(Note that scope support seems to be broken in dex?)

Fixed symbol lookup to parse symbol IDs.

Caveats:
 - with command help (e.g. `find -help`), you also get some spam
   about required arguments. This is a bug in llvm::cl, which prints
   these to errs() rather than the designated stream.

Reviewers: kbobyrev

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D51989

llvm-svn: 342456
2018-09-18 09:49:57 +00:00
David Green 85d6a55995 [AArch64] Attempt to parse more operands as expressions
This tries to make use of evaluateAsRelocatable in AArch64AsmParser::classifySymbolRef
to parse more complex expressions as relocatable operands. It is hopefully better than
the existing code which only handles Symbol +- Constant.

This allows us to parse more complex adr/adrp, mov, ldr/str and add operands. It also
loosens the requirements on parsing addends in ld/st and mov's and adds a number of
tests.

Differential Revision: https://reviews.llvm.org/D51792

llvm-svn: 342455
2018-09-18 09:44:53 +00:00
Sam McCall 4c077f987c [clangd] Update code completion for #include completions in r342449
llvm-svn: 342453
2018-09-18 09:08:28 +00:00
Eric Liu f736766659 [clangd] Adapt API change after 342451.
llvm-svn: 342452
2018-09-18 08:52:14 +00:00
Eric Liu 4d22172b3a [Index] Add an option to collect macros from preprocesor.
Summary: Also added unit tests for the index library; lit+c-index-test is painful...

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: mgorny, cfe-commits

Differential Revision: https://reviews.llvm.org/D52098

llvm-svn: 342451
2018-09-18 08:51:08 +00:00
Martin Storsjo a4edfcb2a4 [benchmark] Lowercase windows specific includes
The windows SDK headers don't have self-consistent casing anyway,
so we consistently use lowercase for these in other places, in order
to fix crosscompilation with mingw headers.

This applies an upstream commit:
5261307982

Differential Revision: https://reviews.llvm.org/D52181

llvm-svn: 342450
2018-09-18 08:44:57 +00:00
Sam McCall 3d8051abb8 [CodeComplete] Add completions for filenames in #include directives.
Summary:
The dir component ("somedir" in #include <somedir/fo...>) is considered fixed.
We append "foo" to each directory on the include path, and then list its files.

Completions are of the forms:
 #include <somedir/fo^
                   foo.h>
                   fox/

The filter is set to the filename part ("fo"), so fuzzy matching can be
applied to the filename only.

No fancy scoring/priorities are set, and no information is added to
CodeCompleteResult to make smart scoring possible. Could be in future.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D52076

llvm-svn: 342449
2018-09-18 08:40:41 +00:00
Martin Storsjo 5fefad793c [COFF] Fix the name mangling of a function in the autoexport exclusion list
The __NULL_IMPORT_DESCRIPTOR symbol has two leading underscores on
architectures other than i386 as well; it is not a mangled symbol name.

llvm-svn: 342448
2018-09-18 07:22:05 +00:00
Martin Storsjo 32d21d6a2d [COFF] Add support for delay loading DLLs for ARM64
Differential Revision: https://reviews.llvm.org/D52190

llvm-svn: 342447
2018-09-18 07:22:01 +00:00
Martin Storsjo cb9570eb22 [COFF] Fix a block with incorrect indentation. NFC.
llvm-svn: 342446
2018-09-18 07:21:55 +00:00
Fangrui Song 4f361612d1 [pp-trace] Remove unused using directives
llvm-svn: 342445
2018-09-18 06:57:58 +00:00
Max Kazantsev 0994abda3a [IndVars] Remove unreasonable checks in rewriteLoopExitValues
A piece of logic in rewriteLoopExitValues has a weird check on number of
users which allowed an unprofitable transform in case if an instruction has
more than 6 users.

Differential Revision: https://reviews.llvm.org/D51404
Reviewed By: etherzhhb

llvm-svn: 342444
2018-09-18 04:57:18 +00:00
Matt Arsenault ebf46143ea AMDGPU: Don't form fmed3 if it will require materialization
If there is a single use constant, it can be folded into the
min/max, but not into med3.

llvm-svn: 342443
2018-09-18 02:34:54 +00:00
Matt Arsenault c640798597 LSV: Fix adjust alloca alignment trick for AMDGPU
This was checking the hardcoded address space 0 for the stack.
Additionally, this should be checking for legality with
the adjusted alignment, so defer the alignment check.

Also try to split if the unaligned access isn't allowed.

llvm-svn: 342442
2018-09-18 02:05:44 +00:00
QingShan Zhang f1b0b47b2d [PowerPC] Add Itineraries of IIC_IntMulHD for P7/P8
When doing some instruction scheduling work, we noticed some missing itineraries.
Before we switch to machine scheduler, those missing itineraries might not have impact to actually scheduling, 
because we can still get same latency due to default values.

With machine scheduler, however, itineraries will have impact to scheduling.
eg: NumMicroOps will default to be 0 if there is NO itineraries for specific instruction class.
And most of the instruction class with itineraries will have NumMicroOps default to 1.

This will has impact on the count of RetiredMOps, affects the Pending/Available Queue, 
then causing different scheduling or suboptimal scheduling further.

Patch By: jsji (Jinsong Ji)
Differential Revision: https://reviews.llvm.org/D52040

llvm-svn: 342441
2018-09-18 02:05:18 +00:00
QingShan Zhang df1a2d8d2b [PowerPC][NFC] Add a mulld testcase for scheduling check.
This patch add a mulld testcase for scheduling check.

Patch By: jsji (Jinsong Ji)
Differential Revision: https://reviews.llvm.org/D52039

llvm-svn: 342440
2018-09-18 01:59:22 +00:00
Matt Arsenault 9d49c449ec AMDGPU: Expand vector canonicalizes
llvm-svn: 342439
2018-09-18 01:51:33 +00:00
whitequark 1db8dc65ea [OCaml] Add OCaml API for LLVMIsCleanup
Summary: Expose test for whether or not a landingpad is a cleanup.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52205

llvm-svn: 342438
2018-09-18 01:48:01 +00:00
whitequark 02da196c8c [NFC][OCaml] Fix copy paste error in file header
Summary: Just copypasta resulting in the wrong file name in the header.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52215

llvm-svn: 342437
2018-09-18 01:47:53 +00:00
whitequark f02eae7487 [NFC][OCaml] Fix implicit declaration compilation warnings
Summary:
2dd4f35c7fc75639920ebc473a4a57ea91864c10 moved LLVMAddLowerSwitchPass
and LLVMAddPromoteMemoryToRegisterPass declarations from
llvm-c/Transforms/Scalar.h to llvm-c/Transforms/Utils.h

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52214

llvm-svn: 342436
2018-09-18 01:47:44 +00:00
whitequark b486107c20 [LLVM-C][OCaml] Add C and OCaml APIs for llvm::StructType::isLiteral
Summary:
This patch adds LLVMIsLiteralStruct to the C API to expose
StructType::isLiteral. This is then used to implement the analogous
addition to the OCaml API.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52209

llvm-svn: 342435
2018-09-18 01:47:37 +00:00
whitequark 6c1f7a51b9 [LLVM-C] Add support for ConstantExpr in LLVMGetNumIndices and LLVMGetIndices
Summary:
ConstantExpr supports getIndices, but prior to this patch
LLVMGetNumIndices and LLVMGetIndices would error on them.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52206

llvm-svn: 342434
2018-09-18 01:47:25 +00:00
whitequark c296d1764c [OCaml] Add OCaml APIs for Invoke arguments and destinations
Summary:
This patch adds OCaml APIs for LLVMGetNormalDest and LLVMGetUnwindDest
on InvokeInsts, as well as LLVMGetNumArgOperands on CallInsts and
InvokeInsts.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52204

llvm-svn: 342433
2018-09-18 01:47:18 +00:00
Ryan Prichard 1c33d14bcd [ELF] Set Out::TlsPhdr earlier for encoding packed reloc tables
Summary:
For --pack-dyn-relocs=android, finalizeSections calls
LinkerScript::assignAddresses and
AndroidPackedRelocationSection::updateAllocSize in a loop,
where assignAddresses lays out the ELF image, then updateAllocSize
determines the size of the Android packed relocation table by encoding it.
Encoding the table requires knowing the values of relocation addends.

To get the addend of a TLS relocation, updateAllocSize can call getSymVA
on a TLS symbol before setPhdrs has initialized Out::TlsPhdr, producing an
error:

    <file> has an STT_TLS symbol but doesn't have an SHF_TLS section

Fix the problem by initializing Out::TlsPhdr immediately after the program
headers are created. The segment's p_vaddr field isn't initialized until
setPhdrs, so use FirstSec->Addr, which is what setPhdrs would use.
FirstSec will typically refer to the .tdata or .tbss output section, whose
(tentative) address was computed by assignAddresses.

Android currently avoids this problem because it uses emutls and doesn't
support ELF TLS. This problem doesn't apply to --pack-dyn-relocs=relr
because SHR_RELR only handles relative relocations without explicit addends
or info.

Fixes https://bugs.llvm.org/show_bug.cgi?id=37841.

Reviewers: ruiu, pcc, chh, javed.absar, espindola

Subscribers: emaste, arichardson, llvm-commits, srhines

Differential Revision: https://reviews.llvm.org/D51671

llvm-svn: 342432
2018-09-18 00:24:48 +00:00
Volodymyr Sapsai 703ab84cf5 Revert "[ARM] Cleanup ARM CGP isSupportedValue"
This reverts r342395 as it caused error

> Argument value type does not match pointer operand type!
>   %0 = atomicrmw volatile xchg i8* %_Value1, i32 1 monotonic, !dbg !25
>  i8in function atomic_flag_test_and_set
> fatal error: error in backend: Broken function found, compilation aborted!

on bot http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/

More details are available at https://reviews.llvm.org/D52080

llvm-svn: 342431
2018-09-18 00:11:55 +00:00
Reid Kleckner d38f9a6ce3 Work around grep vs. CRLF issue in Thumb2 test by matching excess whitespace
There seems to be a separate command line tokenization issue that
prevents just ':\s*$' from working, since then the pattern argument
isn't quoted, and grep.exe misinterprets the backslash somehow.

llvm-svn: 342430
2018-09-18 00:04:29 +00:00
whitequark d299b2c311 [OCaml] Add GlobalIFunc value kind to OCaml API
Summary:
The GlobalIFunc value kind has not yet been added to the OCaml
API. This patch only extends the enum, so that e.g. classify_value
will not crash. No support for manipulating or building GlobalIFuncs
is added at this point.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52198

llvm-svn: 342429
2018-09-18 00:01:12 +00:00
whitequark 17c7040bc6 [OCaml] Add Token type to kind enum in OCaml API
Summary:
The token type has not yet been added to the OCaml API. This
patch only extends the enum, so that e.g. classify_type will not
crash. No support for manipulating or building tokens is added at this
point.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52197

llvm-svn: 342428
2018-09-18 00:01:01 +00:00
whitequark 4923d54c55 [OCaml] Add missing instruction opcodes to OCaml API
Summary:
The OCaml bindings have become out of date and several opcodes have
been added to the C API without corresponding additions to the OCaml
API.

Reviewers: whitequark, mgorny

Reviewed By: whitequark

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52196

llvm-svn: 342427
2018-09-18 00:00:53 +00:00
Saleem Abdulrasool f5ebd70a67 build: fix standalone builds for compiler-rt on Darwin
When building static fat libraries, we need to ensure that we use libtool rather
than llvm-ar to create the library.  Duplicate the rules from LLVM to ensure
that we correctly build the fat libraries when building compiler-rt standalone.
This also requires that we duplicate the workaround for the `DYLD_LIBRARY_PATH`
for SIP.  Additionally, ensure that we set the `CMAKE_*_ARCHIVE_FINISH` variable
to ensure that we do not try to use `ranlib` on that target.

llvm-svn: 342425
2018-09-17 23:25:36 +00:00
Shafik Yaghmour 2ee93d28fd Revert "[DataFormatters] Add formatter for C++17 std::variant"
This reverts commit r342421.

Because it breaks build bot http://green.lab.llvm.org/green/job/lldb-cmake-clang-5.0.2//418/console

llvm-svn: 342424
2018-09-17 23:15:35 +00:00
Matt Morehouse 1e1f3c8298 [libFuzzer] Avoid fuzzer symbols being hidden.
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1490845#c5.

Patch By: Mike Hommey

llvm-svn: 342423
2018-09-17 23:08:15 +00:00
Alina Sbirlea a782a70ad9 [EarlyCSEwMemorySSA] Add MSSA verification and tests to make EarlyCSE failures easier to track.
Summary:
EarlyCSE can make IR changes that will leave MemorySSA with accesses claiming to be optimized, but for which a subsequent MemorySSA run will yield a different optimized result.
Due to relying on AA queries, we can't fix this in general, unless we recompute MemorySSA.
Adding some tests to track this and a basic verify for future potential failures.

Reviewers: george.burgess.iv, gberry

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

Differential Revision: https://reviews.llvm.org/D51960

llvm-svn: 342422
2018-09-17 22:35:21 +00:00
Shafik Yaghmour 854a35092c [DataFormatters] Add formatter for C++17 std::variant
rdar://problem/43691454

Patch by Shafik Yaghmour.

Differential Revision: https://reviews.llvm.org/D51520

llvm-svn: 342421
2018-09-17 22:10:44 +00:00
Zachary Turner 50f6a9cee0 Add #include <cassert>
This should fix the broken builds on some bots.

llvm-svn: 342420
2018-09-17 22:04:56 +00:00
Jim Ingham 25256c7f09 Add docs for scripted breakpoint resolvers
Differential Revision: https://reviews.llvm.org/D52065

llvm-svn: 342419
2018-09-17 21:55:46 +00:00
Aaron Puchert e33105e8c2 Thread safety analysis: Run more tests with capability attributes [NFC]
Summary:
We run the tests for -Wthread-safety-{negative,verbose} with the new
attributes as well as the old ones. Also put the macros in a header so
that we don't have to copy them all around.

The warn-thread-safety-parsing.cpp test checks for warnings depending on
the actual attribute name, so it can't undergo the same treatment.

Together with D49275 this should fix PR33754.

Reviewers: aaron.ballman, delesley, grooverdan

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D52141

llvm-svn: 342418
2018-09-17 21:37:22 +00:00
Shuai Wang 13f5dd5280 [clang-tidy] Fix tests for performance-for-range-copy
Test failed as D52120 made ExprMutationAnalyzer smarter, fixed by:
- Add move-ctor for `Mutable` to make it actually movable.
- Properly implement `remove_reference`.

The failed test case is:
void negativeVarIsMoved() {
  for (auto M : View<Iterator<Mutable>>()) {
    auto Moved = std::move(M);
  }
}
Before D52120, `std::move(M)` itself is considered as a mutation to `M`,
while after D52120 it's only considered as a cast to rvalue, the
move-assignment is what causes the actual mutation. The test case didn't
mock things properly so the intended move-assignement was actually a
copy-assignment.

llvm-svn: 342417
2018-09-17 21:28:08 +00:00
Simon Atanasyan 9265dca8b5 [mips] Fix MIPS N32 ABI triples support
Add support mips64(el)-linux-gnuabin32 triples, and set them to N32.
Debian architecture name mipsn32/mipsn32el are also added. Set
UseIntegratedAssembler for N32 if we can detect it.

Patch by YunQiang Su.

Differential revision: https://reviews.llvm.org/D51408

llvm-svn: 342416
2018-09-17 21:21:57 +00:00
Zachary Turner bdf0381e21 [PDB] Make the native reader support enumerators.
Previously we would dump the names of enum types, but not their
enumerator values.  This adds support for enumerator values.  In
doing so, we have to introduce a general purpose mechanism for
caching symbol indices of field list members.  Unlike global
types, FieldList members do not have a TypeIndex.  So instead,
we identify them by the pair {TypeIndexOfFieldList, IndexInFieldList}.

llvm-svn: 342415
2018-09-17 21:08:11 +00:00
Zachary Turner 4727ac2394 [PDB] Make the native reader support modified types.
Previously for cv-qualified types, we would just ignore them
and they would never get printed.  Now we can enumerate them
and cache them like any other symbol type.

llvm-svn: 342414
2018-09-17 21:07:48 +00:00
George Karpenkov 8639c5d565 [analyzer] ExplodedGraph printing fixes
Fixes a number of issues:

 - Global variables are not used for communication
 - Trait should be defined on a graph, not on a node
 - Defining the trait on a graph allows us to use a correct allocator,
   no longer crashing while printing trimmed graphs

Differential Revision: https://reviews.llvm.org/D52183

llvm-svn: 342413
2018-09-17 20:46:53 +00:00
Nirav Dave b1f9e4d285 [MC] Avoid inlining constant symbols with variants.
Summary:
Defer unnecessary early inlining of constants to symbol
variants. Fixes PR38945.

Reviewers: nickdesaulniers, rnk

Subscribers: nemanjai, hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D52188

llvm-svn: 342412
2018-09-17 20:34:26 +00:00
Sean Fertile 72435e5701 [PPC64] Support relaxing R_PPC64_TLSGD16 in TlsGdtoLe relaxation.
A General-dynamic tls access can be written using a R_PPC64_TLSGD16 relocation
if the target got entry is within 16 bits of the TOC-base. This patch adds
support for R_PPC64_TLSGD16 by relaxing it the same as a R_PPC64_GOT_TLSGD16_LO.

Differential Revision: https://reviews.llvm.org/D52055

llvm-svn: 342411
2018-09-17 20:27:02 +00:00
Sean Fertile eed3e43e54 [PPC64] Helpers for read/write an instr while relocating a half16 type. [NFC]
There are a growing number of places when we either want to read or write an
instruction when handling a half16 relocation type. On big-endian the buffer
pointer is pointing into the middle of the word we want and on little-endian it
is pointing to the start of the word. These 2 helpers are to simplify reading
and writing in these contexts.

Differential Revision: https://reviews.llvm.org/D52115

llvm-svn: 342410
2018-09-17 20:27:00 +00:00