Davide Italiano [Tue, 11 Jul 2017 19:19:45 +0000 (19:19 +0000)]
[NewGVN] Fix an innocent typo I found while debugging PR33720.
llvm-svn: 307694
Alexey Bataev [Tue, 11 Jul 2017 19:16:44 +0000 (19:16 +0000)]
[OPENMP] Add restriction for reduction clause in taskloop directives.
Added checks for the reduction clauses in the taskloop directives:
1. Only addressable items must be used in reduction clauses.
2. Reduction clauses cannot be used with nogroup clauses.
llvm-svn: 307693
Davide Italiano [Tue, 11 Jul 2017 19:15:36 +0000 (19:15 +0000)]
[NewGVN] Clarify the function invariants formatting them properly.
llvm-svn: 307692
Tony Jiang [Tue, 11 Jul 2017 19:07:10 +0000 (19:07 +0000)]
[PPC] Fix one test case regression for patch https://reviews.llvm.org/D34337.
llvm-svn: 307691
Rafael Espindola [Tue, 11 Jul 2017 18:59:45 +0000 (18:59 +0000)]
Delete redundant InVersionScript field.
Thanks to Rui for the suggestion.
llvm-svn: 307690
Francis Ricci [Tue, 11 Jul 2017 18:54:00 +0000 (18:54 +0000)]
Refactor MemoryMappingLayout::Next to use a single struct instead of output parameters. NFC.
Summary:
This is the first in a series of patches to refactor sanitizer_procmaps
to allow MachO section information to be exposed on darwin.
In addition, grouping all segment information in a single struct is
cleaner than passing it through a large set of output parameters, and
avoids the need for annotations of NULL parameters for unneeded
information.
The filename string is optional and must be managed and supplied by the
calling function. This is to allow the MemoryMappedSegment struct to be
stored on the stack without causing overly large stack sizes.
Reviewers: alekseyshl, kubamracek, glider
Subscribers: emaste, llvm-commits
Differential Revision: https://reviews.llvm.org/D35135
llvm-svn: 307688
Dan Liew [Tue, 11 Jul 2017 18:27:52 +0000 (18:27 +0000)]
[LibFuzzer] Fix `-Wcomment` warning emitted by GCC.
```
./FuzzerIOWindows.cpp:185:1: warning: multi-line comment [-Wcomment]
// Parse a directory ending in separator, like: SomeDir\
^
./FuzzerIOWindows.cpp:200:1: warning: multi-line comment [-Wcomment]
// Parse a servername and share, like: SomeServer\SomeShare\
^
```
Differential Revision: https://reviews.llvm.org/D35244
llvm-svn: 307687
Dan Liew [Tue, 11 Jul 2017 18:27:48 +0000 (18:27 +0000)]
[LibFuzzer] Fix `-Wpedantic` warning reported by Eric Christopher.
The warning is reproducible with GCC 4.8. Thanks to David Blaikie for
the suggested fix.
The reported warning was
```
/usr/local/google/home/echristo/sources/llvm/lib/Fuzzer/FuzzerExtFunctions.def:29:10: warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object [-Wpedantic]
EXT_FUNC(__lsan_enable, void, (), false);
^
/usr/local/google/home/echristo/sources/llvm/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp:44:24: note: in definition of macro ‘EXT_FUNC’
CheckFnPtr((void *)::NAME, #NAME, WARN);
^
```
Differential Revision: https://reviews.llvm.org/D35243
llvm-svn: 307686
Evgeniy Stepanov [Tue, 11 Jul 2017 18:18:50 +0000 (18:18 +0000)]
[asan] Fix asan_device_setup --use-su mode on Android 7.x.
mount command does not accept -o remount,rw flag on some versions of Android.
mount -o rw,remount works everywhere.
llvm-svn: 307685
Evgeniy Stepanov [Tue, 11 Jul 2017 18:13:52 +0000 (18:13 +0000)]
[msan] Only check shadow memory for operands that are sized.
Fixes PR33347: https://bugs.llvm.org/show_bug.cgi?id=33347.
Differential Revision: https://reviews.llvm.org/D35160
Patch by Matt Morehouse.
llvm-svn: 307684
Dimitry Andric [Tue, 11 Jul 2017 18:04:56 +0000 (18:04 +0000)]
Rename z_Linux_asm.s to z_Linux_asm.S
Summary:
On Unix, a .S file is normally an assembly source which must be
preprocessed with a C preprocessor, while a .s file is "plain" assembly.
The former is handled by the compiler driver (cc), the latter is
directly passed to the assembler binary (as).
Because z_Linux_asm.s is supposed to be preprocessed, rename it to .S,
so it can be automatically picked up correctly by build systems.
Reviewers: AndreyChurbanov, emaste, jlpeyton
Reviewed By: AndreyChurbanov
Subscribers: mgorny, openmp-commits
Differential Revision: https://reviews.llvm.org/D35171
llvm-svn: 307680
Simon Dardis [Tue, 11 Jul 2017 18:03:20 +0000 (18:03 +0000)]
[mips][mt][1/7] Add the MT ASE as a subtarget feature.
Preparatory work for adding the MIPS MT (multi-threading) ASE instructions.
Reviewers: slthakur, atanasyan
Differential Revision: https://reviews.llvm.org/D35247
llvm-svn: 307679
Konstantin Zhuravlyov [Tue, 11 Jul 2017 17:57:41 +0000 (17:57 +0000)]
Revert "AMDGPU: Do not test for SI in getIsaVersion"
This reverts commit r307573.
This breaks downstream test.
llvm-svn: 307678
Michael Zuckerman [Tue, 11 Jul 2017 17:17:49 +0000 (17:17 +0000)]
[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess.
Base test for avx512
adding new base test to trunk befor commit change on the test
llvm-svn: 307677
Anna Thomas [Tue, 11 Jul 2017 17:16:33 +0000 (17:16 +0000)]
[LoopUnrollRuntime] Avoid multi-exit nested loop with epilog generation
The loop structure for the outer loop does not contain the epilog
preheader when we try to unroll inner loop with multiple exits and
epilog code is generated. For now, we just bail out in such cases.
Added a test case that shows the problem. Without this bailout, we would
trip on assert saying LCSSA form is incorrect for outer loop.
llvm-svn: 307676
Krzysztof Parzyszek [Tue, 11 Jul 2017 17:11:54 +0000 (17:11 +0000)]
[Hexagon] Do not rely on callee-saved info in hasFP
llvm-svn: 307675
Reid Kleckner [Tue, 11 Jul 2017 16:45:30 +0000 (16:45 +0000)]
[Support] - Add bad alloc error handler for handling allocation malfunctions
Summary:
Patch by Klaus Kretzschmar
We would like to introduce a new type of llvm error handler for handling
bad alloc fault situations. LLVM already provides a fatal error handler
for serious non-recoverable error situations which by default writes
some error information to stderr and calls exit(1) at the end (functions
are marked as 'noreturn').
For long running processes (e.g. a server application), exiting the
process is not an acceptable option, especially not when the system is
in a temporary resource bottleneck with a good chance to recover from
this fault situation. In such a situation you would rather throw an
exception to stop the current compilation and try to overcome the
resource bottleneck. The user should be aware of the problem of throwing
an exception in bad alloc situations, e.g. you must not do any
allocations in the unwind chain. This is especially true when adding
exceptions in existing unfamiliar code (as already stated in the comment
of the current fatal error handler)
So the new handler can also be used to distinguish from general fatal
error situations where recovering is no option. It should be used in
cases where a clean unwind after the allocation is guaranteed.
This patch contains:
- A report_bad_alloc function which calls a user defined bad alloc
error handler. If no user handler is registered the
report_fatal_error function is called. This function is not marked as
'noreturn'.
- A install/restore_bad_alloc_error_handler to install/restore the bad
alloc handler.
- An example (in Mutex.cpp) where the report_bad_alloc function is
called in case of a malloc returns a nullptr.
If this patch gets accepted we would create similar patches to fix
corresponding malloc/calloc usages in the llvm code.
Reviewers: chandlerc, greened, baldrick, rnk
Reviewed By: rnk
Subscribers: llvm-commits, MatzeB
Differential Revision: https://reviews.llvm.org/D34753
llvm-svn: 307673
Tony Jiang [Tue, 11 Jul 2017 16:42:20 +0000 (16:42 +0000)]
[PPC] Fix two bugs in frame lowering.
1. The available program storage region of the red zone to compilers is 288
bytes rather than 244 bytes.
2. The formula for negative number alignment calculation should be
y = x & ~(n-1) rather than y = (x + (n-1)) & ~(n-1).
Differential Revision: https://reviews.llvm.org/D34337
llvm-svn: 307672
Krzysztof Parzyszek [Tue, 11 Jul 2017 16:39:33 +0000 (16:39 +0000)]
[Hexagon] Add support for nontemporal loads and stores on HVX
Patch by Michael Wu.
Differential Revision: https://reviews.llvm.org/D35104
llvm-svn: 307671
Reid Kleckner [Tue, 11 Jul 2017 16:18:05 +0000 (16:18 +0000)]
Add missing dllimport member pointer template argument test from r307446
llvm-svn: 307670
Reid Kleckner [Tue, 11 Jul 2017 16:12:53 +0000 (16:12 +0000)]
[lit] Fix import StringIO errors in Python 3
Remove the cStringIO micro-optimization, as it isn't portable to Python
3.
llvm-svn: 307669
Reid Kleckner [Tue, 11 Jul 2017 16:05:50 +0000 (16:05 +0000)]
[lit] Implement non-pipelined echo commands internally
Summary:
This speeds up the LLD test suite on Windows by 3x. Most of the time is
spent on lld/test/ELF/linkerscript/diagnostics.s, which repeatedly
constructs linker scripts with appending echo commands.
Reviewers: dlj, zturner, modocache
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D35093
llvm-svn: 307668
Dinar Temirbulatov [Tue, 11 Jul 2017 15:54:50 +0000 (15:54 +0000)]
[SLPVectorizer] Revert change in cancelScheduling with referencing to FirstInBundle, NFCI.
llvm-svn: 307667
Craig Topper [Tue, 11 Jul 2017 15:52:21 +0000 (15:52 +0000)]
[IR] Remove unnecessary const_casts from ConstantDataSequential and it's subclasses.
llvm-svn: 307666
Joerg Sonnenberger [Tue, 11 Jul 2017 15:50:48 +0000 (15:50 +0000)]
NetBSD uses soft-float by default, unless the environment is EABIHF or
GNUEABIHF.
llvm-svn: 307665
Joerg Sonnenberger [Tue, 11 Jul 2017 15:49:45 +0000 (15:49 +0000)]
Run the preprocessor test as frontend test for NetBSD, since CC1 mode
doesn't get flags like the default target CPU. Update for test to
reflect the difference.
llvm-svn: 307664
Clement Courbet [Tue, 11 Jul 2017 15:45:22 +0000 (15:45 +0000)]
[ASTMatchers][NFC] integerLiteral(): Mention negative integers in
documentation.
Trying to match integerLiteral(-1) will silently fail, because an numeric
literal is always positive.
- Update the documentation to explain how to match negative numeric
literals.
- Add a unit test.
Differential Revision: https://reviews.llvm.org/D35196
llvm-svn: 307663
Hiroshi Inoue [Tue, 11 Jul 2017 15:41:31 +0000 (15:41 +0000)]
fix formatting; NFC
llvm-svn: 307662
Alexander Kornienko [Tue, 11 Jul 2017 15:23:05 +0000 (15:23 +0000)]
[clang-tidy] Extend diagnostics test.
* test that no diagnostics are redirected to stderr
* test that a file-based compilation database is not picked up when the
command line after -- contains an error
llvm-svn: 307661
Tobias Grosser [Tue, 11 Jul 2017 14:29:39 +0000 (14:29 +0000)]
[Simplify] Also remove redundant writes which originally came from PHI nodes
llvm-svn: 307660
Daniel Sanders [Tue, 11 Jul 2017 14:23:14 +0000 (14:23 +0000)]
[globalisel][tablegen] Change method of squashing unused variable warnings following post-commit comments.
llvm-svn: 307659
Jonas Paulsson [Tue, 11 Jul 2017 14:07:55 +0000 (14:07 +0000)]
[SystemZ] Minor fixing in SystemZScheduleZ13.td
Some minor corrections for the recently added instructions.
Review: Ulrich Weigand
llvm-svn: 307658
Petar Jovanovic [Tue, 11 Jul 2017 13:03:48 +0000 (13:03 +0000)]
Remove duplicate assignments in stat64/kernel_stat_to_stat functions
Remove duplicate assignments in stat64_to_stat() and kernel_stat_to_stat().
llvm-svn: 307657
Diana Picus [Tue, 11 Jul 2017 12:34:33 +0000 (12:34 +0000)]
[ARM] GlobalISel: Tighten G_FCMP selection test. NFC
Use CHECK-NEXT for the comparison sequence, to make sure we don't get
any unexpected instructions in the middle of our flag manipulation
efforts.
llvm-svn: 307656
George Rimar [Tue, 11 Jul 2017 12:29:07 +0000 (12:29 +0000)]
[DWARF] - Add testcase for checking message about broken relocations.
Addresses comments for r306677, which fixed error message itself.
llvm-svn: 307655
Guy Blank [Tue, 11 Jul 2017 11:51:49 +0000 (11:51 +0000)]
[X86][AVX512] regenerate avx512-insert-extract.ll
llvm-svn: 307654
Diana Picus [Tue, 11 Jul 2017 11:47:45 +0000 (11:47 +0000)]
[ARM] GlobalISel: Add reg mapping for s64 G_FCMP
Map the result into GPR and the operands into FPR.
llvm-svn: 307653
George Rimar [Tue, 11 Jul 2017 11:40:59 +0000 (11:40 +0000)]
[ELF] - Fix functionality treating IFunc definitions in DSOs as functions.
It was intially implemented in D19517 but then broken.
Patch fixes PR33707, testcase is based on PR's case.
Differential revision: https://reviews.llvm.org/D35119
llvm-svn: 307652
Philip Pfaffe [Tue, 11 Jul 2017 11:37:35 +0000 (11:37 +0000)]
[Polly][CMake] Skip unit-tests in lit if gtest is not available
Summary:
There is a bug in the current lit configurations for the unittests. If gtest is not available, the site-config for the unit tests won't be generated. Because lit recurses through the test directory, the lit configuration for the unit tests will be discovered nevertheless, leading to a fatal error in lit.
This patch semi-gracefully skips the unittests if gtest is not available. As a result, running lit now prints this: `warning: test suite 'Polly-Unit' contained no test`.
If people think that this is too annoying, the alternative would be to pick apart the test directory, so that the lit testsuite discovery will always only find one configuration. In fact, both of these things could be combined. While it's certainly nice that running a single lit command runs all the tests, I suppose people use the `check-polly` make target over lit most of the time, so the difference might not be noticed.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: mgorny, bollu, pollydev, llvm-commits
Tags: #polly
Differential Revision: https://reviews.llvm.org/D34053
llvm-svn: 307651
Philip Pfaffe [Tue, 11 Jul 2017 11:24:25 +0000 (11:24 +0000)]
[Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds
Summary:
As of now, Polly uses llvm-config to set up LLVM dependencies in an out-of-tree build.
This is problematic for two reasons:
1) Right now, in-tree and out-of-tree builds in fact do different things. E.g., in an in-tree build, libPolly depends on a handful of LLVM libraries, while in an out-of-tree build it depends on all of them. This means that we often need to treat both paths seperately.
2) I'm specifically unhappy with the way libPolly is linked right now, because it just blindly links against all the LLVM libs. That doesn't make a lot of sense. For instance, one of these libs is LLVMTableGen, which contains a command line definition of a -o option. This means that I can not link an out-of-tree libPolly into a tool which might want to offer a -o option as well.
This patch (mostly) drop the use of llvm-config in favor of LLVMs exported cmake package. However, building Polly with unittests requires access to the gtest sources (in the LLVM source tree). If we're building against an LLVM installation, this source tree is unavailable and must specified. I'm using llvm-config to provide a default in this case.
Reviewers: Meinersbur, grosser
Reviewed By: grosser
Subscribers: tstellar, bollu, chapuni, mgorny, pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D33299
llvm-svn: 307650
Philip Pfaffe [Tue, 11 Jul 2017 11:17:44 +0000 (11:17 +0000)]
[PM] Another post-commit fix in NewPMDriver
There were two errors in the parsing of opt's command line options for
extension point pipelines. The EP callbacks are not supposed to return a
value. To check the pipeline text for correctness, I now try to parse it
into a temporary PM object, and print a message on failure. This solves
the compile time error for the lambda return type, as well as correctly
handles unparsable pipelines now.
llvm-svn: 307649
Tobias Grosser [Tue, 11 Jul 2017 11:07:01 +0000 (11:07 +0000)]
[tests] Add import-jscop-dir to lit.site.cfg.in
For the previous commit I accidentally added this change to lit.site.cfg, which
is autogenerated and was consequently not part of the previous commit.
llvm-svn: 307648
Diana Picus [Tue, 11 Jul 2017 10:52:08 +0000 (10:52 +0000)]
[ARM] GlobalISel: Tighten legalizer tests. NFC
Make sure that all the legalizer tests where the original instruction
needs to be removed check for the removal. We do this by adding
CHECK-NOT lines before and after the replacement sequence. This won't
catch pathological cases where the instruction remains somewhere in the
middle of the instruction sequence that's supposed to replace it, but
hopefully that won't occur in practice (since ideally we'd be setting
the insert point for the new instruction sequence either before or after
the original instruction and not fiddle with it while building the
sequence).
llvm-svn: 307647
Daniel Sanders [Tue, 11 Jul 2017 10:40:18 +0000 (10:40 +0000)]
[globalisel][tablegen] Fix an multi-insn match bug where ComplexPattern is used on multiple insns.
In each rule, each use of ComplexPattern is assigned an element in the Renderers
array. The matcher then collects renderer functions in this array and they are
used to render instructions. This works well for a single instruction but a
bug in the allocation mechanism causes the elements to be assigned on a
per-instruction basis rather than a per-rule basis.
So in the case of:
(set GPR32:$dst, (Op complex:$src1, complex:$src2))
tablegen currently assigns elements 0 and 1 to $src1 and $src2 respectively,
but for:
(set GPR32:$dst, (Op complex:$src1, (Op complex:$src2)))
it currently assigned both $src1 and $src2 the same element (0). This results in
one complex operand being rendered twice and the other being forgotten.
This patch corrects the allocation such that $src1 and $src2 are still allocated
different elements in this case.
llvm-svn: 307646
Tobias Grosser [Tue, 11 Jul 2017 10:39:01 +0000 (10:39 +0000)]
[tests] Set -polly-import-jscop-dir=%S always
This simplifies the test cases.
llvm-svn: 307645
Pavel Labath [Tue, 11 Jul 2017 10:38:40 +0000 (10:38 +0000)]
NativeProcessLinux: Fix handling of raise(SIGTRAP)
In NativeProcessLinux::MonitorSIGTRAP we were asserting that the si_code
value is one of the codes we know about. However, that list was very
incomplete -- for example, we were not handling SI_TKILL/SI_USER,
generated by raise(SIGTRAP). A cursory examination show there are at
least a dozen codes like these that an app can generate, and more can be
added at any point.
So, instead of trying to play catchup, I change the default behavior to
treat an unknown si_code like an ordinary signal. The only reason we
needed to inspect si_code in the first place is because
watchpoint/breakpoints are notified as SIGTRAP, but we already know
about those, and us starting to use a new debug event is far less likely
than somebody introducing a new non-debug event.
I add a test case to TestRaise to verify we are handling raise(SIGTRAP)
in an application properly.
llvm-svn: 307644
Tobias Grosser [Tue, 11 Jul 2017 10:30:45 +0000 (10:30 +0000)]
[Simplify] Add test case which we currently miss
llvm-svn: 307643
Alex Lorenz [Tue, 11 Jul 2017 10:18:35 +0000 (10:18 +0000)]
[ObjC] Check that a subscript methods is declared for a qualified id type
Objective-C subscript expressions report errors when a subscript method is not
declared in the base class. However, prior to this commit, qualified id types
were not checked. This commit ensures that an appropriate error is reported
when a subscript method is not declared in any of the protocols that are
included in the qualified id type.
rdar://
33213924
llvm-svn: 307642
Tobias Grosser [Tue, 11 Jul 2017 10:10:13 +0000 (10:10 +0000)]
Always export the latest memory access relations
This allows us to export the results from transformations such as DeLICM.
llvm-svn: 307641
Peter Smith [Tue, 11 Jul 2017 09:47:12 +0000 (09:47 +0000)]
[ARM] ldr pc,=expression should be allowed in Thumb2
This change allows the pc to be used as a destination register for the
pseudo instruction LDR pc,=expression . The pseudo instruction must not be
transformed into a MOV, but it can use the Thumb2 LDR (literal) instruction
to a constant pool entry. See (A7.7.43 from ARMv7M ARM ARM).
Differential Revision: https://reviews.llvm.org/D34751
llvm-svn: 307640
Diana Picus [Tue, 11 Jul 2017 09:43:51 +0000 (09:43 +0000)]
[ARM] GlobalISel: Fix oversight in G_FCMP legalization
We used to forget to erase the original instruction when replacing a
G_FCMP true/false. Fix this bug and make sure the tests check for it.
llvm-svn: 307639
Alex Lorenz [Tue, 11 Jul 2017 09:39:23 +0000 (09:39 +0000)]
RecursiveASTVisitor should visit the nested name qualifiers in
a template specialisation
rdar://
33123354
Differential Revision: https://reviews.llvm.org/D34981
llvm-svn: 307638
Peter Smith [Tue, 11 Jul 2017 09:28:27 +0000 (09:28 +0000)]
[ELF] Add comment to explain LinkerScript::CurAddressState [NFC]
r307367 via D34345 split out the temporary address state used within
processCommands() and assignAddresses(). Due to the way that getSymbolValue
is used by the ScriptParser there is no way of giving the current
OutputSection to getSymbolValue() without somehow accessing the created
addressState. The suggestion was that by making a pointer that would go out
of scope we would find out by ASAN/MSAN or a crash if someone had misused
currentAddressState.
Differential Revision: https://reviews.llvm.org/D34345
llvm-svn: 307637
Pavel Labath [Tue, 11 Jul 2017 09:03:38 +0000 (09:03 +0000)]
NativeProcessLinux: Fix some compiler warnings
llvm-svn: 307636
Philipp Stephani [Tue, 11 Jul 2017 09:01:58 +0000 (09:01 +0000)]
Use new command replace-buffer-contents if available
Reviewers: klimek
Reviewed By: klimek
Differential Revision: https://reviews.llvm.org/D35211
llvm-svn: 307635
Daniel Sanders [Tue, 11 Jul 2017 08:57:29 +0000 (08:57 +0000)]
[globalisel][tablegen] Correct matching of intrinsic ID's.
TreePatternNode considers them to be plain integers but MachineInstr considers
them to be a distinct kind of operand.
The tweak to AArch64InstrInfo.td to produce a simple test case is a NFC for
everything except GlobalISelEmitter (confirmed by diffing the tablegenerated
files). GlobalISelEmitter is currently unable to infer the type of operands in
the Dst pattern from the operands in the Src pattern.
llvm-svn: 307634
Diana Picus [Tue, 11 Jul 2017 08:50:01 +0000 (08:50 +0000)]
[ARM] GlobalISel: Legalize s64 G_FCMP
Same as the s32 version, for both hard and soft float.
llvm-svn: 307633
Pavel Labath [Tue, 11 Jul 2017 08:39:44 +0000 (08:39 +0000)]
[LLDB][ppc64le] Rename enums in AuxVector
Summary:
On linux on ppc64le some of the enums in AuxVector have the same name
as macros defined in the system.
Reviewers: mikesart, labath
Reviewed By: labath
Subscribers: joerg, gut, krytarowski, lldb-commits
Differential Revision: https://reviews.llvm.org/D35065
Patch by Bruno Rosa <bruno.rosa@eldorado.org.br>
llvm-svn: 307632
Serguei Katkov [Tue, 11 Jul 2017 08:34:58 +0000 (08:34 +0000)]
Revert Revert [MBP] do not rotate loop if it creates extra branch
This is a second attempt to land this patch.
The first one resulted in a crash of clang sanitizer buildbot.
The fix is here and regression test is added.
This is a last fix for the corner case of PR32214. Actually this is not really corner case in general.
We should not do a loop rotation if we create an additional branch due to it.
Consider the case where we have a loop chain H, M, B, C , where
H is header with viable fallthrough from pre-header and exit from the loop
M - some middle block
B - backedge to Header but with exit from the loop also.
C - some cold block of the loop.
Let's H is determined as a best exit. If we do a loop rotation M, B, C, H we can introduce the extra branch.
Let's compute the change in number of branches:
+1 branch from pre-header to header
-1 branch from header to exit
+1 branch from header to middle block if there is such
-1 branch from cold bock to header if there is one
So if C is not a predecessor of H then we introduce extra branch.
This change actually prohibits rotation of the loop if both true
Best Exit has next element in chain as successor.
Last element in chain is not a predecessor of first element of chain.
Reviewers: iteratee, xur, sammccall, chandlerc
Reviewed By: iteratee
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34745
llvm-svn: 307631
Igor Breger [Tue, 11 Jul 2017 08:04:51 +0000 (08:04 +0000)]
[GlobalISel][X86] Use correct AND instructions.
AND8ri8 not supported in 64bit.
llvm-svn: 307630
Martin Storsjo [Tue, 11 Jul 2017 07:22:44 +0000 (07:22 +0000)]
[COFF] Add initial support for some ARM64 relocations and import thunks
This is enough to link a working hello world executable, with
a call to an imported function, a string constant passed to
the imported function, and loads from a global variable.
Differential Revision: https://reviews.llvm.org/D34964
llvm-svn: 307629
Serguei Katkov [Tue, 11 Jul 2017 06:24:44 +0000 (06:24 +0000)]
[CGP] Relax a bit restriction for optimizeMemoryInst to extend scope
CodeGenPrepare::optimizeMemoryInst contains a check that we do nothing
if all instructions combining the address for memory instruction is in the same
block as memory instruction itself.
However if any of these instruction are placed after memory instruction then
address calculation will not be folded to memory instruction.
The added test case shows an example.
Reviewers: loladiro, spatel, efriedma
Reviewed By: efriedma
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34862
llvm-svn: 307628
Simon Atanasyan [Tue, 11 Jul 2017 06:19:01 +0000 (06:19 +0000)]
[mips] Create the correct profiling symbol on Linux MIPS
llvm-svn: 307627
Hiroshi Inoue [Tue, 11 Jul 2017 06:04:59 +0000 (06:04 +0000)]
fix typos in comments; NFC
llvm-svn: 307626
Chandler Carruth [Tue, 11 Jul 2017 05:39:20 +0000 (05:39 +0000)]
[PM/ThinLTO] Fix PR33536, a bug where the ThinLTO bitcode writer was
querying for analysis results on a function declaration rather than
a definition.
The only reason this worked previously is by chance -- because the way
we got alias analysis results with the legacy PM, we happened to not
compute a dominator tree and so we happened to not hit an assert even
though it didn't make any real sense. Now we bail out before trying to
compute alias analysis so that we don't hit these asserts.
llvm-svn: 307625
Hiroshi Inoue [Tue, 11 Jul 2017 05:37:16 +0000 (05:37 +0000)]
[PowerPC] fix latency for simple integer instructions in POWER9 scheduler
In the POWER9 instruction scheduler, SchedWriteRes for the simple integer instructions are misconfigured to use that of (costly) DFU instructions.
This results in surprisingly long instruction latency estimation and causes misbehavior in some optimizers such as if-conversion.
Differential Revision: https://reviews.llvm.org/D34869
llvm-svn: 307624
Hiroshi Inoue [Tue, 11 Jul 2017 05:28:26 +0000 (05:28 +0000)]
[PowerPC] avoid redundant analysis while lowering an immediate; NFC
This patch reduces compilation time by avoiding redundant analysis while selecting instructions to create an immediate.
If the instruction count required to create the input number without rotate is 2, we do not need further analysis to find a shorter instruction sequence with rotate; rotate + load constant cannot be done by 1 instruction (i.e. getInt64CountDirectnever return 0).
This patch should not change functionality.
Differential Revision: https://reviews.llvm.org/D34986
llvm-svn: 307623
Dylan McKay [Tue, 11 Jul 2017 05:14:40 +0000 (05:14 +0000)]
[AVR] Remove a few very old TODOs that don't have enough context to understand
llvm-svn: 307622
Craig Topper [Tue, 11 Jul 2017 05:12:52 +0000 (05:12 +0000)]
[InstCombine] Add test case for PR33721.
llvm-svn: 307621
Dylan McKay [Tue, 11 Jul 2017 04:53:43 +0000 (04:53 +0000)]
[AVR] Rename 'ZREGS' to 'ZREG'
It will only ever contain one register.
llvm-svn: 307620
Dylan McKay [Tue, 11 Jul 2017 04:45:15 +0000 (04:45 +0000)]
[AVR] Rename 'AVRTiny' to 'Tiny'
llvm-svn: 307619
Jason Molenda [Tue, 11 Jul 2017 04:22:31 +0000 (04:22 +0000)]
Pass in the disassembler flavor when disassembling in
DumpDataExtractor. Patch from Jeffrey Crowell,
https://reviews.llvm.org/D34929
llvm-svn: 307618
Dylan McKay [Tue, 11 Jul 2017 04:17:13 +0000 (04:17 +0000)]
[AVR] Use the generic branch relaxer
llvm-svn: 307617
Petr Hosek [Tue, 11 Jul 2017 02:39:50 +0000 (02:39 +0000)]
[libcxx][CMake] Add install path variable to allow overriding the destination
This is going to be used by the runtime build in the multi-target
setup to allow using different install prefix for each target.
Differential Revision: https://reviews.llvm.org/D33762
llvm-svn: 307615
NAKAMURA Takumi [Tue, 11 Jul 2017 02:31:54 +0000 (02:31 +0000)]
Whitespace.
llvm-svn: 307614
NAKAMURA Takumi [Tue, 11 Jul 2017 02:31:51 +0000 (02:31 +0000)]
Revert r307581, "Avoid doing conservative phi checks in aliasSameBasePointerGEPs() if no phis have been visited yet."
It broke stage2 tests in selfhosting.
llvm-svn: 307613
Sam Clegg [Tue, 11 Jul 2017 02:21:57 +0000 (02:21 +0000)]
[WebAssembly] Fix use of cast vs dyn_cast
Differential Revision: https://reviews.llvm.org/D35233
llvm-svn: 307612
Petr Hosek [Tue, 11 Jul 2017 01:42:26 +0000 (01:42 +0000)]
[libcxxabi][CMake] Add install path variable to allow overriding the destination
This is going to be used by the runtime build in the multi-target
setup to allow using different install prefix for each target.
Differential Revision: https://reviews.llvm.org/D33761
llvm-svn: 307611
Vedant Kumar [Tue, 11 Jul 2017 01:42:12 +0000 (01:42 +0000)]
[llvm-cov] Disable threading in a test. NFC.
PR30735 reports an issue where llvm-cov hangs with a worker thread
waiting on a condition, and the main thread waiting to join() the
workers. While this doesn't appear to be a bug in llvm-cov or the
ThreadPool implementation, it would be helpful to disable the use of
threading in the llvm-cov tests where no test coverage is added.
More context: https://bugs.llvm.org/show_bug.cgi?id=30735
llvm-svn: 307610
Vedant Kumar [Tue, 11 Jul 2017 01:23:29 +0000 (01:23 +0000)]
[llvm-cov] Add a cl::opt to control the number of threads
When an output directory is specified, llvm-cov spawns some threads to
speed up the process of writing out file reports. Add an option which
allows users to control how many threads llvm-cov uses.
A CommandGuide.rst update + test is included.
llvm-svn: 307609
David Blaikie [Tue, 11 Jul 2017 01:18:28 +0000 (01:18 +0000)]
llvm-profdata: Improve memory usage by tuning SmallDenseMap size
This takes memory usage from 5.1GB to 970MB - it could go further by
using a small size of 2 instead of the default of 4, but given the
rather high cost of going over this limit by much, I figured a little
slosh would be worth the ~130MB of memory usage.
& this'll might not be such a big deal if we use a custom slab allocator
for the DenseMaps here anyway
While the vast majority (99.9%) of records use only 1 entry, the tuning
parameter to SmallDenseMap is the the number of buckets, not the number
of entries - so a small size of 1 wasn't useful, even for 1 element, it
would tip over into allocating (much, 64 slots worth) more space - none
of them ended up small.
llvm-svn: 307608
Andrew Wilkins [Tue, 11 Jul 2017 01:17:44 +0000 (01:17 +0000)]
[cmake] Check for Haiku when setting LIB_NAMES for GNU ld
Haiku uses GNU ld for linking, but is not captured in the
conditional when setting LIB_NAMES. This causes a shared
library with no symbols on Haiku. This patch simply adds
a check for whether the CMake system name is Haiku in
addition to the existing checks.
Patch by Jérôme Duval.
Differential Revision: https://reviews.llvm.org/D34998
llvm-svn: 307607
Petr Hosek [Tue, 11 Jul 2017 01:12:09 +0000 (01:12 +0000)]
[libunwind][CMake] Add install path variable to allow overriding the destination
This is going to be used by the runtime build in the multi-target
setup to allow using different install prefix for each target.
Differential Revision: https://reviews.llvm.org/D33760
llvm-svn: 307606
George Karpenkov [Tue, 11 Jul 2017 00:48:00 +0000 (00:48 +0000)]
Remove circular dependency from runtimes/CMakeLists
llvm-svn: 307605
Alexander Shaposhnikov [Tue, 11 Jul 2017 00:30:14 +0000 (00:30 +0000)]
[analyzer] Start fixing modeling of bool based types
This is a follow up for one of
the previous diffs https://reviews.llvm.org/D32328.
getTypeSize and with getIntWidth are not equivalent for bool
(see https://clang.llvm.org/doxygen/ASTContext_8cpp_source.html#l08444),
this causes a number of issues
(for instance, if APint X representing a bool is created
with the wrong bit width then X is not comparable against Min/Max
(because of the different bit width), that results in crashes
(triggered asserts) inside assume* methods),
for examples see the newly added test cases.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D35041
llvm-svn: 307604
Sean Callanan [Tue, 11 Jul 2017 00:29:37 +0000 (00:29 +0000)]
[clang-import-test] Test that enumerators and their values are found.
llvm-svn: 307603
Sean Callanan [Tue, 11 Jul 2017 00:27:57 +0000 (00:27 +0000)]
[clang-import-test] Committed missed update to clang-import-test.cpp
I didn't commit clang-import-test.cpp in r307600, but it had some
changes that were part of https://reviews.llvm.org/D35220
Corrected that now.
llvm-svn: 307602
Petr Hosek [Tue, 11 Jul 2017 00:18:07 +0000 (00:18 +0000)]
[CMake] Use tools template for clangd and modularize
This makes them usable as distribution components in the build.
Differential Revision: https://reviews.llvm.org/D35017
llvm-svn: 307601
Sean Callanan [Mon, 10 Jul 2017 23:47:00 +0000 (23:47 +0000)]
clang-import-test had some dead code. I did the following to eliminate it:
- eliminated error handling for the indirect CompilerInstance, which should
never generate an error as it is created;
- added a new test for direct importation; and
- removed an unused implementation of the CompleteType() API.
This brings clang-import-test.cpp and ExternalASTMerge.cpp back to 100%
coverage on all metrics measured by DLLVM_BUILD_INSTRUMENTED_COVERAGE.
Differential Revision: https://reviews.llvm.org/D35220
llvm-svn: 307600
Zachary Turner [Mon, 10 Jul 2017 22:40:20 +0000 (22:40 +0000)]
[lld/pdb] Create an empty public symbol record stream.
This is part of the continuing effort to increase parity between
LLD and MSVC PDBs. link still doesn't like our PDBs, so the most
obvious thing to check was whether adding an empty publics stream
would get it to do something else. It still fails in the same way
but at least this removes one more variable from the equation.
The next logical step would be to try creating an empty globals
stream.
Differential Revision: https://reviews.llvm.org/D35224
llvm-svn: 307598
Joel Jones [Mon, 10 Jul 2017 22:11:50 +0000 (22:11 +0000)]
Doxygen formatting. NFCI
llvm-svn: 307597
Vedant Kumar [Mon, 10 Jul 2017 21:44:43 +0000 (21:44 +0000)]
InstrProf: Fix unit test which accidentally used a duplicate name
This unit test constructed some profile records incorrectly. One of the
records had a duplicate name: adding that record into the writer caused
an error unrelated to what needed to be tested.
Reported by David Blaikie!
llvm-svn: 307596
Weiming Zhao [Mon, 10 Jul 2017 21:37:35 +0000 (21:37 +0000)]
[libc++] Refactoring __sync_* builtins; NFC (Reland)
Summary: Wrap __sync_* builtins with __libcpp_ functions to facility future customizations as atomic operations are unavailable on some targets.
Reviewers: danalbert, EricWF, jroelofs
Subscribers: joerg, llvm-commits
Differential Revision: https://reviews.llvm.org/D34918
llvm-svn: 307595
Eric Christopher [Mon, 10 Jul 2017 21:28:54 +0000 (21:28 +0000)]
IsSpecialLong was only ever set in release mode as all of the uses are in asserts. Wrap in ifndef NDEBUG.
llvm-svn: 307594
Weiming Zhao [Mon, 10 Jul 2017 21:23:32 +0000 (21:23 +0000)]
Revert "[libc++] Refactoring __sync_* builtins; NFC"
This reverts commit
72ff8866bca49ee7d24c87673293b4ce88a039ec.
llvm-svn: 307593
Zachary Turner [Mon, 10 Jul 2017 21:09:11 +0000 (21:09 +0000)]
Fix pdb-linker-module test on linux.
lld-link is apparently a symlink to lld. Our pdb writing code
uses llvm::sys::fs::getMainExecutable() and writes that value
into the PDB, which will resolve symlinks etc. But what we
really want is the exact value of argv[0], which matches what
the MS linker does. Fix this by just writing argv[0] instead
of calling getMainExecutable.
llvm-svn: 307592
Weiming Zhao [Mon, 10 Jul 2017 21:02:54 +0000 (21:02 +0000)]
[libc++] Refactoring __sync_* builtins; NFC
Summary: Wrap __sync_* builtins with __libcpp_ functions to facility future customizations as atomic operations are unavailable on some targets.
Reviewers: danalbert, EricWF, jroelofs
Subscribers: joerg, llvm-commits
Differential Revision: https://reviews.llvm.org/D34918
llvm-svn: 307591
Zachary Turner [Mon, 10 Jul 2017 21:01:37 +0000 (21:01 +0000)]
[lld/pdb] Add some basic linker module symbols.
Differential Revision: https://reviews.llvm.org/D35152
llvm-svn: 307590
Matthias Braun [Mon, 10 Jul 2017 20:51:30 +0000 (20:51 +0000)]
Revert "[DAG] Improve Aliasing of operations to static alloca"
Reverting as it breaks tramp3d-v4 in the llvm test-suite. I added some
comments to https://reviews.llvm.org/D33345 about it.
This reverts commit r307546.
llvm-svn: 307589
Sam Clegg [Mon, 10 Jul 2017 20:47:12 +0000 (20:47 +0000)]
[WebAssembly] Add more details to llvm-readobj for wasm files
Differential Revision: https://reviews.llvm.org/D35208
llvm-svn: 307588