David Blaikie [Thu, 22 Mar 2018 21:41:29 +0000 (21:41 +0000)]
Fix layering between SCCP and IPO SCCP
Transforms/Scalar/SCCP.cpp implemented both the Scalar and IPO SCCP, but
this meant Transforms/Scalar including Transfroms/IPO headers, creating
a circular dependency. (IPO depends on Scalar already) - so move the IPO
SCCP shims out into IPO and the basic library implementation accessible
from Scalar/SCCP.h to be used from the IPO/SCCP.cpp implementation.
llvm-svn: 328250
Artem Dergachev [Thu, 22 Mar 2018 21:40:24 +0000 (21:40 +0000)]
[CFG] [analyzer] NFC: Move construction context allocation into a helper method.
Improve readability of ConstructionContext::createFromLayers().
Differential Revision: https://reviews.llvm.org/D44725
llvm-svn: 328249
Artem Dergachev [Thu, 22 Mar 2018 21:37:39 +0000 (21:37 +0000)]
[CFG] [analyzer] Add C++17-specific variable and return construction contexts.
In C++17 copy elision is mandatory for variable and return value constructors
(as long as it doesn't involve type conversion) which results in AST that does
not contain elidable constructors in their usual places. In order to provide
construction contexts in this scenario we need to cover more AST patterns.
This patch makes the CFG prepared for these scenarios by:
- Fork VariableConstructionContext and ReturnedValueConstructionContext into
two different sub-classes (each) one of which indicates the C++17 case and
contains a reference to an extra CXXBindTemporaryExpr.
- Allow CFGCXXRecordTypedCall element to accept VariableConstructionContext and
ReturnedValueConstructionContext as its context.
Differential Revision: https://reviews.llvm.org/D44597
llvm-svn: 328248
Artem Dergachev [Thu, 22 Mar 2018 21:30:58 +0000 (21:30 +0000)]
[analyzer] Make symbol_iterator iterate over SVal's symbolic base.
If a memory region (or an SVal that represents a pointer to that memory region)
is a (direct or indirect, not necessarily proper) sub-region of a SymbolicRegion
then it is said to have a symbolic base.
For now SVal::symbol_iterator explores the symbol within a symbolic region
only when the SVal represents a pointer to the symbolic region itself,
not to any of its sub-regions.
This behavior is not indended by any user of symbol_iterator; all users who
cared about such behavior were expecting the iterator to descend into the
symbolic base of an arbitrary region, find the parent symbol of the symbolic
base region, and iterate over that symbol. Lack of such behavior resulted in
bugs demonstarted by the test cases.
Hence the decision to change the API to behave more intuitively.
Differential Revision: https://reviews.llvm.org/D44347
llvm-svn: 328247
Roman Tereshin [Thu, 22 Mar 2018 21:29:07 +0000 (21:29 +0000)]
[MIR] Making MIR Printing, opt -dot-cfg, and -debug printing faster
Value::printAsOperand has been scanning the entire module just to
print a single value as an operand, regardless being asked to print a
type or not at all, and regardless really needing to scan the module
to print a type.
It made some of the users of the method exceptionally slow on large
IR-modules (or large MIR-files with large IR-modules embedded).
This patch defers scanning a module looking for struct types, mostly
numbered struct types, as much as possible, speeding up those users
w/o changing any APIs at all.
See speedup examples below:
Release Build:
# 83 seconds -> 5.5 seconds
time ./bin/llc -start-before=irtranslator -stop-after=irtranslator \
-global-isel -global-isel-abort=2 -simplify-mir sqlite3.O0.ll -o \
sqlite3.O0.ll.regbankselected.mir
# 133 seconds -> 6.2 seconds
time ./bin/opt sqlite3.O0.ll -dot-cfg -disable-output
Release + Asserts Build:
# 95 seconds -> 5.5 seconds
time ./bin/llc -start-before=irtranslator -stop-after=irtranslator \
-global-isel -global-isel-abort=2 -simplify-mir sqlite3.O0.ll -o \
sqlite3.O0.ll.regbankselected.mir
# 146 seconds -> 6.2 seconds
time ./bin/opt sqlite3.O0.ll -dot-cfg -disable-output
# 1096 seconds -> 553 seconds
time ./bin/llc -debug-only=isel -fast-isel=false -stop-after=isel \
sqlite3.O0.ll -o /dev/null 2> err
where sqlite3.O0.ll is non-optimized IR produced from
sqlite-amalgamation (http://sqlite.org/download.html), which is entire
SQLite3 implementation in a single C-file.
Benchmarked on 4-cores / 8 threads PCI-E SSD iMac running macOS
Reviewers: dexonsmith, bkramer, void, chandlerc, aditya_nandakumar, dsanders, qcolombet,
Reviewed By: bogner
Subscribers: thegameg, llvm-commits
Differential Revision: https://reviews.llvm.org/D44132
llvm-svn: 328246
Eric Fiselier [Thu, 22 Mar 2018 21:28:09 +0000 (21:28 +0000)]
Use DoNotOptimize to prevent new/delete elision.
The new/delete tests, in particular those which test replacement
functions, often fail when the optimizer is enabled because the
calls to new/delete may be optimized away, regardless of their side-effects.
This patch converts the tests to use DoNotOptimize in order to prevent
the elision.
llvm-svn: 328245
Mircea Trofin [Thu, 22 Mar 2018 21:26:52 +0000 (21:26 +0000)]
Revert "Revert "[InstrProf] Support for external functions in text format.""
Summary:
This reverts commit
364eb09576a7667bc6d3ff80c52a83014ccac976 and separates out
the portion that was fixing binary reader error propagation - turns out, there
are production cases where that causes a regression.
Will re-introduce the error propagation fix separately.
The fix to the text reader error propagation is still "in".
Reviewers: bkramer
Reviewed By: bkramer
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D44807
llvm-svn: 328244
Eric Fiselier [Thu, 22 Mar 2018 21:17:07 +0000 (21:17 +0000)]
Fix test failure on Windows caused by different underlying enumeration type rules
llvm-svn: 328243
Rafael Espindola [Thu, 22 Mar 2018 21:14:16 +0000 (21:14 +0000)]
Revert "Set dso_local on vtables."
This reverts commit r328238.
Looks like it broke some buildbots.
llvm-svn: 328242
Craig Topper [Thu, 22 Mar 2018 21:10:07 +0000 (21:10 +0000)]
[X86][SkylakeClient] Fix a bunch of instructions that were incorrectly assigned Port015 instead of Port01.
The VEC ADD and VEC MUL units aren't present on port 5 on SkylakeClient.
llvm-svn: 328241
Jessica Paquette [Thu, 22 Mar 2018 21:07:09 +0000 (21:07 +0000)]
[MachineOutliner][NFC] Refactoring + comments in runOnModule
Split up some of the if/else branches in runOnModule. Elaborate on some
comments. Replace a call to getOrCreateMachineFunction with getMachineFunction.
This makes it clearer what's happening in runOnModule, and ensures that the
outliner doesn't create any MachineFunctions which will never be used by the
outliner (or anything else, really).
llvm-svn: 328240
Vitaly Buka [Thu, 22 Mar 2018 20:42:28 +0000 (20:42 +0000)]
More OpenBSD fixes
Summary:
- Use internal_syscall_ptr in internal_readlink
- use sigcontext on OpenBSD
Patch by David CARLIER
Reviewers: krytarowski, vitalybuka
Reviewed By: vitalybuka
Subscribers: kubamracek, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D44713
llvm-svn: 328239
Rafael Espindola [Thu, 22 Mar 2018 20:33:01 +0000 (20:33 +0000)]
Set dso_local on vtables.
llvm-svn: 328238
Jun Bum Lim [Thu, 22 Mar 2018 20:06:47 +0000 (20:06 +0000)]
[CodeGen] Add a new pass for PostRA sink
Summary:
This pass sinks COPY instructions into a successor block, if the COPY is not
used in the current block and the COPY is live-in to a single successor
(i.e., doesn't require the COPY to be duplicated). This avoids executing the
the copy on paths where their results aren't needed. This also exposes
additional opportunites for dead copy elimination and shrink wrapping.
These copies were either not handled by or are inserted after the MachineSink
pass. As an example of the former case, the MachineSink pass cannot sink
COPY instructions with allocatable source registers; for AArch64 these type
of copy instructions are frequently used to move function parameters (PhyReg)
into virtual registers in the entry block..
For the machine IR below, this pass will sink %w19 in the entry into its
successor (%bb.1) because %w19 is only live-in in %bb.1.
```
%bb.0:
%wzr = SUBSWri %w1, 1
%w19 = COPY %w0
Bcc 11, %bb.2
%bb.1:
Live Ins: %w19
BL @fun
%w0 = ADDWrr %w0, %w19
RET %w0
%bb.2:
%w0 = COPY %wzr
RET %w0
```
As we sink %w19 (CSR in AArch64) into %bb.1, the shrink-wrapping pass will be
able to see %bb.0 as a candidate.
With this change I observed 12% more shrink-wrapping candidate and 13% more dead copies deleted in spec2000/2006/2017 on AArch64.
Reviewers: qcolombet, MatzeB, thegameg, mcrosier, gberry, hfinkel, john.brawn, twoh, RKSimon, sebpop, kparzysz
Reviewed By: sebpop
Subscribers: evandro, sebpop, sfertile, aemerson, mgorny, javed.absar, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D41463
llvm-svn: 328237
Matt Morehouse [Thu, 22 Mar 2018 19:50:10 +0000 (19:50 +0000)]
Document optforfuzzing attribute created in r328214.
llvm-svn: 328236
Paul Robinson [Thu, 22 Mar 2018 19:37:56 +0000 (19:37 +0000)]
[DWARF] Replace assert with diagnostic. PR36868.
llvm-svn: 328235
David Blaikie [Thu, 22 Mar 2018 19:36:54 +0000 (19:36 +0000)]
Move the initialization of the Meta Renamer pass over to IPO along with the rest of it that was moved in r328209
llvm-svn: 328234
Nirav Dave [Thu, 22 Mar 2018 19:32:07 +0000 (19:32 +0000)]
[DAG, X86] Fix ISel-time node insertion ids
As in SystemZ backend, correctly propagate node ids when inserting new
unselected nodes into the DAG during instruction Seleciton for X86
target.
Fixes PR36865.
Reviewers: jyknight, craig.topper
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D44797
llvm-svn: 328233
Aaron Smith [Thu, 22 Mar 2018 19:26:33 +0000 (19:26 +0000)]
[SymbolFilePDB] Use section contributions as another way to determine the compiland
Some PDB Symbols don't have line information. Use the section contributions to determine their compiland.
This is useful to determine the parent compiland for PDBSymbolTypeData, i.e. variables.
llvm-svn: 328232
Craig Topper [Thu, 22 Mar 2018 19:22:51 +0000 (19:22 +0000)]
[X86] Correct the scheduling data for some of the 32 and 64 bit multiplies to as best as I understand how they are implemented.
llvm-svn: 328231
Aaron Smith [Thu, 22 Mar 2018 19:21:34 +0000 (19:21 +0000)]
[SymbolFilePDB] Ignore compiler generated functions when creating the LLDB type from a PDB
llvm-svn: 328230
Eric Fiselier [Thu, 22 Mar 2018 19:18:08 +0000 (19:18 +0000)]
Un-XFAIL a test under new GCC version; the GCC bug has been fixed
llvm-svn: 328229
Andrey Churbanov [Thu, 22 Mar 2018 18:51:51 +0000 (18:51 +0000)]
Fixed __kmpc_get_target_offload() to call library initialization.
Differential Revision: https://reviews.llvm.org/D44793
llvm-svn: 328228
Daniel Neilson [Thu, 22 Mar 2018 18:36:15 +0000 (18:36 +0000)]
[InstCombineCalls] Update deprecated API usage (NFC)
Summary:
Just updating a call to MemSetInst::getAlignment() to MemSetInst::getDestAlignment(). The
former has been deprecated.
llvm-svn: 328227
Simon Pilgrim [Thu, 22 Mar 2018 18:29:16 +0000 (18:29 +0000)]
[X86][Btver2] Conversion, MaskedLoad/MaskedStore and NTStores all are scheduled through the JFPU1 pipe
llvm-svn: 328226
Marshall Clow [Thu, 22 Mar 2018 18:27:28 +0000 (18:27 +0000)]
Fix improperly failing test - and the code it was testing. Thanks to Stephan Lavavej for the catch.
llvm-svn: 328225
Rafael Espindola [Thu, 22 Mar 2018 18:03:13 +0000 (18:03 +0000)]
Set dso_local on builtin functions.
The difference between CreateRuntimeFunction and CreateBuiltinFunction
is that CreateBuiltinFunction would not set dllimport or dso_local.
To keep the current semantics, just forward to CreateRuntimeFunction
with Local=true so it doesn't add dllimport.
llvm-svn: 328224
Rafael Espindola [Thu, 22 Mar 2018 17:46:57 +0000 (17:46 +0000)]
Fix Address Size in test.
This is an i386 test, so it should be 4.
llvm-svn: 328223
Simon Pilgrim [Thu, 22 Mar 2018 17:43:12 +0000 (17:43 +0000)]
[X86][Btver2] FCMP (inc FMAX/FMIN) instructions use the JFPA functional pipe
The ymm instructions are double pumped as well.
llvm-svn: 328222
Zachary Turner [Thu, 22 Mar 2018 17:37:28 +0000 (17:37 +0000)]
[Codeview/PDB] Rename some methods for clarity.
NFC, this just renames some methods to better express what they
do, and also adds a few helper methods to add some symmetry to the
API in a few places (for example there was a getStringFromId but not
a getIdFromString method in the string table).
llvm-svn: 328221
Ben Hamilton [Thu, 22 Mar 2018 17:37:19 +0000 (17:37 +0000)]
[clang-format] Fix ObjC style guesser to also iterate over child lines
Summary:
When I wrote `ObjCHeaderStyleGuesser`, I incorrectly assumed the
correct way to iterate over all tokens in `AnnotatedLine` was to
iterate over the linked list tokens starting with
`AnnotatedLine::First`.
However, `AnnotatedLine` also contains a vector
`AnnotedLine::Children` with child `AnnotedLine`s which have their own
tokens which we need to iterate over.
Because I didn't iterate over the tokens in the children lines, the
ObjC style guesser would fail on syntax like:
#define FOO ({ NSString *s = ... })
as the statement(s) inside { ... } are child lines.
This fixes the bug and adds a test. I confirmed the test
failed before the fix, and passed after the fix.
Test Plan: New tests added. Ran tests with:
% make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests
Reviewers: djasper, jolesiak, Wizard
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D44790
llvm-svn: 328220
Gheorghe-Teodor Bercea [Thu, 22 Mar 2018 17:33:27 +0000 (17:33 +0000)]
[OpenMP][Clang] Add call to global data sharing stack initialization on the workers side
Summary: The workers also need to initialize the global stack. The call to the initialization function needs to happen after the kernel_init() function is called by the master. This ensures that the per-team data structures of the runtime have been initialized.
Reviewers: ABataev, grokos, carlo.bertolli, caomhin
Reviewed By: ABataev
Subscribers: jholewinski, guansong, cfe-commits
Differential Revision: https://reviews.llvm.org/D44749
llvm-svn: 328219
Aditya Nandakumar [Thu, 22 Mar 2018 17:31:38 +0000 (17:31 +0000)]
[GISel]: Fix incorrect IRTranslation while translating null pointer types
https://reviews.llvm.org/D44762
Currently IRTranslator produces
%vreg17<def>(p0) = G_CONSTANT 0;
instead we should build
%vreg16(s64) = G_CONSTANT 0
%vreg17(p0) = G_INTTOPTR %vreg16
reviewed by @aemerson.
llvm-svn: 328218
Simon Pilgrim [Thu, 22 Mar 2018 17:25:38 +0000 (17:25 +0000)]
[X86][Btver2] FMUL ymm instructions are double pumped on the JFPM functional pipe
llvm-svn: 328217
Craig Topper [Thu, 22 Mar 2018 17:17:47 +0000 (17:17 +0000)]
[ARM] Enable the full InstRW overlap check for ARMScheduleR52.td
This fixes a few issues with the R52 instregexs to enable the full overlap checking
Differential Revision: https://reviews.llvm.org/D44767
llvm-svn: 328216
Rafael Espindola [Thu, 22 Mar 2018 17:14:41 +0000 (17:14 +0000)]
Make the debug info in some tests more realistic.
Currently lld just parses the .debug_line section assuming that there
is only one compile unit. That assumption is false (PR36793).
I have a patch that changes lld to iterate over the compile units and
parse the portions of the .debug_line they point to (which fixes
PR36793).
A problem is that we will then need a compiler unit pointing to
.debug_line for lld to see it.
It seems like bfd has the same restriction.
This patch updates existing tests to add a minimal compile unit so
that they still work with PR36793 fixed.
llvm-svn: 328215
Matt Morehouse [Thu, 22 Mar 2018 17:07:51 +0000 (17:07 +0000)]
[SimplifyCFG] Create attribute for fuzzing-specific optimizations.
Summary:
When building with libFuzzer, converting control flow to selects or
obscuring the original operands of CMPs reduces the effectiveness of
libFuzzer's heuristics.
This patch provides an attribute to disable or modify certain optimizations
for optimal fuzzing signal.
Provides a less aggressive alternative to https://reviews.llvm.org/D44057.
Reviewers: vitalybuka, davide, arsenm, hfinkel
Reviewed By: vitalybuka
Subscribers: junbuml, mehdi_amini, wdng, javed.absar, hiraditya, llvm-commits, kcc
Differential Revision: https://reviews.llvm.org/D44232
llvm-svn: 328214
Artem Belevich [Thu, 22 Mar 2018 16:47:41 +0000 (16:47 +0000)]
[CUDA] add REQUIRES fields for CUDA variants of LTO tests.
Also relax checking for nvptx triple. This should avoid test failure if
the test is executed on 32-bit platform.
llvm-svn: 328213
Alexey Bataev [Thu, 22 Mar 2018 16:43:21 +0000 (16:43 +0000)]
[DWARF] Add EmitDwarfOffset function, NFC.
Added EmitDwarfOffset function after discussion with Eric Christofer.
llvm-svn: 328212
Saleem Abdulrasool [Thu, 22 Mar 2018 16:39:54 +0000 (16:39 +0000)]
vim: rename `singlethread` to `syncscope`
SVN r307722 renamed the keyword from `singlethread` to `syncscope`.
Update the syntax file accordingly.
llvm-svn: 328211
Anna Thomas [Thu, 22 Mar 2018 16:03:59 +0000 (16:03 +0000)]
[LoopPredication] Add profitability check based on BPI
Summary:
LoopPredication is not profitable when the loop is known to always exit
through some block other than the latch block.
A coarse grained latch check can cause loop predication to predicate the
loop, and unconditionally deoptimize.
However, without predicating the loop, the guard may never fail within the
loop during the dynamic execution because the non-latch loop termination
condition exits the loop before the latch condition causes the loop to
exit.
We teach LP about this using BranchProfileInfo pass.
Reviewers: apilipenko, skatkov, mkazantsev, reames
Reviewed by: skatkov
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D44667
llvm-svn: 328210
David Blaikie [Thu, 22 Mar 2018 15:57:47 +0000 (15:57 +0000)]
Move MetaRenamer from Transforms/UTils to Transforms/IPO since it implements part of IPO.h
llvm-svn: 328209
Paul Robinson [Thu, 22 Mar 2018 15:48:01 +0000 (15:48 +0000)]
[DWARF] Fix mixing assembler -g with DWARF .file directives.
We were effectively overriding an explicit '.file' directive with info
for the assembler source. That shouldn't happen.
Fixes PR36636, really, even for .s files emitted by Clang.
Differential Revision: https://reviews.llvm.org/D44265
llvm-svn: 328208
Benjamin Kramer [Thu, 22 Mar 2018 15:29:55 +0000 (15:29 +0000)]
Revert "[InstrProf] Support for external functions in text format."
This reverts commit r328132. Breaks FDO selfhost. I'm seeing
error: /tmp/profraw: Invalid instrumentation profile data (bad magic)
llvm-svn: 328207
Florian Hahn [Thu, 22 Mar 2018 15:23:33 +0000 (15:23 +0000)]
[CallSiteSplitting] Preserve DominatorTreeAnalysis.
The dominator tree analysis can be preserved easily.
Some other kinds of analysis can probably be preserved
too.
Reviewers: junbuml, dberlin
Reviewed By: dberlin
Differential Revision: https://reviews.llvm.org/D43173
llvm-svn: 328206
Sanjay Patel [Thu, 22 Mar 2018 15:23:21 +0000 (15:23 +0000)]
[MC] fix documentation comments; NFC
llvm-svn: 328205
Kostya Kortchinsky [Thu, 22 Mar 2018 15:04:31 +0000 (15:04 +0000)]
[sanitizer] Split coverage into separate RT in sanitizer_common
Summary:
`sanitizer_common`'s coverage support is fairly well separated, and libcdep by
default. Several sanitizers don't make use of coverage, and as far as I can
tell do no benefit from the extra dependencies pulled in by the coverage public
interface functions.
The following sanitizers call `InitializeCoverage` explicitely: MSan, ASan,
LSan, HWAsan, UBSan. On top of this, any sanitizer bundling RTUBSan should
add the coverage RT as well: ASan, Scudo, UBSan, CFI (diag), TSan, MSan, HWAsan.
So in the end the following have no need: DFSan, ESan, CFI, SafeStack (nolibc
anyway), XRay, and the upcoming Scudo minimal runtime.
I tested this with all the sanitizers check-* with gcc & clang, and in
standalone on Linux & Android, and there was no issue. I couldn't test this on
Mac, Fuchsia, BSDs, & Windows for lack of an environment, so adding a bunch of
people for additional scrunity. I couldn't test HWAsan either.
Reviewers: eugenis, vitalybuka, alekseyshl, flowerhack, kubamracek, dberris, rnk, krytarowski
Reviewed By: vitalybuka, alekseyshl, flowerhack, dberris
Subscribers: mgorny, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D44701
llvm-svn: 328204
Simon Pilgrim [Thu, 22 Mar 2018 14:56:18 +0000 (14:56 +0000)]
[X86][SSE42] Use the default PCMPEST/PCMPIST scheduler classes directly. NFCI.
Models were completely overriding all SSE42 strins instructions when the default classes could be used for exactly the same coverage.
llvm-svn: 328203
Pavel Labath [Thu, 22 Mar 2018 14:50:44 +0000 (14:50 +0000)]
DWARFVerifier: verify debug_names abbreviation table
Summary:
This commit adds checks of the abbreviation table in a DWARF v5 Name
Index. The most interesting/useful check is the one which checks that
each index attributes is encoded using the correct form class, but it
also checks for the more obvious errors like unknown
forms/tags/attributes and duplicated attributes.
Reviewers: JDevlieghere, aprantl, dblaikie
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D44736
llvm-svn: 328202
Daniel Jasper [Thu, 22 Mar 2018 14:43:54 +0000 (14:43 +0000)]
clang-format: Narrow down raw string literal line break exception.
For multiline raw string literals, we generally want to respect the
author's choice of linebreak before the 'R"(' as the rest of the raw
string might be aligned to it and we cannot (commonly) modify the
content.
For single-line raw string literals, this doesn't make any sense and so
we should just treat them as regular string literals in this regard.
llvm-svn: 328201
Daniel Jasper [Thu, 22 Mar 2018 14:30:28 +0000 (14:30 +0000)]
clang-format: Fix SpacesInParentheses with fully qualified names.
When SpacesInParentheses is set to true clang-format does not add a
space before fully qualified names. For example:
do_something(::globalVar );
Fix by Darby Payne. Thank you!
llvm-svn: 328200
Alexander Kornienko [Thu, 22 Mar 2018 14:18:20 +0000 (14:18 +0000)]
clang-tidy, modularize: return non-zero exit code on errors
When no inputs given, the tools should not only produce the help message, but
also return a non-zero exit code. Fixed tests accordingly.
llvm-svn: 328199
Andrea Di Biagio [Thu, 22 Mar 2018 14:14:49 +0000 (14:14 +0000)]
[llvm-mca] Minor refactoring. NFCI
Also, removed a couple of unused methods from class Instruction.
llvm-svn: 328198
Sanjay Patel [Thu, 22 Mar 2018 14:08:16 +0000 (14:08 +0000)]
[InstCombine] add folds for xor-of-icmp signbit tests (PR36682)
This is a retry of r328119 which was reverted at r328145 because
it could crash by trying to combine icmps with different operand
types. This version has a check for that and additional tests.
Original commit message:
This is part of solving:
https://bugs.llvm.org/show_bug.cgi?id=36682
There's also a leftover improvement from the long-ago-closed:
https://bugs.llvm.org/show_bug.cgi?id=5438
https://rise4fun.com/Alive/dC1
llvm-svn: 328197
Jonas Devlieghere [Thu, 22 Mar 2018 13:53:30 +0000 (13:53 +0000)]
[CodeGen] Emit DWARF "constructor" calling convention
Now that LLVM has support for emitting calling conventions in DWARF (see
r328191) have clang emit them.
Patch by: Adrien Guinet
Differential revision: https://reviews.llvm.org/D42351
llvm-svn: 328196
George Rimar [Thu, 22 Mar 2018 13:47:56 +0000 (13:47 +0000)]
[ELF] - Apply clang-format. NFC.
llvm-svn: 328195
Simon Pilgrim [Thu, 22 Mar 2018 13:37:30 +0000 (13:37 +0000)]
[X86][CLMUL] Use the default CLMUL scheduler classes directly. NFCI.
Models were completely overriding all CLMUL instructions when the WriteCLMUL default classes could be used for exactly the same coverage.
llvm-svn: 328194
Simon Pilgrim [Thu, 22 Mar 2018 13:36:06 +0000 (13:36 +0000)]
[X86][CLMUL] Fix/add missing itinerary tags to (V)PCLMULQDQ instructions
PCLMULQDQrm was using the rr itinerary.
Difference in itineraries between PCLMULQDQ/VPCLMULQDQ variants was causing an unnecessary duplication of scheduler class entries.
llvm-svn: 328193
Simon Pilgrim [Thu, 22 Mar 2018 13:18:08 +0000 (13:18 +0000)]
[X86] Use the default AES scheduler classes directly. NFCI.
Models were completely overriding all AES instructions when the WriteAES default classes could be used for exactly the same coverage.
Removes 6 unnecessary scheduler classes from every model.
Note: Still looking for a way for tblgen to warn when this is happening - often the override is more complete than the default.
llvm-svn: 328192
Jonas Devlieghere [Thu, 22 Mar 2018 12:24:07 +0000 (12:24 +0000)]
Add vendor specific calling convention to DWARF
This patch adds LLVM's and GCC's calling conventions so they can be
emitted in the DWARF debug info.
Patch by: Adrien Guinet
Differential revision: https://reviews.llvm.org/D42350
llvm-svn: 328191
Andrea Di Biagio [Thu, 22 Mar 2018 11:39:34 +0000 (11:39 +0000)]
[llvm-mca] Simplify (and better standardize) the Instruction interface.
llvm-svn: 328190
Florian Hahn [Thu, 22 Mar 2018 11:38:53 +0000 (11:38 +0000)]
[CloneFunction] Preserve DT in DuplicateInstructionsInSplitBetween.
DuplicateInstructionsInSplitBetween can preserve the DT by passing
through DT to SplitEdge.
Reviewers: sanjoy, junbuml, anna, kuhar
Reviewed By: kuhar
Differential Revision: https://reviews.llvm.org/D44629
llvm-svn: 328189
Jonas Devlieghere [Thu, 22 Mar 2018 10:34:06 +0000 (10:34 +0000)]
Revert "[test] Add tests for llc passes pipelines."
This reverts r328159 because the two AArch64 tests fail on GreenDragon:
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/11030/
llvm-svn: 328188
Andrea Di Biagio [Thu, 22 Mar 2018 10:19:20 +0000 (10:19 +0000)]
[llvm-mca] Simplify code. NFC
llvm-svn: 328187
Eric Fiselier [Thu, 22 Mar 2018 07:53:47 +0000 (07:53 +0000)]
commit temporary workaround for new Clang exception warning
llvm-svn: 328186
Eric Fiselier [Thu, 22 Mar 2018 06:21:07 +0000 (06:21 +0000)]
Correct TEST_HAS_NO_ALIGNED_ALLOCATION macro definition
llvm-svn: 328185
Craig Topper [Thu, 22 Mar 2018 06:15:10 +0000 (06:15 +0000)]
[TableGen] Use empty emplace_back to add defaulted constructed objects to vectors to avoid using resize(size()+1). NFC
llvm-svn: 328184
Craig Topper [Thu, 22 Mar 2018 06:15:08 +0000 (06:15 +0000)]
[TableGen] Add a non-default constructor to CodeGenSchedClass and use it via emplace_back to create new SchedClasses instead of using resize(size+1)
llvm-svn: 328183
Eric Fiselier [Thu, 22 Mar 2018 05:44:48 +0000 (05:44 +0000)]
Fix dynarray test failures after changing __libcpp_allocate/deallocate
llvm-svn: 328182
Craig Topper [Thu, 22 Mar 2018 04:52:08 +0000 (04:52 +0000)]
[X86] Remove unused SchedWriteRes classes. NFC
llvm-svn: 328181
Eric Fiselier [Thu, 22 Mar 2018 04:42:56 +0000 (04:42 +0000)]
Fix PR22634 - std::allocator doesn't respect over-aligned types.
This patch fixes std::allocator, and more specifically, all users
of __libcpp_allocate and __libcpp_deallocate, to support over-aligned
types.
__libcpp_allocate/deallocate now take an alignment parameter, and when
the specified alignment is greater than that supported by malloc/new,
the aligned version of operator new is called (assuming it's available).
When aligned new isn't available, the old behavior has been kept, and the
alignment parameter is ignored.
This patch depends on recent changes to __builtin_operator_new/delete which
allow them to be used to call any regular new/delete operator. By using
__builtin_operator_new/delete when possible, the new/delete erasure optimization
is maintained.
llvm-svn: 328180
Craig Topper [Thu, 22 Mar 2018 04:23:41 +0000 (04:23 +0000)]
[X86][Skylake] Merge multiple InstrRW entries that map to the same SchedWriteRes group (NFCI) (PR35955)
I've also merged some VEX/non-VEX instregex strings with a (V?) prefix or (Y?) ymm variant - there are still a lot more of these to do.
This reduces the size of the optimized llc binary on my computer by 400K. Presumably because we went from 5000+ scheduler classes per CPU to ~2000.
llvm-svn: 328179
Aaron Smith [Thu, 22 Mar 2018 04:08:15 +0000 (04:08 +0000)]
[DIA] Add IPDBSectionContrib interfaces and DIA implementation
To resolve symbol context at a particular address, we need to
determine the compiland for the address. We are able to determine
the parent compiland of PDBSymbolFunc, PDBSymbolTypeUDT,
PDBSymbolTypeEnum symbols indirectly through line information.
However no such information is availabile for PDBSymbolData,
i.e. variables.
The Section Contribution table from PDBs has information about
each compiland's contribution to sections by address. For example,
a piece of a contribution looks like,
VA RelativeVA Sect No. Offset Length Compiland
14000087B0 000087B0 0001
000077B0 000000BB exe_main.obj
So given an address, it's possible to determine its compiland with
this information.
llvm-svn: 328178
Aaron Smith [Thu, 22 Mar 2018 03:57:06 +0000 (03:57 +0000)]
[PDB] Get more DIA table enumerators
Rename the original function and make it a static template.
llvm-svn: 328177
Aaron Smith [Thu, 22 Mar 2018 03:44:51 +0000 (03:44 +0000)]
[SymbolFilePDB] Run clang-format; NFC
llvm-svn: 328176
Ben Hamilton [Thu, 22 Mar 2018 03:25:22 +0000 (03:25 +0000)]
[clang-format] Add a few more Core Graphics identifiers to ObjC heuristic
Summary:
We received reports of the Objective-C style guesser getting a false
negative on header files like:
CGSize SizeOfThing(MyThing thing);
This adds more Core Graphics identifiers to the Objective-C style
guesser.
Test Plan: New tests added. Ran tests with:
% make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests
Reviewers: jolesiak, djasper
Reviewed By: jolesiak, djasper
Subscribers: krasimir, klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D44632
llvm-svn: 328175
Ben Hamilton [Thu, 22 Mar 2018 03:23:53 +0000 (03:23 +0000)]
[clang-format] Don't insert space between r_paren and 'new' in ObjC decl
Summary:
Previously, clang-format would insert a space between
the closing parenthesis and 'new' in the following valid Objective-C
declaration:
+ (instancetype)new;
This was because 'new' is treated as a keyword, not an identifier.
TokenAnnotator::spaceRequiredBefore() already handled the case where
r_paren came before an identifier, so this diff extends it to
handle r_paren before 'new'.
Test Plan: New tests added. Ran tests with:
% make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests
Reviewers: djasper, jolesiak, stephanemoore
Reviewed By: djasper, jolesiak, stephanemoore
Subscribers: stephanemoore, klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D44692
llvm-svn: 328174
Robert Widmann [Thu, 22 Mar 2018 03:16:23 +0000 (03:16 +0000)]
Improve -Winfinite-recursion
Summary: Rewrites -Winfinite-recursion to remove the state dictionary and explore paths in loops - especially infinite loops. The new check now detects recursion in loop bodies dominated by a recursive call.
Reviewers: rsmith, rtrieu
Reviewed By: rtrieu
Subscribers: lebedev.ri, cfe-commits
Differential Revision: https://reviews.llvm.org/D43737
llvm-svn: 328173
Julie Hockett [Thu, 22 Mar 2018 02:05:51 +0000 (02:05 +0000)]
Revert "[clang-doc] Reland "[clang-doc] Setup clang-doc frontend framework""
This reverts commit r328150 until we can fix the test that are failing
on the Windows release build.
llvm-svn: 328172
Eugene Zelenko [Thu, 22 Mar 2018 00:53:26 +0000 (00:53 +0000)]
[Frontend] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 328171
Saleem Abdulrasool [Wed, 21 Mar 2018 23:46:09 +0000 (23:46 +0000)]
vim: add `dso_local` and `dso_preemptable` keywords
Support the new keywords introduced in SVN r316668.
llvm-svn: 328170
David Blaikie [Wed, 21 Mar 2018 23:21:10 +0000 (23:21 +0000)]
Update for LLVM header movement
llvm-svn: 328169
Rafael Espindola [Wed, 21 Mar 2018 23:01:10 +0000 (23:01 +0000)]
Make test a bit less strict. NFC.
llvm-svn: 328168
Michael Zolotukhin [Wed, 21 Mar 2018 22:57:33 +0000 (22:57 +0000)]
[test] Try to unbreak hexagon bots after r328160.
llvm-svn: 328167
David Blaikie [Wed, 21 Mar 2018 22:34:27 +0000 (22:34 +0000)]
Fix for LLVM change (Transforms/Utils/Local.h -> Analysis/Utils/Local.h)
llvm-svn: 328166
David Blaikie [Wed, 21 Mar 2018 22:34:23 +0000 (22:34 +0000)]
Fix a couple of layering violations in Transforms
Remove #include of Transforms/Scalar.h from Transform/Utils to fix layering.
Transforms depends on Transforms/Utils, not the other way around. So
remove the header and the "createStripGCRelocatesPass" function
declaration (& definition) that is unused and motivated this dependency.
Move Transforms/Utils/Local.h into Analysis because it's used by
Analysis/MemoryBuiltins.cpp.
llvm-svn: 328165
Rafael Espindola [Wed, 21 Mar 2018 22:32:17 +0000 (22:32 +0000)]
Replace a std::pair with a struct.
This is more readable and should reduce the noise in a followup patch.
llvm-svn: 328164
Mircea Trofin [Wed, 21 Mar 2018 22:27:31 +0000 (22:27 +0000)]
[InstrProf] Encapsulates access to AddrToMD5Map.
Summary:
This fixes a unittest failure introduced by D44717
D44717 introduced lazy sorting of the internal data structures of the
symbol table. The AddrToMD5Map getter was potentially exposing
inconsistent (unsorted) state. We could sort in the accessor, however,
a client may store the pointer and thus bypass the internal state
management of the symbol table. The alternative in this CL blocks
direct access to the state, thus ensuring consistent
externally-observable state.
Reviewers: davidxl, xur, eraman
Reviewed By: xur
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D44757
llvm-svn: 328163
Zachary Turner [Wed, 21 Mar 2018 22:23:59 +0000 (22:23 +0000)]
[PDB] Don't ignore bucket 0 when writing the PDB string table.
The hash table is a list of buckets, and the *value* stored in
the bucket cannot be 0 since that is reserved. However, the code
here was incorrectly skipping over the 0'th bucket entirely.
The 0'th bucket is perfectly fine, just none of these buckets
can contain the value 0.
As a result, whenever there was a string where hash(S) % Size
was equal to 0, we would write the value in the next bucket
instead. We never caught this in our tests due to *another*
bug, which is that we would iterate the entire list of buckets
looking for the value, only using the hash value as a starting
point. However, the real algorithm stops when it finds 0 in
a bucket since it takes that to mean "the item is not in the
hash table".
The unit test is updated to carefully construct a set of hash
values that will cause one item to hash to 0 mod bucket count,
and the reader is also updated to return an error indicating that
the item is not found when it encounters a 0 bucket.
llvm-svn: 328162
Artem Belevich [Wed, 21 Mar 2018 22:22:59 +0000 (22:22 +0000)]
[CUDA] Disable LTO for device-side compilations.
This fixes host-side LTO during CUDA compilation. Before, LTO
pipeline construction was clashing with CUDA pipeline construction.
At the moment there's no point doing LTO on device side as each
device-side TU is a complete program. We will need to figure out
compilation pipeline construction for the device-side LTO when we
have working support for multi-TU device-side CUDA compilation.
Differential Revision: https://reviews.llvm.org/D44691
llvm-svn: 328161
Michael Zolotukhin [Wed, 21 Mar 2018 22:17:31 +0000 (22:17 +0000)]
[test] Add tests for opt passes pipelines for O0, O2, O3, and Os.
llvm-svn: 328160
Michael Zolotukhin [Wed, 21 Mar 2018 22:17:13 +0000 (22:17 +0000)]
[test] Add tests for llc passes pipelines.
This is basically an extension of existing test
test/CodeGen/X86/O0-pipeline.ll introduced in r302608.
llvm-svn: 328159
Artem Belevich [Wed, 21 Mar 2018 21:55:02 +0000 (21:55 +0000)]
[NVPTX] Make tensor shape part of WMMA intrinsic's name.
This is needed for the upcoming implementation of the
new 8x32x16 and 32x8x16 variants of WMMA instructions
introduced in CUDA 9.1.
Differential Revision: https://reviews.llvm.org/D44719
llvm-svn: 328158
Reid Kleckner [Wed, 21 Mar 2018 21:51:53 +0000 (21:51 +0000)]
[llvm-profdata] Use "-o /dev/null" in invalid-profdata.test
Lit automatically rewrites /dev/null to a temp file on Windows.
llvm-svn: 328157
Reid Kleckner [Wed, 21 Mar 2018 21:47:26 +0000 (21:47 +0000)]
[PDB] Remove unused private variable, re-applying r327900 after relanding more natvis changes[4~
llvm-svn: 328156
Reid Kleckner [Wed, 21 Mar 2018 21:46:47 +0000 (21:46 +0000)]
[WebAssembly] Really disable wasm register name matcher
The "ShouldEmitMatchRegisterName" bit wasn't taking effect because the
WebAssembly target didn't point to the custom WebAssemblyAsmParser
record.
llvm-svn: 328155
Rafael Espindola [Wed, 21 Mar 2018 21:31:25 +0000 (21:31 +0000)]
Handle abbr_offset with relocations.
This is mostly just plumbing to get a DWARFDataExtractor where we
compute abbr_offset so we can use getRelocatedValue.
This is part of PR36793.
llvm-svn: 328154
Volodymyr Sapsai [Wed, 21 Mar 2018 21:28:54 +0000 (21:28 +0000)]
[Modules] Fix creating fake definition data for lambdas.
During reading C++ definition data for lambda we can access
CXXRecordDecl representing lambda before we finished reading the
definition data. This can happen by reading a captured variable which is
VarDecl, then reading its decl context which is CXXMethodDecl `operator()`,
then trying to merge redeclarable methods and accessing
enclosing CXXRecordDecl. The call stack looks roughly like
VisitCXXRecordDecl
ReadCXXRecordDefinition
VisitVarDecl
VisitCXXMethodDecl
mergeRedeclarable
getPrimaryContextForMerging
If we add fake definition data at this point, later we'll hit the assertion
Assertion failed: (!DD.IsLambda && !MergeDD.IsLambda && "faked up lambda definition?"), function MergeDefinitionData, file clang/lib/Serialization/ASTReaderDecl.cpp, line 1675.
The fix is to assign definition data before reading it. Fixes PR32556.
rdar://problem/
37461072
Reviewers: rsmith, bruno
Reviewed By: rsmith
Subscribers: cfe-commits, jkorous-apple, aprantl
Differential Revision: https://reviews.llvm.org/D43494
llvm-svn: 328153
Sanjay Patel [Wed, 21 Mar 2018 21:28:19 +0000 (21:28 +0000)]
[InstCombine] move/add tests for fmul distribution; NFC
There are at least 3 problems:
1. We're distributing across large patterns, but fail to do that for the minimal patterns.
2. We're not checking uses, so we may create more instructions than we eliminate.
3. We should be able to do these transforms with less than full 'fast' fmuls.
llvm-svn: 328152
Vitaly Buka [Wed, 21 Mar 2018 21:25:07 +0000 (21:25 +0000)]
Mmap interceptor new option, Write Exec runtime detector
Summary:
Following-up the refactoring of mmap interceptors, adding a new common
option to detect PROT_WRITE|PROT_EXEC pages request.
Patch by David CARLIER
Reviewers: vitalybuka, vsk
Reviewed By: vitalybuka
Subscribers: krytarowski, #sanitizers
Differential Revision: https://reviews.llvm.org/D44194
llvm-svn: 328151