Nick Lewycky [Sat, 29 Apr 2017 00:07:27 +0000 (00:07 +0000)]
ObjCBoxedExpr can't be evaluated by the constant expression evaluator.
A boxed expression evaluates its subexpr and then calls an objc method to transform it into another value with pointer type. The objc method can never be constexpr and therefore this expression can never be evaluated. Fixes a miscompile boxing expressions with side-effects.
Also make ObjCBoxedExpr handling a normal part of the expression evaluator instead of being the only case besides full-expression where we check for integer overflow.
llvm-svn: 301721
Zachary Turner [Sat, 29 Apr 2017 00:03:32 +0000 (00:03 +0000)]
[llvm-readobj] Fix incorrect printing of CV column info.
llvm-svn: 301720
Duncan P. N. Exon Smith [Fri, 28 Apr 2017 23:59:53 +0000 (23:59 +0000)]
Fuzzer: Mark test/cxxstring.test UNSUPPORTED: windows
This has been mysteriously failing since r301593, which cleaned up the
types of things like size_t and SIZE_MAX for freestanding targets. Reid
and Kostya suggested marking it as UNSUPPORTED on windows, given that no
one has been able to reproduce locally.
llvm-svn: 301719
Zachary Turner [Fri, 28 Apr 2017 23:41:36 +0000 (23:41 +0000)]
[llvm-readobj] Use LLVMDebugInfoCodeView to parse line tables.
The llvm-readobj parsing code currently exists in our CodeView
library, so we use that to parse instead of re-writing the logic
in the tool.
llvm-svn: 301718
Zachary Turner [Fri, 28 Apr 2017 23:29:33 +0000 (23:29 +0000)]
[Support] Provide unsafe random access for VarStreamArray.
llvm-svn: 301716
Rui Ueyama [Fri, 28 Apr 2017 23:29:15 +0000 (23:29 +0000)]
Replace PrettyPrinter class in MapFile.cpp with a few non-member functions.
Since the output format has been simplified, the class to print
out a map file doesn't seem to be needed anymore. We can replace
it with a few non-member functions.
llvm-svn: 301715
Sanjay Patel [Fri, 28 Apr 2017 23:14:33 +0000 (23:14 +0000)]
[InstCombine] add tests to show potentially bogus application of DeMorgan (NFC)
llvm-svn: 301714
Hans Wennborg [Fri, 28 Apr 2017 23:11:16 +0000 (23:11 +0000)]
Remove set but unused variable in BitcodeReader.cpp. NFC.
llvm-svn: 301713
Hans Wennborg [Fri, 28 Apr 2017 23:01:32 +0000 (23:01 +0000)]
Revert r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList"
This broke the Clang build. (Clang-side patch missing?)
Original commit message:
> [IR] Make add/remove Attributes use AttrBuilder instead of
> AttributeList
>
> This change cleans up call sites and avoids creating temporary
> AttributeList objects.
>
> NFC
llvm-svn: 301712
Matt Arsenault [Fri, 28 Apr 2017 22:52:41 +0000 (22:52 +0000)]
InferAddressSpaces: Search constant expressions for addrspacecasts
These are pretty common when using local memory, and the 64-bit generic
addressing is much more expensive to compute.
llvm-svn: 301711
Rui Ueyama [Fri, 28 Apr 2017 22:46:55 +0000 (22:46 +0000)]
Eliminate .debug_gnu_pub{names,types} if -gdb-index is given.
This patch is to ignore .debug_gnu_pub{names,types} sections if the
-gdb-index option was given.
Differential Revision: https://reviews.llvm.org/D32662
llvm-svn: 301710
Rui Ueyama [Fri, 28 Apr 2017 22:40:58 +0000 (22:40 +0000)]
Revert r301678: Remove LinkerScript::flush.
This reverts commit r301678 since that change significantly slowed
down the linker. Before this patch, LLD could link clang in 8 seconds,
but with this patch it took 40 seconds.
llvm-svn: 301709
Adrian Prantl [Fri, 28 Apr 2017 22:25:53 +0000 (22:25 +0000)]
Adapt to LLVM API change (DINamespace no longer takes line/file info).
rdar://problem/
17484998
https://reviews.llvm.org/D32648
llvm-svn: 301707
Adrian Prantl [Fri, 28 Apr 2017 22:25:46 +0000 (22:25 +0000)]
Remove line and file from DINamespace.
Fixes the issue highlighted in
http://lists.llvm.org/pipermail/cfe-dev/2014-June/037500.html.
The DW_AT_decl_file and DW_AT_decl_line attributes on namespaces can
prevent LLVM from uniquing types that are in the same namespace. They
also don't carry any meaningful information.
rdar://problem/
17484998
Differential Revision: https://reviews.llvm.org/D32648
llvm-svn: 301706
Matt Arsenault [Fri, 28 Apr 2017 22:18:19 +0000 (22:18 +0000)]
InferAddressSpaces: Avoid looking up deleted values
While looking at pure addressing expressions, it's possible
for the value to appear later in Postorder.
I haven't been able to come up with a testcase where this
exhibits an actual issue, but if you insert a dump before
the value map lookup, a few testcases crash.
llvm-svn: 301705
Matt Arsenault [Fri, 28 Apr 2017 22:18:08 +0000 (22:18 +0000)]
InferAddressSpaces: Infer from just addrspacecasts
Eliminates some more cases where some subset of the addressing
computation remains flat. Some cases with addrspacecasts
in nested constant expressions are still left behind however.
llvm-svn: 301704
Michael Zolotukhin [Fri, 28 Apr 2017 22:14:27 +0000 (22:14 +0000)]
[SCEV] Use early exit in createAddRecFromPHI. NFC.
llvm-svn: 301703
Daniel Berlin [Fri, 28 Apr 2017 22:05:55 +0000 (22:05 +0000)]
LoopRotate: Fix use after scope bug
llvm-svn: 301702
Richard Trieu [Fri, 28 Apr 2017 22:03:28 +0000 (22:03 +0000)]
[ODRHash] Add testcase with different paramter names. NFC
llvm-svn: 301701
Krzysztof Parzyszek [Fri, 28 Apr 2017 21:57:53 +0000 (21:57 +0000)]
[RDF] Correctly calculate lane masks for defs
llvm-svn: 301700
Krzysztof Parzyszek [Fri, 28 Apr 2017 21:56:33 +0000 (21:56 +0000)]
Properly handle PHIs with subregisters in UnreachableBlockElim
When a PHI operand has a subregister, create a COPY instead of simply
replacing the PHI output with the input it.
Differential Revision: https://reviews.llvm.org/D32650
llvm-svn: 301699
Krzysztof Parzyszek [Fri, 28 Apr 2017 21:54:11 +0000 (21:54 +0000)]
[Hexagon] Do not move a block if it is on a fall-through path
llvm-svn: 301698
Reid Kleckner [Fri, 28 Apr 2017 21:48:28 +0000 (21:48 +0000)]
[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList
This change cleans up call sites and avoids creating temporary
AttributeList objects.
NFC
llvm-svn: 301697
Craig Topper [Fri, 28 Apr 2017 21:48:09 +0000 (21:48 +0000)]
[ConstantRange] Use APInt::isNullValue rather than APInt::isMinValue where it would make more sense to thing of 0 as 0 rather than the minimum unsigned value. NFC
llvm-svn: 301696
Craig Topper [Fri, 28 Apr 2017 21:48:06 +0000 (21:48 +0000)]
[APInt] Add an isNullValue method to check for all bits being zero. Use it in a couple internal methods where it makes more sense than isMinValue or !getBoolValue. NFC
I used Null rather than Zero to match the getNullValue method name.
There are some other places outside APInt where isNullValue would be more readable than isMinValue even though they do the same thing. I'll update those in future patches.
llvm-svn: 301695
Craig Topper [Fri, 28 Apr 2017 21:48:03 +0000 (21:48 +0000)]
[ConstantRange] Use const references to prevent a couple APInt copies. NFC
llvm-svn: 301694
Hans Wennborg [Fri, 28 Apr 2017 21:35:02 +0000 (21:35 +0000)]
Flush output in log()
This change was motivated by output from lld-link.exe and link.exe
getting intermixed. There's already a flush() call in message(), so
there's precedence.
llvm-svn: 301693
Davide Italiano [Fri, 28 Apr 2017 21:30:50 +0000 (21:30 +0000)]
[LoopUnswitch] Make DEBUG output more readable.
While debugging a miscompile I realized loopunswitch doesn't
put newlines when printing the instruction being replacement.
Ending up with a single line with many instruction replaced isn't
the best for readability and/or mental sanity.
llvm-svn: 301692
Rafael Espindola [Fri, 28 Apr 2017 21:23:43 +0000 (21:23 +0000)]
Rename one of the variables to avoid confusion.
llvm-svn: 301691
Sam Clegg [Fri, 28 Apr 2017 21:22:38 +0000 (21:22 +0000)]
[WebAssembly] Add size of section header to data relocation offsets.
Also, add test for data relocations and fix addend to
be signed.
Subscribers: jfb, dschuff
Differential Revision: https://reviews.llvm.org/D32513
llvm-svn: 301690
Tobias Grosser [Fri, 28 Apr 2017 21:16:29 +0000 (21:16 +0000)]
[tests] Ensure all test cases use named variables
This makes it easier to read and possibly even modify the test cases, as there
is no need to keep the variable increment in steps of one. More importantly, by
using explicit variable names we do not need to rely on the implicit numbering
of statements when dumping the scop information.
This makes it easier to read and possibly even modify the test cases.
Furthermore, by using explicit variables we do not need to rely on the implicit
numbering of statements when dumping the scop information. In a future commit,
this implicit numbering will likely not be used any more to refer to LLVM-IR
values as it is very expensive to construct.
llvm-svn: 301689
Matt Arsenault [Fri, 28 Apr 2017 21:13:09 +0000 (21:13 +0000)]
[ValueTracking] Teach isSafeToSpeculativelyExecute() about the speculatable attribute
Patch by Tom Stellard
llvm-svn: 301688
Sam Clegg [Fri, 28 Apr 2017 21:12:09 +0000 (21:12 +0000)]
[WebAssembly] Write initial memory in pages not bytes
Subscribers: jfb, dschuff
Differential Revision: https://reviews.llvm.org/D32660
llvm-svn: 301687
Tim Hammerquist [Fri, 28 Apr 2017 21:03:18 +0000 (21:03 +0000)]
Public headers need to be public.
llvm-svn: 301686
Matt Arsenault [Fri, 28 Apr 2017 21:01:46 +0000 (21:01 +0000)]
TableGen: Add IntrHasSideEffects property for intrinsics
The IntrNoMem, IntrReadMem, IntrWriteMem, and IntrArgMemOnly intrinsic
properties differ from their corresponding LLVM IR attributes by specifying
that the intrinsic, in addition to its memory properties, has no other side
effects.
The IntrHasSideEffects flag used in combination with one of the memory flags
listed above, makes it possible to define an intrinsic such that its
properties at the CodeGen layer match its properties at the IR layer.
Patch by Tom Stellard
llvm-svn: 301685
David Blaikie [Fri, 28 Apr 2017 20:50:25 +0000 (20:50 +0000)]
Enable -fno-split-dwarf-inlining even when -gsplit-dwarf isn't specified.
Since -gsplit-dwarf is specified on a backend compile (in ThinLTO
parlance) it isn't passed during the frontend compile (because no ELF
object/dwo file is produced then), yet the -fno-split-dwarf-inlining
value needs to be encoded in the LLVM DebugInfo metadata to have
effect...
So let it be specified & it'll be silently ignored if -gsplit-dwarf
isn't used in the end, otherwise it'll be used on a per-cu basis
depending on where it's specified in the frontend compile actions.
llvm-svn: 301684
Rui Ueyama [Fri, 28 Apr 2017 20:38:27 +0000 (20:38 +0000)]
Change the format of the map file.
Previously, we printed out input sections and input files in
separate columns as shown below.
Address Size Align Out In File Symbol
0000000000201000 0000000000000015 4 .text
0000000000201000 000000000000000e 4 .text
0000000000201000 000000000000000e 4 foo.o
0000000000201000 0000000000000000 0 _start
0000000000201005 0000000000000000 0 f(int)
000000000020100e 0000000000000000 0 local
0000000000201010 0000000000000002 4 bar.o
0000000000201010 0000000000000000 0 foo
0000000000201011 0000000000000000 0 bar
This format doesn't make much sense because for each input section,
there's always exactly one input file. This patch changes the format
to this.
Address Size Align Out In Symbol
0000000000201000 0000000000000015 4 .text
0000000000201000 000000000000000e 4 foo.o:(.text)
0000000000201000 0000000000000000 0 _start
0000000000201005 0000000000000000 0 f(int)
000000000020100e 0000000000000000 0 local
0000000000201010 0000000000000002 4 bar.o:(.text)
0000000000201010 0000000000000000 0 foo
0000000000201011 0000000000000000 0 bar
Differential Revision: https://reviews.llvm.org/D32657
llvm-svn: 301683
Reid Kleckner [Fri, 28 Apr 2017 20:34:27 +0000 (20:34 +0000)]
Make getParamAlignment use argument numbers
The method is called "get *Param* Alignment", and is only used for
return values exactly once, so it should take argument indices, not
attribute indices.
Avoids confusing code like:
IsSwiftError = CS->paramHasAttr(ArgIdx, Attribute::SwiftError);
Alignment = CS->getParamAlignment(ArgIdx + 1);
Add getRetAlignment to handle the one case in Value.cpp that wants the
return value alignment.
This is a potentially breaking change for out-of-tree backends that do
their own call lowering.
llvm-svn: 301682
Matthias Braun [Fri, 28 Apr 2017 20:31:49 +0000 (20:31 +0000)]
GlobalISel: Followup for r301679
llvm-svn: 301681
Matt Arsenault [Fri, 28 Apr 2017 20:25:27 +0000 (20:25 +0000)]
Add speculatable function attribute
This attribute tells the optimizer that the function may be speculated.
Patch by Tom Stellard
llvm-svn: 301680
Matthias Braun [Fri, 28 Apr 2017 20:25:05 +0000 (20:25 +0000)]
TargetLowering: Add finalizeLowering() function; NFC
Adds a new method finalizeLowering to TargetLoweringBase. This is in
preparation for an upcoming commit.
This function is meant for target specific adjustments to
MachineFrameInfo or register reservations.
Move the freezeRegisters() and the hasCopyImplyingStackAdjustment()
handling into the new function to prove the concept. As an added bonus
GlobalISel no longer missed the hasCopyImplyingStackAdjustment()
handling with this.
Differential Revision: https://reviews.llvm.org/D32621
llvm-svn: 301679
Rafael Espindola [Fri, 28 Apr 2017 20:22:47 +0000 (20:22 +0000)]
Remove LinkerScript::flush.
This patch replaces flush with a last ditch attempt at synchronizing
the section list with the linker script "AST".
The synchronization is a bit of a hack and should in time be avoided
by creating the AST earlier so that modifications can be made directly
to it instead of modifying the section list and synchronizing it back.
This is the main step for fixing
https://bugs.llvm.org/show_bug.cgi?id=32816. With this in place I
think the only missing thing would be to have processCommands assign
section indexes as dummy offsets so that the sort in
OutputSection::finalize works.
With this LinkerScript::assignAddresses becomes much simpler, which
should help with the thunk work.
llvm-svn: 301678
Marek Olsak [Fri, 28 Apr 2017 20:21:58 +0000 (20:21 +0000)]
AMDGPU: Add new amdgcn.init.exec intrinsics
v2: More tests, bug fixes, cosmetic changes.
Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, llvm-commits, t-tye
Differential Revision: https://reviews.llvm.org/D31762
llvm-svn: 301677
Bob Haarman [Fri, 28 Apr 2017 20:17:15 +0000 (20:17 +0000)]
limit to 2 parallel links when using thinlto
Summary:
When using ThinLTO, the linker performs its own parallelism. This
change limits the number of parallel link jobs that Ninja will issue
to keep the total number of threads reasonable when linking with
ThinLTO.
Reviewers: hans, ruiu
Subscribers: mgorny, mehdi_amini, Prazek
Differential Revision: https://reviews.llvm.org/D31990
llvm-svn: 301676
Rui Ueyama [Fri, 28 Apr 2017 20:00:09 +0000 (20:00 +0000)]
Use toString(Inputfile*) to format a file object.
llvm-svn: 301674
Daniel Berlin [Fri, 28 Apr 2017 19:55:38 +0000 (19:55 +0000)]
Kill off the old SimplifyInstruction API by converting remaining users.
llvm-svn: 301673
Davide Italiano [Fri, 28 Apr 2017 19:39:45 +0000 (19:39 +0000)]
[IPO/MergeFunctions] This function is used only under DEBUG().
llvm-svn: 301672
Reid Kleckner [Fri, 28 Apr 2017 19:22:40 +0000 (19:22 +0000)]
[RS4GC] Simplify attribute handling code NFC
Avoids use of AttributeList::getNumSlots, making it easier to change the
underlying implementation.
llvm-svn: 301671
Tobias Grosser [Fri, 28 Apr 2017 19:15:28 +0000 (19:15 +0000)]
[Codegen] Disable Polly's codegen verification by default
As has been reported in the previous commit, codegen verification can result in
quadratic compile time increases for large functions with many scops. This is
certainly not something we would like to have in the Polly default
configuration. Hence, we disable codegen verification by default -- also to see
if this resolves some of the compilation timeouts we currently see on the AOSP
buildbots. We still leave this feature in Polly as it has shown _very_ useful
for debugging. In fact, we may want to have a discussion if we can bring this
feature back in a way that does not impact compilation time so much.
Thanks to Eli Friedman <efriedma@codeaurora.org> for reporting this issue and
for providing the test case in the previous commit (where I forgot to
acknowledge him).
llvm-svn: 301670
Tobias Grosser [Fri, 28 Apr 2017 19:08:20 +0000 (19:08 +0000)]
[CodeGen] Skip verify if -polly-codegen-verify is set to false
Before this change, we always tried to verify the function and printed
verification errors, but just did not abort in case -polly-codegen-verify=false
was set and verification failed. As verification can become very cosly -- for
large functions with many scops we may verify the very same function very often
-- this can affect compile time very negatively. Hence, we respect the
-polly-codegen-verify flag with this check, ensuring that no verification is run
if -polly-codegen-verify=false.
This reduces code generation time from 26 seconds to 4 seconds on the test
case below with -polly-codegen-verify=false:
struct X { int x; };
void a();
#define SIG (int x, X **y, X **z)
typedef void (*fn)SIG;
#define FN { for (int i = 0; i < x; ++i) { (*y)[i].x += (*z)[i].x; } a(); }
#define FN5 FN FN FN FN FN
#define FN25 FN5 FN5 FN5 FN5
#define FN125 FN25 FN25 FN25 FN25 FN25
#define FN250 FN125 FN125
#define FN1250 FN250 FN250 FN250 FN250 FN250
void x SIG { FN1250 }
llvm-svn: 301669
Rui Ueyama [Fri, 28 Apr 2017 18:54:08 +0000 (18:54 +0000)]
Remove trailing whitespace from the -Map output.
If a string is shorter than 7 characters, we used to print out
trailing whitespace characters.
llvm-svn: 301668
Akira Hatanaka [Fri, 28 Apr 2017 18:50:57 +0000 (18:50 +0000)]
[CodeGen][ObjC] Don't retain captured Objective-C pointers at block
creation that are const-qualified.
When a block captures an ObjC object pointer, clang retains the pointer
to prevent prematurely destroying the object the pointer points to
before the block is called or copied.
When the captured object pointer is const-qualified, we can avoid
emitting the retain/release pair since the pointer variable cannot be
modified in the scope in which the block literal is introduced.
For example:
void test(const id x) {
callee(^{ (void)x; });
}
This patch implements that optimization.
rdar://problem/
28894510
Differential Revision: https://reviews.llvm.org/D32601
llvm-svn: 301667
Reid Kleckner [Fri, 28 Apr 2017 18:37:16 +0000 (18:37 +0000)]
Use Argument::hasAttribute and AttributeList::ReturnIndex more
This eliminates many extra 'Idx' induction variables in loops over
arguments in CodeGen/ and Target/. It also reduces the number of places
where we assume that ReturnIndex is 0 and that we should add one to
argument numbers to get the corresponding attribute list index.
NFC
llvm-svn: 301666
Adrian Prantl [Fri, 28 Apr 2017 18:30:36 +0000 (18:30 +0000)]
Cleanup: Use DIExpression::prepend in buildDbgValueForSpill(). (NFC)
llvm-svn: 301665
Tim Hammerquist [Fri, 28 Apr 2017 18:10:53 +0000 (18:10 +0000)]
Add remaining SBTrace headers to LLDB framework
llvm-svn: 301664
Reid Kleckner [Fri, 28 Apr 2017 17:58:18 +0000 (17:58 +0000)]
[IR] Delete unused Argument::removeAttr overload
It doesn't make sense to remove an AttributeList from an argument.
llvm-svn: 301663
Adrian Prantl [Fri, 28 Apr 2017 17:51:05 +0000 (17:51 +0000)]
Clean up DIExpression::prependDIExpr a little. (NFC)
llvm-svn: 301662
Rui Ueyama [Fri, 28 Apr 2017 17:50:23 +0000 (17:50 +0000)]
Remove a redundant local variable.
llvm-svn: 301661
Peter Collingbourne [Fri, 28 Apr 2017 17:41:43 +0000 (17:41 +0000)]
Bitcode: Do not remove empty summary entries when reading a per-module summary.
This became no longer necessary after D19462 landed, and will be incompatible
with an upcoming change to the summary data structures that changes how we
represent references.
llvm-svn: 301660
Rui Ueyama [Fri, 28 Apr 2017 17:19:13 +0000 (17:19 +0000)]
Speed up the -Map option.
We found that some part of code for the -Map option takes O(m*n)
where m is the number of input sections in some file and n is
the number of symbols in the same file. If you do LTO, we usually
have only a few object files as inputs for the -Map option
feature, so this performance characteristic was worse than I
expected.
This patch rewrites the -Map option feature to speed it up.
I eliminated the O(m*n) bottleneck and also used multi-threading.
As a result, clang link time with the -Map option improved from
18.7 seconds to 11.2 seconds. Without -Map, it takes 7.7 seconds,
so the -Map option is now about 3x faster than before for this
test case (from 11.0 seconds to 3.5 seconds.) The generated output
file size was 223 MiB, and the file contains 1.2M lines.
Differential Revision: https://reviews.llvm.org/D32631
llvm-svn: 301659
Saleem Abdulrasool [Fri, 28 Apr 2017 17:18:28 +0000 (17:18 +0000)]
IR: fix some doxygen grammar (NFC)
Fix a bit of the doxygen grammar that was off that I noticed while
looking at this file for another issue.
llvm-svn: 301658
Saleem Abdulrasool [Fri, 28 Apr 2017 17:06:40 +0000 (17:06 +0000)]
COFF: actually synthesize CONST imports properly
CONSTANT imports expect both the `_imp_` prefixed and non-prefixed
symbols should be added to the symbol table. This allows for linking
symbols like _NSConcreteGlobalBlock in WinObjC. The previous change
would generate the import library properly by handling the option but
would not consume the generated entry properly.
llvm-svn: 301657
Craig Topper [Fri, 28 Apr 2017 16:58:05 +0000 (16:58 +0000)]
[APInt] Add clearSignBit method. Use it and setSignBit in a few places. NFCI
llvm-svn: 301656
Craig Topper [Fri, 28 Apr 2017 16:57:59 +0000 (16:57 +0000)]
[LazyValueInfo] Fix typo in comment. NFC
llvm-svn: 301655
Craig Topper [Fri, 28 Apr 2017 16:57:55 +0000 (16:57 +0000)]
[ValueTracking] Use APInt::isSubsetOf and APInt::intersects. NFC
llvm-svn: 301654
Alexei Starovoitov [Fri, 28 Apr 2017 16:51:01 +0000 (16:51 +0000)]
[bpf] add bigendian support to disassembler
. swap 4-bit register encoding, 16-bit offset and 32-bit imm to support big endian archs
. add a test
Reported-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 301653
Ekaterina Romanova [Fri, 28 Apr 2017 16:45:39 +0000 (16:45 +0000)]
[DOXYGEN] Minor improvements in doxygen comments.
- I removed doxygen comments for the intrinsics that "alias" the other existing documented intrinsics and that only sligtly differ in spelling (single underscores vs. double underscores).
#define _tzcnt_u16(a) (__tzcnt_u16((a)))
It will be very hard to keep the documentation for these "aliases" in sync with the documentation for the intrinsics they alias to. Out of sync documentation will be more confusing than no documentation.
I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.
llvm-svn: 301652
Jakub Kuderski [Fri, 28 Apr 2017 16:25:45 +0000 (16:25 +0000)]
[clang-tidy] modernize-use-emplace: remove unnecessary make_pair calls
Summary:
When there is a push_back with a call to make_pair, turn it into emplace_back and remove the unnecessary make_pair call.
Eg.
```
std::vector<std::pair<int, int>> v;
v.push_back(std::make_pair(1, 2)); // --> v.emplace_back(1, 2);
```
make_pair doesn't get removed when explicit template parameters are provided, because of potential problems with type conversions.
Reviewers: Prazek, aaron.ballman, hokein, alexfh
Reviewed By: Prazek, alexfh
Subscribers: JDevlieghere, JonasToth, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D32395
llvm-svn: 301651
Tim Northover [Fri, 28 Apr 2017 16:06:00 +0000 (16:06 +0000)]
CMake: ignore git stderr when trying to sort out revision. NFC.
llvm-svn: 301650
Jun Bum Lim [Fri, 28 Apr 2017 16:04:03 +0000 (16:04 +0000)]
[InlineCost] Improve the cost heuristic for Switch
Summary:
The motivation example is like below which has 13 cases but only 2 distinct targets
```
lor.lhs.false2: ; preds = %if.then
switch i32 %Status, label %if.then27 [
i32 -7012, label %if.end35
i32 -10008, label %if.end35
i32 -10016, label %if.end35
i32 15000, label %if.end35
i32 14013, label %if.end35
i32 10114, label %if.end35
i32 10107, label %if.end35
i32 10105, label %if.end35
i32 10013, label %if.end35
i32 10011, label %if.end35
i32 7008, label %if.end35
i32 7007, label %if.end35
i32 5002, label %if.end35
]
```
which is compiled into a balanced binary tree like this on AArch64 (similar on X86)
```
.LBB853_9: // %lor.lhs.false2
mov w8, #10012
cmp w19, w8
b.gt .LBB853_14
// BB#10: // %lor.lhs.false2
mov w8, #5001
cmp w19, w8
b.gt .LBB853_18
// BB#11: // %lor.lhs.false2
mov w8, #-10016
cmp w19, w8
b.eq .LBB853_23
// BB#12: // %lor.lhs.false2
mov w8, #-10008
cmp w19, w8
b.eq .LBB853_23
// BB#13: // %lor.lhs.false2
mov w8, #-7012
cmp w19, w8
b.eq .LBB853_23
b .LBB853_3
.LBB853_14: // %lor.lhs.false2
mov w8, #14012
cmp w19, w8
b.gt .LBB853_21
// BB#15: // %lor.lhs.false2
mov w8, #-10105
add w8, w19, w8
cmp w8, #9 // =9
b.hi .LBB853_17
// BB#16: // %lor.lhs.false2
orr w9, wzr, #0x1
lsl w8, w9, w8
mov w9, #517
and w8, w8, w9
cbnz w8, .LBB853_23
.LBB853_17: // %lor.lhs.false2
mov w8, #10013
cmp w19, w8
b.eq .LBB853_23
b .LBB853_3
.LBB853_18: // %lor.lhs.false2
mov w8, #-7007
add w8, w19, w8
cmp w8, #2 // =2
b.lo .LBB853_23
// BB#19: // %lor.lhs.false2
mov w8, #5002
cmp w19, w8
b.eq .LBB853_23
// BB#20: // %lor.lhs.false2
mov w8, #10011
cmp w19, w8
b.eq .LBB853_23
b .LBB853_3
.LBB853_21: // %lor.lhs.false2
mov w8, #14013
cmp w19, w8
b.eq .LBB853_23
// BB#22: // %lor.lhs.false2
mov w8, #15000
cmp w19, w8
b.ne .LBB853_3
```
However, the inline cost model estimates the cost to be linear with the number
of distinct targets and the cost of the above switch is just 2 InstrCosts.
The function containing this switch is then inlined about 900 times.
This change use the general way of switch lowering for the inline heuristic. It
etimate the number of case clusters with the suitability check for a jump table
or bit test. Considering the binary search tree built for the clusters, this
change modifies the model to be linear with the size of the balanced binary
tree. The model is off by default for now :
-inline-generic-switch-cost=false
This change was originally proposed by Haicheng in D29870.
Reviewers: hans, bmakam, chandlerc, eraman, haicheng, mcrosier
Reviewed By: hans
Subscribers: joerg, aemerson, llvm-commits, rengolin
Differential Revision: https://reviews.llvm.org/D31085
llvm-svn: 301649
Emilio Cobos Alvarez [Fri, 28 Apr 2017 15:56:39 +0000 (15:56 +0000)]
[libclang] Expose some target information via the C API.
This allows users to query the target triple and target pointer width, which
would make me able to fix https://github.com/servo/rust-bindgen/issues/593 and
other related bugs in an elegant way (without having to manually parse the
target triple in the command line arguments).
Differential Revision: https://reviews.llvm.org/D32389
llvm-svn: 301648
Alex Lorenz [Fri, 28 Apr 2017 14:45:25 +0000 (14:45 +0000)]
Use the -Wunknown-warning-option group for the "unknown warning group"
diagnostic in #pragma diagnostic
This matches the warning group that's specified for the unknown warning options
that are passed-in as command line arguments.
rdar://
29526025
llvm-svn: 301647
Simon Pilgrim [Fri, 28 Apr 2017 14:42:15 +0000 (14:42 +0000)]
Move variable local to where ita used. NFCI.
llvm-svn: 301646
Teresa Johnson [Fri, 28 Apr 2017 14:30:54 +0000 (14:30 +0000)]
Memory intrinsic value profile optimization: Avoid divide by 0
Summary:
Skip memops if the total value profiled count is 0, we can't correctly
scale up the counts and there is no point anyway.
Reviewers: davidxl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D32624
llvm-svn: 301645
Simon Pilgrim [Fri, 28 Apr 2017 13:21:18 +0000 (13:21 +0000)]
[DAGCombiner] Add ComputeNumSignBits vector demanded elements support to ASHR and INSERT_VECTOR_ELT (reapplied)
Reapplied r299221 after fix for nondeterminism in ThinLTO builder (rL301599), with extra check for implicit truncation of inserted element.
llvm-svn: 301644
Alex Lorenz [Fri, 28 Apr 2017 12:30:05 +0000 (12:30 +0000)]
[Sema] Avoid an invalid redefinition error that was presented for
of a function whose previous definition was typo-corrected
rdar://
28550928
Differential Revision: https://reviews.llvm.org/D25113
llvm-svn: 301643
Pavel Labath [Fri, 28 Apr 2017 12:08:28 +0000 (12:08 +0000)]
Remove lock from ConstString::GetLength
Summary: ConstStrings are immutable, so there is no need to grab even a reader lock in order to read the length field.
Reviewers: #lldb, labath
Reviewed By: labath
Subscribers: zturner, labath, lldb-commits
Differential Revision: https://reviews.llvm.org/D32306
Patch by Scott Smith <scott.smith@purestorage.com>
llvm-svn: 301642
Simon Pilgrim [Fri, 28 Apr 2017 11:53:08 +0000 (11:53 +0000)]
[X86][SSE] Added new tests from D32416 to show codegen delta
llvm-svn: 301641
Siddharth Bhat [Fri, 28 Apr 2017 11:16:30 +0000 (11:16 +0000)]
[Polly] [PPCGCodeGeneration] Add managed memory support to GPU code
generation.
This needs changes to GPURuntime to expose synchronization between host
and device.
1. Needs better function naming, I want a better name than
"getOrCreateManagedDeviceArray"
2. DeviceAllocations is used by both the managed memory and the
non-managed memory path. This exploits the fact that the two code paths
are never run together. I'm not sure if this is the best design decision
Reviewed by: PhilippSchaad
Tags: #polly
Differential Revision: https://reviews.llvm.org/D32215
llvm-svn: 301640
Simon Pilgrim [Fri, 28 Apr 2017 11:12:30 +0000 (11:12 +0000)]
[X86][SSE] Renames all ones test to better match type.
Added 8f32/4f64 optsize tests discussed on D32416
llvm-svn: 301639
Simon Pilgrim [Fri, 28 Apr 2017 10:31:42 +0000 (10:31 +0000)]
[X86][SSE] Add codegen test for _mm_set_pd1 (PR32827)
llvm-svn: 301638
Simon Pilgrim [Fri, 28 Apr 2017 10:28:32 +0000 (10:28 +0000)]
[X86][SSE] Add _mm_set_pd1 (PR32827)
Matches _mm_set_ps1 implementation
llvm-svn: 301637
Pavel Labath [Fri, 28 Apr 2017 10:26:06 +0000 (10:26 +0000)]
Resurrect pselect MainLoop implementation
Summary:
It turns out that even though ppoll is available on all the android
devices we support, it does not seem to be working properly on all of
them -- MainLoop just does a busy loop with ppoll returning EINTR and
not making any progress.
This brings back the pselect implementation and makes it available on
android. I could not do any cmake checks for this as the ppoll symbol is
actually avaiable -- it just does not work.
Reviewers: beanz, eugene
Subscribers: srhines, lldb-commits
Differential Revision: https://reviews.llvm.org/D32600
llvm-svn: 301636
Alex Lorenz [Fri, 28 Apr 2017 09:46:36 +0000 (09:46 +0000)]
[index] Handle vector types in USR generator
rdar://
25339187
llvm-svn: 301635
Diana Picus [Fri, 28 Apr 2017 09:20:31 +0000 (09:20 +0000)]
[ARM] GlobalISel: fixup r301632
Actually remove ARMInstructionSelector.h... Forgot to stage the removal
in the previous commit.
llvm-svn: 301633
Diana Picus [Fri, 28 Apr 2017 09:10:38 +0000 (09:10 +0000)]
[ARM] GlobalISel: Get rid of ARMInstructionSelector.h. NFC.
Declare the ARMInstructionSelector in an anonymous namespace, to make it
more in line with the other targets which were migrated to this in
r299637 in order to avoid TableGen'erated headers being included in
non-GlobalISel builds.
llvm-svn: 301632
George Rimar [Fri, 28 Apr 2017 08:54:10 +0000 (08:54 +0000)]
[DWARF] - Fix mistype in dump output of pub* tables. NFC.
There was a garbage character in output introduced by myself in
r290040 "[DWARF] - Introduce DWARFDebugPubTable class for dumping pub* sections."
llvm-svn: 301631
Andrew Ng [Fri, 28 Apr 2017 08:44:30 +0000 (08:44 +0000)]
[DebugInfo][X86] Improve X86 Optimize LEAs handling of debug values.
This is a follow up to the fix in r298360 to improve the handling of debug
values when redundant LEAs are removed. The fix in r298360 effectively
discarded the debug values. This patch now attempts to preserve the debug
values by using the DWARF DW_OP_stack_value operation via prependDIExpr.
Moved functions appendOffset and prependDIExpr from Local.cpp to
DebugInfoMetadata.cpp and made them available as static member functions of
DIExpression.
Differential Revision: https://reviews.llvm.org/D31604
llvm-svn: 301630
Craig Topper [Fri, 28 Apr 2017 08:15:33 +0000 (08:15 +0000)]
[WebAssembly] Update calls to computeKnownBits after the changes from r301620.
I didn't realize WebAssembly wasn't a default build target so I missed that changes were needed.
llvm-svn: 301629
Clement Courbet [Fri, 28 Apr 2017 07:56:31 +0000 (07:56 +0000)]
[X86][NFC] Refactor RepMovsRepeats in preparation for D32481.
Differential Revision: https://reviews.llvm.org/D32583
llvm-svn: 301628
Diana Picus [Fri, 28 Apr 2017 07:50:47 +0000 (07:50 +0000)]
[ARM] GlobalISel: Tighten test. NFC
Explicitly check types and load sizes in the IRTranslator test.
llvm-svn: 301627
Craig Topper [Fri, 28 Apr 2017 06:28:56 +0000 (06:28 +0000)]
[ValueTracking] Convert computeKnownBitsFromRangeMetadata to use KnownBits struct.
llvm-svn: 301626
Max Kazantsev [Fri, 28 Apr 2017 06:25:39 +0000 (06:25 +0000)]
[EarlyCSE] Mark the condition of assume intrinsic as true
EarlyCSE should not just ignore assumes. It should use the fact that its condition is true for all dominated instructions.
Reviewers: sanjoy, reames, apilipenko, anna, skatkov
Reviewed By: reames, sanjoy
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D32482
llvm-svn: 301625
Tobias Grosser [Fri, 28 Apr 2017 06:11:17 +0000 (06:11 +0000)]
Update to isl-0.18-592-gb50ad59
This is just a general maintenance update.
llvm-svn: 301624
Max Kazantsev [Fri, 28 Apr 2017 06:05:48 +0000 (06:05 +0000)]
[EarlyCSE] Remove guards with conditions known to be true
If a condition is calculated only once, and there are multiple guards on this condition, we should be able
to remove all guards dominated by the first of them. This patch allows EarlyCSE to try to find the condition
of a guard among the known values, and if it is true, remove the guard. Otherwise we keep the guard and
mark its condition as 'true' for future consideration.
Reviewers: sanjoy, reames, apilipenko, skatkov, anna, dberlin
Reviewed By: reames, sanjoy
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D32476
llvm-svn: 301623
Kuba Mracek [Fri, 28 Apr 2017 05:50:46 +0000 (05:50 +0000)]
Fix unset-insert-libraries-on-exec.cc to use "%env" to make it work in iOS simulator.
llvm-svn: 301622
Kuba Mracek [Fri, 28 Apr 2017 05:48:27 +0000 (05:48 +0000)]
Fix the reexec-insert-libraries-env.cc testcase to use %env to make it work on iOS simulator.
llvm-svn: 301621
Craig Topper [Fri, 28 Apr 2017 05:31:46 +0000 (05:31 +0000)]
[SelectionDAG] Use KnownBits struct in DAG's computeKnownBits and simplifyDemandedBits
This patch replaces the separate APInts for KnownZero/KnownOne with a single KnownBits struct. This is similar to what was done to ValueTracking's version recently.
This is largely a mechanical transformation from KnownZero to Known.Zero.
Differential Revision: https://reviews.llvm.org/D32569
llvm-svn: 301620
NAKAMURA Takumi [Fri, 28 Apr 2017 05:02:52 +0000 (05:02 +0000)]
clang/test/ARCMT/remap-applying.c: Use %/s on the command line of echo(1).
llvm-svn: 301619
Craig Topper [Fri, 28 Apr 2017 04:57:59 +0000 (04:57 +0000)]
[SelectionDAG] Use various APInt methods to reduce temporary APInt creation
This patch uses various APInt methods to reduce the number of temporary APInts. These were all found while working through converting SelectionDAG's computeKnownBits to also use the KnownBits struct recently added to the ValueTracking version.
llvm-svn: 301618