Zachary Turner [Tue, 18 Sep 2018 16:35:05 +0000 (16:35 +0000)]
[PDB] Better support for enumerating pointer types.
There were several issues with the previous implementation.
1) There were no tests.
2) We didn't support creating PDBSymbolTypePointer records for
builtin types since those aren't described by LF_POINTER
records.
3) We didn't support a wide enough variety of builtin types even
ignoring pointers.
This patch fixes all of these issues. In order to add tests,
it's helpful to be able to ignore the symbol index id hierarchy
because it makes the golden output from the DIA version not match
our output, so I've extended the dumper to disable dumping of id
fields.
llvm-svn: 342493
Krzysztof Parzyszek [Tue, 18 Sep 2018 16:10:51 +0000 (16:10 +0000)]
[PostRASink] Make sure to remove subregisters from live-ins as well
llvm-svn: 342492
Jinsong Ji [Tue, 18 Sep 2018 15:38:56 +0000 (15:38 +0000)]
[NFC] Update comments regarding BufferSize for ProcResources
llvm-svn: 342491
Simon Pilgrim [Tue, 18 Sep 2018 15:38:16 +0000 (15:38 +0000)]
Revert rL342465: Added function to set a register to a particular value + tests.
rL342465 is breaking the MSVC buildbots.
llvm-svn: 342490
Simon Pilgrim [Tue, 18 Sep 2018 15:35:49 +0000 (15:35 +0000)]
Revert rL342466: [llvm-exegesis] Improve Register Setup.
rL342465 is breaking the MSVC buildbots, but I need to revert this dependent revision as well.
Summary:
Added function to set a register to a particular value + tests.
Add EFLAGS test, use new setRegTo instead of setRegToConstant.
Reviewers: courbet, javed.absar
Subscribers: mgorny, tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D51856
llvm-svn: 342489
Alex Bradbury [Tue, 18 Sep 2018 15:18:16 +0000 (15:18 +0000)]
[RISCV][MC] Use a custom ParserMethod for the bare_symbol operand type
This allows the hard-coded shouldForceImmediate logic to be removed because
the generated MatchOperandParserImpl makes use of the current context (i.e.
the current mnemonic) to determine parsing behaviour, and so won't first try
to parse a register before parsing a symbol name.
No functional change is intended. gas accepts immediate arguments for call,
tail and lla. This patch doesn't address this discrepancy.
Differential Revision: https://reviews.llvm.org/D51733
llvm-svn: 342488
Alex Bradbury [Tue, 18 Sep 2018 15:13:29 +0000 (15:13 +0000)]
[RISCV][MC] Reject bare symbols for the simm12 operand type
addi a0, a0, foo and lw a0, foo(a0) and similar are now rejected. An explicit
%lo and %pcrel_lo modifier is required. This matches gas behaviour.
llvm-svn: 342487
Alex Bradbury [Tue, 18 Sep 2018 15:08:35 +0000 (15:08 +0000)]
[RISCV][MC] Tighten up checking of sybol operands to lui and auipc
Reject bare symbols and accept only %pcrel_hi(sym) for auipc and %hi(sym) for
lui. Also test valid operand modifiers in rv32i-valid.s.
Note this is slightly stricter than gas, which will accept either %pcrel_hi or
%hi for both lui and auipc.
Differential Revision: https://reviews.llvm.org/D51731
llvm-svn: 342486
Nico Weber [Tue, 18 Sep 2018 15:06:16 +0000 (15:06 +0000)]
Remove dead function user_cache_directory()
It's been unused since it was added almost 3 years ago in
https://reviews.llvm.org/D13801
Motivated by https://reviews.llvm.org/rL342002 since it removes one of the
functions keeping a ref to SHGetKnownFolderPath.
Differential Revision: https://reviews.llvm.org/D52184
llvm-svn: 342485
Argyrios Kyrtzidis [Tue, 18 Sep 2018 15:02:56 +0000 (15:02 +0000)]
[index] Enhance indexing for module references
* Create a USR for the occurrences of the 'module' symbol kind
* Record module references for each identifier in an import declaration
llvm-svn: 342484
Andrea Di Biagio [Tue, 18 Sep 2018 15:00:06 +0000 (15:00 +0000)]
[llvm-mca] Add the ability to mark register reads/writes associated with dep-breaking instructions. NFCI
This patch adds two new boolean fields:
- Field `ReadState::IndependentFromDef`.
- Field `WriteState::WritesZero`.
Field `IndependentFromDef` is set for ReadState objects associated with
dependency-breaking instructions. It is used by the simulator when updating data
dependencies between registers.
Field `WritesZero` is set by WriteState objects associated with dependency
breaking zero-idiom instructions. It helps the PRF identify which writes don't
consume any physical registers.
llvm-svn: 342483
Hans Wennborg [Tue, 18 Sep 2018 14:12:54 +0000 (14:12 +0000)]
Revert r342457 "Fixes removal of dead elements from PressureDiff (PR37252)."
This broke the lit tests on a bunch of buildbots, e.g.
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/36679
> Reviewed By: MatzeB
>
> Differential Revision: https://reviews.llvm.org/D51495
llvm-svn: 342482
Simon Pilgrim [Tue, 18 Sep 2018 14:05:07 +0000 (14:05 +0000)]
Use pass-by-reference for-range loop. NFCI.
llvm-svn: 342481
Andrea Di Biagio [Tue, 18 Sep 2018 14:03:46 +0000 (14:03 +0000)]
[llvm-mca] Slightly refactor class InstRef. NFC.
llvm-svn: 342480
Teresa Johnson [Tue, 18 Sep 2018 13:44:13 +0000 (13:44 +0000)]
[ThinLTO] Update LangRef doc for summary parsing
Summary:
Remove note about summary being ignored. Update to reflect the
fact that summary is now parsed by llvm-as.
While here, fix one summary format that changed since the initial
implementation.
Reviewers: dexonsmith
Subscribers: inglorion, llvm-commits
Differential Revision: https://reviews.llvm.org/D51540
llvm-svn: 342479
Nemanja Ivanovic [Tue, 18 Sep 2018 13:43:16 +0000 (13:43 +0000)]
[PowerPC] Do not emit record-form rotates when record-form andi/andis suffices
This is a follow-up to the previous patch that eliminated some of the rotates.
With this addition, we will also emit the record-form andis.
This patch increases the number of record-form rotates we eliminate by
more than 70%.
Differential revision: https://reviews.llvm.org/D44897
llvm-svn: 342478
Teresa Johnson [Tue, 18 Sep 2018 13:42:24 +0000 (13:42 +0000)]
[LTO] Make detection of WPD remark enablement more robust
Summary:
Currently only the first function in the module is checked to
see if it has remarks enabled. If that first function is a declaration,
remarks will be incorrectly skipped. Change to look for the first
non-empty function.
Reviewers: pcc
Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D51556
llvm-svn: 342477
whitequark [Tue, 18 Sep 2018 13:36:03 +0000 (13:36 +0000)]
[LLVM-C][OCaml] Add UnifyFunctionExitNodes pass to C and OCaml APIs
Summary:
Adds LLVMAddUnifyFunctionExitNodesPass to expose
createUnifyFunctionExitNodesPass to the C and OCaml APIs.
Reviewers: whitequark, deadalnix
Reviewed By: whitequark
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D52212
llvm-svn: 342476
whitequark [Tue, 18 Sep 2018 13:35:50 +0000 (13:35 +0000)]
[LLVM-C][OCaml] Add LowerAtomic pass to C and OCaml APIs
Summary:
Adds LLVMAddLowerAtomicPass to expose createLowerAtomicPass in the C
and OCaml APIs.
Reviewers: whitequark, deadalnix
Reviewed By: whitequark
Subscribers: jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D52211
llvm-svn: 342475
whitequark [Tue, 18 Sep 2018 13:35:39 +0000 (13:35 +0000)]
[OCaml] Add OCaml API for LLVMGetIndices
Summary:
This patch adds a thin wrapper around LLVMGetNumIndices and
LLVMGetIndices to return the indices of ExtractValue or InsertValue
instructions as an OCaml array. It has not seemed to be necessary to
expose LLVMGetNumIndices separately.
Reviewers: whitequark
Reviewed By: whitequark
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D52207
llvm-svn: 342474
Eric Liu [Tue, 18 Sep 2018 13:35:16 +0000 (13:35 +0000)]
[clangd] Get rid of Decls parameter in indexMainDecls. NFC
It's already available in ParsedAST.
llvm-svn: 342473
Nemanja Ivanovic [Tue, 18 Sep 2018 13:21:58 +0000 (13:21 +0000)]
[PowerPC] Optimize compares fed by ANDISo
Both ANDIo and ANDISo (and the 64-bit versions) are record-form instructions.
When optimizing compares, we handle the former in order to eliminate the compare
instruction but not the latter. This patch just adds the latter to the set of
instructions we optimize.
The reason these instructions need to be handled separately is that they are not
part of the RecFormRel map (since they don't have a non-record-form). The
missing "and-immediate-shifted" is just an oversight in the initial
implementation.
Differential revision: https://reviews.llvm.org/D51353
llvm-svn: 342472
John Brawn [Tue, 18 Sep 2018 13:18:21 +0000 (13:18 +0000)]
[TargetLowering] Android has sincos functions
Since Android API version 9 the Android libm has had the sincos functions, so
they should be recognised as libcalls and sincos optimisation should be applied.
Differential Revision: https://reviews.llvm.org/D52025
llvm-svn: 342471
Hans Wennborg [Tue, 18 Sep 2018 13:07:55 +0000 (13:07 +0000)]
cl-options.c: Fix negative -cfguard check
llvm-svn: 342470
Simon Pilgrim [Tue, 18 Sep 2018 12:01:25 +0000 (12:01 +0000)]
Fix signed/unsigned comparison warning. NFCI.
llvm-svn: 342469
Jonas Toth [Tue, 18 Sep 2018 11:49:20 +0000 (11:49 +0000)]
[clang-tidy] use CHECK-NOTES in bugprone-unused-return-value
Reviewers: aaron.ballman, alexfh, hokein
Reviewed By: alexfh
Subscribers: xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D52187
llvm-svn: 342468
Simon Pilgrim [Tue, 18 Sep 2018 11:30:30 +0000 (11:30 +0000)]
[TableGen] CodeGenDAGPatterns::GenerateVariants - full caching of matching predicates
Further extension to D51035, this patch avoids all repeated predicates[] matching by caching as it collects the patterns that have multiple variants.
Saves around 25secs in debug builds of x86 -gen-dag-isel.
Differential Revision: https://reviews.llvm.org/D51839
llvm-svn: 342467
Guillaume Chatelet [Tue, 18 Sep 2018 11:26:48 +0000 (11:26 +0000)]
[llvm-exegesis] Improve Register Setup.
Summary:
Added function to set a register to a particular value + tests.
Add EFLAGS test, use new setRegTo instead of setRegToConstant.
Reviewers: courbet, javed.absar
Subscribers: mgorny, tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D51856
llvm-svn: 342466
Guillaume Chatelet [Tue, 18 Sep 2018 11:26:35 +0000 (11:26 +0000)]
Added function to set a register to a particular value + tests.
llvm-svn: 342465
Guillaume Chatelet [Tue, 18 Sep 2018 11:26:27 +0000 (11:26 +0000)]
Improve Register Setup
llvm-svn: 342464
Alexander Kornienko [Tue, 18 Sep 2018 10:53:13 +0000 (10:53 +0000)]
Remove trailing whitespace introduced in r342440.
llvm-svn: 342463
Simon Pilgrim [Tue, 18 Sep 2018 10:44:44 +0000 (10:44 +0000)]
[X86][SSE] LowerShift - pull out repeated getTargetVShiftUniformOpcode calls. NFCI.
llvm-svn: 342462
David Carlier [Tue, 18 Sep 2018 10:31:10 +0000 (10:31 +0000)]
[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
Eric Liu [Tue, 18 Sep 2018 10:30:44 +0000 (10:30 +0000)]
[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
Jonas Toth [Tue, 18 Sep 2018 10:21:33 +0000 (10:21 +0000)]
[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
Jonas Toth [Tue, 18 Sep 2018 10:15:15 +0000 (10:15 +0000)]
[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
Yury Gribov [Tue, 18 Sep 2018 09:53:42 +0000 (09:53 +0000)]
Fixes removal of dead elements from PressureDiff (PR37252).
Reviewed By: MatzeB
Differential Revision: https://reviews.llvm.org/D51495
llvm-svn: 342457
Sam McCall [Tue, 18 Sep 2018 09:49:57 +0000 (09:49 +0000)]
[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
David Green [Tue, 18 Sep 2018 09:44:53 +0000 (09:44 +0000)]
[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
Sam McCall [Tue, 18 Sep 2018 09:08:28 +0000 (09:08 +0000)]
[clangd] Update code completion for #include completions in r342449
llvm-svn: 342453
Eric Liu [Tue, 18 Sep 2018 08:52:14 +0000 (08:52 +0000)]
[clangd] Adapt API change after 342451.
llvm-svn: 342452
Eric Liu [Tue, 18 Sep 2018 08:51:08 +0000 (08:51 +0000)]
[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
Martin Storsjo [Tue, 18 Sep 2018 08:44:57 +0000 (08:44 +0000)]
[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:
https://github.com/google/benchmark/commit/
52613079824ac58d06c070aa9fbbb186a5859e2c
Differential Revision: https://reviews.llvm.org/D52181
llvm-svn: 342450
Sam McCall [Tue, 18 Sep 2018 08:40:41 +0000 (08:40 +0000)]
[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
Martin Storsjo [Tue, 18 Sep 2018 07:22:05 +0000 (07:22 +0000)]
[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
Martin Storsjo [Tue, 18 Sep 2018 07:22:01 +0000 (07:22 +0000)]
[COFF] Add support for delay loading DLLs for ARM64
Differential Revision: https://reviews.llvm.org/D52190
llvm-svn: 342447
Martin Storsjo [Tue, 18 Sep 2018 07:21:55 +0000 (07:21 +0000)]
[COFF] Fix a block with incorrect indentation. NFC.
llvm-svn: 342446
Fangrui Song [Tue, 18 Sep 2018 06:57:58 +0000 (06:57 +0000)]
[pp-trace] Remove unused using directives
llvm-svn: 342445
Max Kazantsev [Tue, 18 Sep 2018 04:57:18 +0000 (04:57 +0000)]
[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
Matt Arsenault [Tue, 18 Sep 2018 02:34:54 +0000 (02:34 +0000)]
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
Matt Arsenault [Tue, 18 Sep 2018 02:05:44 +0000 (02:05 +0000)]
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
QingShan Zhang [Tue, 18 Sep 2018 02:05:18 +0000 (02:05 +0000)]
[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
QingShan Zhang [Tue, 18 Sep 2018 01:59:22 +0000 (01:59 +0000)]
[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
Matt Arsenault [Tue, 18 Sep 2018 01:51:33 +0000 (01:51 +0000)]
AMDGPU: Expand vector canonicalizes
llvm-svn: 342439
whitequark [Tue, 18 Sep 2018 01:48:01 +0000 (01:48 +0000)]
[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
whitequark [Tue, 18 Sep 2018 01:47:53 +0000 (01:47 +0000)]
[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
whitequark [Tue, 18 Sep 2018 01:47:44 +0000 (01:47 +0000)]
[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
whitequark [Tue, 18 Sep 2018 01:47:37 +0000 (01:47 +0000)]
[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
whitequark [Tue, 18 Sep 2018 01:47:25 +0000 (01:47 +0000)]
[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
whitequark [Tue, 18 Sep 2018 01:47:18 +0000 (01:47 +0000)]
[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
Ryan Prichard [Tue, 18 Sep 2018 00:24:48 +0000 (00:24 +0000)]
[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
Volodymyr Sapsai [Tue, 18 Sep 2018 00:11:55 +0000 (00:11 +0000)]
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
Reid Kleckner [Tue, 18 Sep 2018 00:04:29 +0000 (00:04 +0000)]
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
whitequark [Tue, 18 Sep 2018 00:01:12 +0000 (00:01 +0000)]
[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
whitequark [Tue, 18 Sep 2018 00:01:01 +0000 (00:01 +0000)]
[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
whitequark [Tue, 18 Sep 2018 00:00:53 +0000 (00:00 +0000)]
[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
Saleem Abdulrasool [Mon, 17 Sep 2018 23:25:36 +0000 (23:25 +0000)]
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
Shafik Yaghmour [Mon, 17 Sep 2018 23:15:35 +0000 (23:15 +0000)]
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
Matt Morehouse [Mon, 17 Sep 2018 23:08:15 +0000 (23:08 +0000)]
[libFuzzer] Avoid fuzzer symbols being hidden.
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1490845#c5.
Patch By: Mike Hommey
llvm-svn: 342423
Alina Sbirlea [Mon, 17 Sep 2018 22:35:21 +0000 (22:35 +0000)]
[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
Shafik Yaghmour [Mon, 17 Sep 2018 22:10:44 +0000 (22:10 +0000)]
[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
Zachary Turner [Mon, 17 Sep 2018 22:04:56 +0000 (22:04 +0000)]
Add #include <cassert>
This should fix the broken builds on some bots.
llvm-svn: 342420
Jim Ingham [Mon, 17 Sep 2018 21:55:46 +0000 (21:55 +0000)]
Add docs for scripted breakpoint resolvers
Differential Revision: https://reviews.llvm.org/D52065
llvm-svn: 342419
Aaron Puchert [Mon, 17 Sep 2018 21:37:22 +0000 (21:37 +0000)]
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
Shuai Wang [Mon, 17 Sep 2018 21:28:08 +0000 (21:28 +0000)]
[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
Simon Atanasyan [Mon, 17 Sep 2018 21:21:57 +0000 (21:21 +0000)]
[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
Zachary Turner [Mon, 17 Sep 2018 21:08:11 +0000 (21:08 +0000)]
[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
Zachary Turner [Mon, 17 Sep 2018 21:07:48 +0000 (21:07 +0000)]
[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
George Karpenkov [Mon, 17 Sep 2018 20:46:53 +0000 (20:46 +0000)]
[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
Nirav Dave [Mon, 17 Sep 2018 20:34:26 +0000 (20:34 +0000)]
[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
Sean Fertile [Mon, 17 Sep 2018 20:27:02 +0000 (20:27 +0000)]
[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
Sean Fertile [Mon, 17 Sep 2018 20:27:00 +0000 (20:27 +0000)]
[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
Shuai Wang [Mon, 17 Sep 2018 20:10:56 +0000 (20:10 +0000)]
[analyzer] Treat std::{move,forward} as casts in ExprMutationAnalyzer.
Summary:
This is a follow up of D52008 and should make the analyzer being able to handle perfect forwardings in real world cases where forwardings are done through multiple layers of function calls with `std::forward`.
Fixes PR38891.
Reviewers: lebedev.ri, JonasToth, george.karpenkov
Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits
Differential Revision: https://reviews.llvm.org/D52120
llvm-svn: 342409
Shuai Wang [Mon, 17 Sep 2018 20:10:33 +0000 (20:10 +0000)]
Fix build failure caused by D52157
llvm-svn: 342408
Shuai Wang [Mon, 17 Sep 2018 18:48:43 +0000 (18:48 +0000)]
[ASTMatchers] Let isArrow also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D52157
llvm-svn: 342407
Michael Kruse [Mon, 17 Sep 2018 18:40:29 +0000 (18:40 +0000)]
[Loopinfo] Remove one latch-case in getLoopID. NFC.
getLoopID has different control flow for two cases: If there is a
single loop latch and for any other number of loop latches (0 and more
than one). The latter case should return the same result if there is
only a single latch. We can save the preceding redundant search for a
latch by handling both cases with the same code.
Differential Revision: https://reviews.llvm.org/D52118
llvm-svn: 342406
Jessica Paquette [Mon, 17 Sep 2018 18:40:21 +0000 (18:40 +0000)]
[MachineOutliner][NFC] Don't map more illegal instrs than you have to
We were mapping an instruction every time we saw something we couldn't map
before this. Since each illegal mapping is unique, we only have to do this once.
This makes it so that we don't map illegal instructions when the previous
mapped instruction was illegal.
In CTMark (AArch64), this results in 240 fewer instruction mappings on
average over 619 files in total. The largest improvement is 12576 fewer
mappings in one file, and the smallest is 0. The median improvement is 101
fewer mappings.
llvm-svn: 342405
Davide Italiano [Mon, 17 Sep 2018 18:14:38 +0000 (18:14 +0000)]
Revert "[IRInterpreter] Minor cleanups, add comments. NFCI."
This breaks buildbots.
llvm-svn: 342404
Shuai Wang [Mon, 17 Sep 2018 17:59:51 +0000 (17:59 +0000)]
[clang-tidy] Remove duplicated logic in UnnecessaryValueParamCheck and use FunctionParmMutationAnalyzer instead.
Reviewers: alexfh, JonasToth, george.karpenkov
Subscribers: xazax.hun, kristof.beyls, chrib, a.sidorin, Szelethus, cfe-commits
Differential Revision: https://reviews.llvm.org/D52158
llvm-svn: 342403
Keno Fischer [Mon, 17 Sep 2018 17:37:14 +0000 (17:37 +0000)]
[X86ISel] Implement byval lowering for Win64 calling convention
Summary:
The IR reference for the `byval` attribute states:
```
This indicates that the pointer parameter should really be passed by value
to the function. The attribute implies that a hidden copy of the pointee is
made between the caller and the callee, so the callee is unable to modify
the value in the caller. This attribute is only valid on LLVM pointer arguments.
```
However, on Win64, this attribute is unimplemented and the raw pointer is
passed to the callee instead. This is problematic, because frontend authors
relying on the implicit hidden copy (as happens for every other calling
convention) will see the passed value silently (if mutable memory) or
loudly (by means of a crash) modified because the callee treats the
location as scratch memory space it is allowed to mutate.
At this point, it's worth taking a step back to understand the context.
In most calling conventions, aggregates that are too large to be passed
in registers, instead get *copied* to the stack at a fixed (computable
from the signature) offset of the stack pointer. At the LLVM, we hide
this hidden copy behind the byval attribute. The caller passes a pointer
to the desired data and the callee receives a pointer, but these pointers
are not the same. In particular, the pointer that the callee receives
points to temporary stack memory allocated as part of the call lowering.
In most calling conventions, this pointer is never realized in registers
or memory. The temporary memory is simply defined by an implicit
offset from the stack pointer at function entry.
Win64, uniquely, works differently. The structure is still passed in
memory, but instead of being stored at an implicit memory offset, the
caller computes a pointer to the temporary memory and passes it to
the callee as a regular pointer (taking up a register, or if all
registers are taken up, an additional stack slot). Presumably, this
was done to allow eliding the copy when passing aggregates through
several functions on the stack.
This explains why ignoring the `byval` attribute mostly works on Win64.
The argument simply gets passed as a pointer and as long as we're ok
with the callee trampling all over that memory, there are no ill effects.
However, it does contradict the documentation of the `byval` attribute
which specifies that there is to be an implicit copy.
Frontends can of course work around this by never emitting the `byval`
attribute for Win64 and creating `alloca`s for the requisite temporary
stack slots (and that does appear to be what frontends are doing).
However, the presence of the `byval` attribute is not a trap for
frontend authors, since it seems to work, but silently modifies the
passed memory contrary to documentation.
I see two solutions:
- Disallow the `byval` attribute in the verifier if using the Win64
calling convention.
- Make it work by simply emitting a temporary stack copy as we would
with any other calling convention (frontends can of course always
not use the attribute if they want to elide the copy).
This patch implements the second option (make it work), though I would
be fine with the first also.
Ref: https://github.com/JuliaLang/julia/issues/28338
Reviewers: rnk
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51842
llvm-svn: 342402
Nico Weber [Mon, 17 Sep 2018 16:31:20 +0000 (16:31 +0000)]
lld-link: Also demangle undefined dllimported symbols.
dllimported symbols go through an import stub that's called __imp_ followed by
the name the stub points to. Make that work.
Differential Revision: https://reviews.llvm.org/D52145
llvm-svn: 342401
Stanislav Mekhanoshin [Mon, 17 Sep 2018 16:04:32 +0000 (16:04 +0000)]
[AMDGPU] Initialize instruction itinerary from GCNSubtarget
I need to use it in the GCN codegen.
Differential Revision: https://reviews.llvm.org/D52123
llvm-svn: 342400
Alexander Kornienko [Mon, 17 Sep 2018 15:40:01 +0000 (15:40 +0000)]
Revert "[DWARF] reposting r342048, which was reverted in r342056 due to buildbot errors. Adjusted 2 test cases for ARM and darwin and fixed a bug with the original change in dsymutil."
This reverts commit r342218. Due to a number of failures under TSAN. An isolated
test case is being worked on.
llvm-svn: 342399
Xin Tong [Mon, 17 Sep 2018 15:28:01 +0000 (15:28 +0000)]
[CVP] Handle instructions with no user. No need to create CVPLattice state. This handles terminator instructions and more.
Summary:
I tested this patch by compiling sqlite3.ll (clang -O3 -mllvm -disable-llvm-optzns sqlite3.c.)
opt -called-value-propagation sqlite3.ll -time-passes -f -o out.ll
I get 10+% speedup for the pass. I expect some of the gain come from skipping terminator instructions.
=== BEFORE THE PATCH ===
===-------------------------------------------------------------------------===
... Pass execution timing report ...
===-------------------------------------------------------------------------===
Total Execution Time: 0.5562 seconds (0.5582 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.2485 ( 46.4%) 0.0120 ( 57.7%) 0.2605 ( 46.8%) 0.2615 ( 46.8%) Bitcode Writer
0.1607 ( 30.0%) 0.0079 ( 37.7%) 0.1685 ( 30.3%) 0.1693 ( 30.3%) Called Value Propagation
0.1262 ( 23.6%) 0.0009 ( 4.5%) 0.1271 ( 22.9%) 0.1275 ( 22.8%) Module Verifier
0.5353 (100.0%) 0.0209 (100.0%) 0.5562 (100.0%) 0.5582 (100.0%) Total
=== AFTER THE PATCH ===
===-------------------------------------------------------------------------===
... Pass execution timing report ...
===-------------------------------------------------------------------------===
Total Execution Time: 0.5338 seconds (0.5355 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.2498 ( 48.6%) 0.0118 ( 59.3%) 0.2615 ( 49.0%) 0.2629 ( 49.1%) Bitcode Writer
0.1377 ( 26.8%) 0.0075 ( 37.8%) 0.1452 ( 27.2%) 0.1455 ( 27.2%) Called Value Propagation
0.1264 ( 24.6%) 0.0006 ( 3.0%) 0.1270 ( 23.8%) 0.1271 ( 23.7%) Module Verifier
0.5139 (100.0%) 0.0199 (100.0%) 0.5338 (100.0%) 0.5355 (100.0%) Total
Reviewers: davide, mssimpso
Reviewed By: davide
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D49108
llvm-svn: 342398
Amara Emerson [Mon, 17 Sep 2018 14:40:13 +0000 (14:40 +0000)]
Revert "Revert r342183 "[DAGCombine] Fix crash when store merging created an extract_subvector with invalid index.""
Fixed the assertion failure.
llvm-svn: 342397
Jonas Devlieghere [Mon, 17 Sep 2018 14:23:47 +0000 (14:23 +0000)]
[DebugInfo] Remove redundant argument. [NFC]
Removes the redundant UnitType parameter from verifyUnitContents. I also
fixed some formatting issues as I was touching the file.
llvm-svn: 342396
Sam Parker [Mon, 17 Sep 2018 13:57:39 +0000 (13:57 +0000)]
[ARM] Cleanup ARM CGP isSupportedValue
isSupportedValue explicitly checked and accepted many types of value,
primarily for debugging reasons. Remove most of these checks and do a
bit of refactoring now that the pass is more stable. This also enables
ZExts to be sources, but this has very little practical benefit at the
moment extend instructions will still be introduced.
Differential Revision: https://reviews.llvm.org/D52080
llvm-svn: 342395
Simon Pilgrim [Mon, 17 Sep 2018 13:56:42 +0000 (13:56 +0000)]
Fix "not all control paths return a value" MSVC warning. NFCI.
llvm-svn: 342394
Jonas Toth [Mon, 17 Sep 2018 13:55:10 +0000 (13:55 +0000)]
[clang-tidy] fix PR37913, templated exception factory diagnosed correctly
Summary:
PR37913 documents wrong behaviour for a templated exception factory function.
The check does misidentify dependent types as not derived from std::exception.
The fix to this problem is to ignore dependent types, the analysis works correctly
on the instantiated function.
Reviewers: aaron.ballman, alexfh, hokein, ilya-biryukov
Reviewed By: alexfh
Subscribers: lebedev.ri, nemanjai, mgorny, kbarton, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D48714
llvm-svn: 342393
Sam Parker [Mon, 17 Sep 2018 13:48:25 +0000 (13:48 +0000)]
[ARM] Disallow icmp with negative imm and overflow
We allow overflowing instructions if they're decreasing and only used
by an unsigned compare. Add the extra condition that the icmp cannot
be using a negative immediate.
Differential Revision: https://reviews.llvm.org/D52102
llvm-svn: 342392