Dylan McKay [Wed, 14 Dec 2016 12:03:39 +0000 (12:03 +0000)]
[AVR] Add the very first on-target test
This test runs on actual AVR hardware.
llvm-svn: 289648
Stephan Bergmann [Wed, 14 Dec 2016 11:57:17 +0000 (11:57 +0000)]
Replace APFloatBase static fltSemantics data members with getter functions
At least the plugin used by the LibreOffice build
(<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly
uses those members (through inline functions in LLVM/Clang include files in turn
using them), but they are not exported by utils/extract_symbols.py on Windows,
and accessing data across DLL/EXE boundaries on Windows is generally
problematic.
Differential Revision: https://reviews.llvm.org/D26671
llvm-svn: 289647
Artur Pilipenko [Wed, 14 Dec 2016 11:55:47 +0000 (11:55 +0000)]
Add a couple of assertions to the load combine code introduced by r289538
llvm-svn: 289646
Dylan McKay [Wed, 14 Dec 2016 11:47:14 +0000 (11:47 +0000)]
[AVR] Add the integrated testing tool to the .gitignore
We build it as an LLVM tool.
llvm-svn: 289645
Hafiz Abid Qadeer [Wed, 14 Dec 2016 11:13:03 +0000 (11:13 +0000)]
Remove code needed for supporting old VS versions.
Summary: This code was probably needed to support VS2013 and is not needed now. I have built it with VS and mingw. Ok to remove it?
Reviewers: zturner, abidh
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D27707
llvm-svn: 289644
Oliver Stannard [Wed, 14 Dec 2016 10:43:58 +0000 (10:43 +0000)]
[Assembler] Better error messages for .org directive
Currently, the error messages we emit for the .org directive when the
expression is not absolute or is out of range do not include the line
number of the directive, so it can be hard to track down the problem if
a file contains many .org directives.
This patch stores the source location in the MCOrgFragment, so that it
can be used for diagnostics emitted during layout.
Since layout is an iterative process, and the errors are detected during
each iteration, it would have been possible for errors to be reported
multiple times. To prevent this, I've made the assembler bail out after
each iteration if any errors have been reported. This will still allow
multiple unrelated errors to be reported in the common case where they
are all detected in the first round of layout.
Differential Revision: https://reviews.llvm.org/D27411
llvm-svn: 289643
Peter Smith [Wed, 14 Dec 2016 10:36:12 +0000 (10:36 +0000)]
[ELF] Accept first SHT_ARM_ATTRIBUTES section
The eglibc library, as used by Ubuntu 14.04 requires the presence of an
SHT_ARM_ATTRIBUTES section in for the purposes of checking hard/soft float
compatibility when dlopen() is used. Unfortunately when the section is not
present dlopen() fails with a generic could not find file message.
This change makes lld keep the first .ARM.attributes section that it
encounters and propagates it to the output. This is not a complete
SHT_ARM_ATTRIBUTES implementation, that would involve reading the contents
of the section and joining each individual attribute. It should suffice
for a homogenous build all libraries and executables on the same system
with a compatible set of command line options.
Differential revision: https://reviews.llvm.org/D27718
llvm-svn: 289642
Dylan McKay [Wed, 14 Dec 2016 10:15:00 +0000 (10:15 +0000)]
[AVR] Add a function instrumentation pass
This will be used for an on-chip test suite.
llvm-svn: 289641
Andrey Churbanov [Wed, 14 Dec 2016 08:29:00 +0000 (08:29 +0000)]
Cleanup: debug print fixed and moved inside critical section.
Patch by Victor Campos.
Differential Revision: https://reviews.llvm.org/D27647
llvm-svn: 289640
Craig Topper [Wed, 14 Dec 2016 07:46:12 +0000 (07:46 +0000)]
[X86][InstCombine] Handle demanded elements for operand of AVX-512 scalar floating point to integer conversion intrinsics.
llvm-svn: 289639
Hal Finkel [Wed, 14 Dec 2016 07:24:50 +0000 (07:24 +0000)]
[PowerPC] Fix logic dealing with nop after calls (and tail-call eligibility)
This change aims to unify and correct our logic for when we need to allow for
the possibility of the linker adding a TOC restoration instruction after a
call. This comes up in two contexts:
1. When determining tail-call eligibility. If we make a tail call (i.e.
directly branch to a function) then there is no place for the linker to add
a TOC restoration.
2. When determining when we need to add a nop instruction after a call.
Likewise, if there is a possibility that the linker might need to add a
TOC restoration after a call, then we need to put a nop after the call
(the bl instruction).
First problem: We were using similar, but different, logic to decide (1) and
(2). This is just wrong. Both the resideInSameModule function (used when
determining tail-call eligibility) and the isLocalCall function (used when
deciding if the post-call nop is needed) were supposed to be determining the
same underlying fact (i.e. might a TOC restoration be needed after the call).
The same logic should be used in both places.
Second problem: The logic in both places was wrong. We only know that two
functions will share the same TOC when both functions come from the same
section of the same object. Otherwise the linker might cause the functions to
use different TOC base addresses (unless the multi-TOC linker option is
disabled, in which case only shared-library boundaries are relevant). There are
a number of factors that can cause functions to be placed in different sections
or come from different objects (-ffunction-sections, explicitly-specified
section names, COMDAT, weak linkage, etc.). All of these need to be checked.
The existing logic only checked properties of the callee, but the properties of
the caller must also be checked (for example, calling from a function in a
COMDAT section means calling between sections).
There was a conceptual error in the resideInSameModule function in that it
allowed tail calls to functions with weak linkage and protected/hidden
visibility. While protected/hidden visibility does prevent the function
implementation from being replaced at runtime (via interposition), it does not
prevent the linker from using an alternate implementation at link time (i.e.
using some strong definition to replace the provided weak one during linking).
If this happens, then we're still potentially looking at a required TOC
restoration upon return.
Otherwise, in general, the post-call nop is needed wherever ELF interposition
needs to be supported. We don't currently support ELF interposition at the IR
level (see http://lists.llvm.org/pipermail/llvm-dev/2016-November/107625.html
for more information), and I don't think we should try to make it appear to
work in the backend in spite of that fact. This will yield subtle bugs if
interposition is attempted. As a result, regardless of whether we're in PIC
mode, we don't assume that we need to add the nop to support the possibility of
ELF interposition. However, the necessary check is in place (i.e. calling
GV->isInterposable and TM.shouldAssumeDSOLocal) so when we have functions for
which interposition is allowed at the IR level, we'll add the nop as necessary.
In the mean time, we'll generate more tail calls and fewer nops when compiling
position-independent code.
Differential Revision: https://reviews.llvm.org/D27231
llvm-svn: 289638
Justin Lebar [Wed, 14 Dec 2016 06:52:23 +0000 (06:52 +0000)]
[clang-tidy] Suggest including <cmath> if necessary in type-promotion-in-math-fn-check.
Reviewers: alexfh
Subscribers: JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D27748
llvm-svn: 289637
Craig Topper [Wed, 14 Dec 2016 06:06:58 +0000 (06:06 +0000)]
[X86][InstCombine] Teach SimplifyDemandedVectorElts to handle masked scalar add/sub/mul/div/max/min intrinsics better.
Now we can remove these intrinsics if element 0 isn't used. Also fix undef element tracking.
llvm-svn: 289636
Craig Topper [Wed, 14 Dec 2016 05:43:05 +0000 (05:43 +0000)]
[X86][InstCombine] Handle scalar fmadd intrinsics correctly in SimplifyDemandedVectorElts.
Now we pass a modified version of DemandedElts to each operand and we calculate undef elts correctly.
llvm-svn: 289632
Mehdi Amini [Wed, 14 Dec 2016 04:56:42 +0000 (04:56 +0000)]
[ThinLTO] Add an API to trigger file-based API for returning objects to the linker
Summary:
The motivation is to support better the -object_path_lto option on
Darwin. The linker needs to write down the generate object files on
disk for later use by lldb or dsymutil (debug info are not present
in the final binary). We're moving this into libLTO so that we can
be smarter when a cache is enabled and hard-link when possible
instead of duplicating the files.
Reviewers: tejohnson, deadalnix, pcc
Subscribers: dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D27507
llvm-svn: 289631
Richard Smith [Wed, 14 Dec 2016 03:22:16 +0000 (03:22 +0000)]
[c++1z] P0217R3: Allow by-value structured binding of arrays.
llvm-svn: 289630
Craig Topper [Wed, 14 Dec 2016 03:17:30 +0000 (03:17 +0000)]
[X86][InstCombine] Teach SimplifyDemandedVectorElts to handle scalar round intrinsics more correctly.
Now we only pass bit 0 of the DemandedElts to optimize operand 1 as we recurse since the upper bits are unused. Similarly we clear bit 0 for optimizing operand 0.
Also calculate UndefElts correctly.
Simplify InstCombineCalls for these instrinics to just call SimplifyDemandedVectorElts for the call instrution to reuse this support.
llvm-svn: 289629
Craig Topper [Wed, 14 Dec 2016 03:17:27 +0000 (03:17 +0000)]
[X86][InstCombine] Teach SimplifyDemandedVectorElts to handle scalar min/max/cmp intrinsics more correctly.
Now we only pass bit 0 of the DemandedElts to optimize operand 1 as we recurse since the upper bits are unused.
Also calculate UndefElts correctly.
Simplify InstCombineCalls for these instrinics to just call SimplifyDemandedVectorElts for the call instrution to reuse this support.
llvm-svn: 289628
Justin Lebar [Wed, 14 Dec 2016 03:15:01 +0000 (03:15 +0000)]
[ClangTidy] Add new performance-type-promotion-in-math-fn check.
Summary:
This checks for calls to double-precision math.h with single-precision
arguments. For example, it suggests replacing ::sin(0.f) with
::sinf(0.f).
Subscribers: mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D27284
llvm-svn: 289627
Mehdi Amini [Wed, 14 Dec 2016 02:35:32 +0000 (02:35 +0000)]
Don't double-initialize cl::opt for iterating in reverse order to uncover non-determinism in codegen by default
Bots are broken and needs to be fixed before having this on by default.
The feature was committed in r289619.
I tried to disable it in r289624 and failed because it was initialized in two places.
llvm-svn: 289626
Paul Robinson [Wed, 14 Dec 2016 02:06:11 +0000 (02:06 +0000)]
[PS4] Undo dialect tweak for Objective-C.
In r267772, we had set the PS4's default dialect for both C and
Objective-C to gnu99. Make that change only for C; we don't really
support Objective-C/C++ so there's no point fiddling the dialect.
llvm-svn: 289625
Mehdi Amini [Wed, 14 Dec 2016 02:02:28 +0000 (02:02 +0000)]
Disable Iterating SmallPtrSet in reverse order to uncover non-determinism in codegen by default
Bots are broken and needs to be fixed before having this on by default.
The feature was committed in r289619.
llvm-svn: 289624
Richard Smith [Wed, 14 Dec 2016 01:32:13 +0000 (01:32 +0000)]
When emitting a multidimensional array copy, only emit a single flattened
cleanup loop for exception handling.
llvm-svn: 289623
Kostya Serebryany [Wed, 14 Dec 2016 01:31:21 +0000 (01:31 +0000)]
[libFuzzer] document one more desired feature of a fuzz target
llvm-svn: 289622
Peter Collingbourne [Wed, 14 Dec 2016 01:17:59 +0000 (01:17 +0000)]
LTO: Add support for multi-module bitcode files.
Differential Revision: https://reviews.llvm.org/D27313
llvm-svn: 289621
Paul Robinson [Wed, 14 Dec 2016 00:27:35 +0000 (00:27 +0000)]
[DWARF] Preserve column number when emitting 'line 0' record
Follow-up to r289256, address a FIXME to avoid resetting the column
number. This reduced .debug_line by 2.6% in a RelWithDebInfo
self-build of clang.
llvm-svn: 289620
Mandeep Singh Grang [Wed, 14 Dec 2016 00:15:57 +0000 (00:15 +0000)]
[llvm] Iterate SmallPtrSet in reverse order to uncover non-determinism in codegen
Summary:
Given a flag (-mllvm -reverse-iterate) this patch will enable iteration of SmallPtrSet in reverse order.
The idea is to compile the same source with and without this flag and expect the code to not change.
If there is a difference in codegen then it would mean that the codegen is sensitive to the iteration order of SmallPtrSet.
This is enabled only with LLVM_ENABLE_ABI_BREAKING_CHECKS.
Reviewers: chandlerc, dexonsmith, mehdi_amini
Subscribers: mgorny, emaste, llvm-commits
Differential Revision: https://reviews.llvm.org/D26718
llvm-svn: 289619
Richard Smith [Wed, 14 Dec 2016 00:03:17 +0000 (00:03 +0000)]
Remove custom handling of array copies in lambda by-value array capture and
copy constructors of classes with array members, instead using
ArrayInitLoopExpr to represent the initialization loop.
This exposed a bug in the static analyzer where it was unable to differentiate
between zero-initialized and unknown array values, which has also been fixed
here.
llvm-svn: 289618
Evandro Menezes [Wed, 14 Dec 2016 00:02:03 +0000 (00:02 +0000)]
[ARM] Fix typo in checking prefix
llvm-svn: 289617
Akira Hatanaka [Tue, 13 Dec 2016 23:32:22 +0000 (23:32 +0000)]
[CodeGen][ObjC] Emit objc_unsafeClaimAutoreleasedReturnValue for
fragile runtime too.
Follow-up to r258962.
rdar://problem/
29269006
llvm-svn: 289615
Evandro Menezes [Tue, 13 Dec 2016 23:31:57 +0000 (23:31 +0000)]
Add support for Samsung Exynos M3 (NFC)
llvm-svn: 289614
Evandro Menezes [Tue, 13 Dec 2016 23:31:41 +0000 (23:31 +0000)]
Add support for Samsung Exynos M3 (NFC)
llvm-svn: 289613
Greg Clayton [Tue, 13 Dec 2016 23:22:53 +0000 (23:22 +0000)]
Update the header docs to match a recent checkin.
llvm-svn: 289612
Greg Clayton [Tue, 13 Dec 2016 23:20:56 +0000 (23:20 +0000)]
Switch functions that returned bool and filled in a DWARFFormValue arg with ones that return Optional<DWARFFormValue>
Differential Revision: https://reviews.llvm.org/D27737
llvm-svn: 289611
Peter Collingbourne [Tue, 13 Dec 2016 23:14:55 +0000 (23:14 +0000)]
llvm-cat: Allow bitcode files to be created with no modules.
llvm-svn: 289610
Chris Bieneman [Tue, 13 Dec 2016 23:08:52 +0000 (23:08 +0000)]
[llvm-config] Fixing one check where shared libs implied dylib
We shouldn't print the dylib if LinkDylib is false.
llvm-svn: 289609
Derek Schuff [Tue, 13 Dec 2016 23:01:53 +0000 (23:01 +0000)]
llvm-config: Set LinkMode in addition to LinkDyLib when using --ignore-llvm
Summary:
LinkDyLib is only used (before arg processing) to set up the default for
LinkMode. So reset LinkMode as well, and process before --link-shared or
--link-static to allow those flags to continue to override it.
Reviewers: beanz
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D27736
llvm-svn: 289608
Kostya Serebryany [Tue, 13 Dec 2016 22:49:14 +0000 (22:49 +0000)]
[libFuzzer] fix an UB (invalid shift) spotted by ubsan. The code worked fine by luck, because the way shifts actually work on clang+x86
llvm-svn: 289607
Mike Aizatsky [Tue, 13 Dec 2016 22:26:04 +0000 (22:26 +0000)]
[sanitizers] -DAG is order-independent check
llvm-svn: 289606
Chris Bieneman [Tue, 13 Dec 2016 22:17:59 +0000 (22:17 +0000)]
[llvm-config] Add --ignore-libllvm
This flag forces off linking libLLVM. This should resolve some issues reported on llvm-commits.
llvm-svn: 289605
Eugene Zelenko [Tue, 13 Dec 2016 22:13:50 +0000 (22:13 +0000)]
[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 289604
Dehao Chen [Tue, 13 Dec 2016 22:13:18 +0000 (22:13 +0000)]
Change CoverageTracker from a global variable to member variable to avoid breaking thread-safety. (NFC)
llvm-svn: 289603
Sanjoy Das [Tue, 13 Dec 2016 22:04:58 +0000 (22:04 +0000)]
Re-land "[SCEVExpander] Use llvm data structures; NFC"
This change re-lands r289215, by reverting r289482. The underlying
issue that caused it to be reverted has been fixed by Tim Northover in
r289496.
Original commit message for r289215:
[SCEVExpander] Use llvm data structures; NFC
Original commit message for r289482:
Revert "[SCEVExpander] Use llvm data structures; NFC"
This reverts r289215 (git SHA1
cb7b86a1). It breaks the ubsan build
because a DenseMap that keys off of `AssertingVH<T>` will hit UB when it
tries to cast the empty and tombstone keys to `T *` (due to insufficient
alignment).
This is the relevant stack trace (thanks to Mike Aizatsky):
#0 0x25cf100 in llvm::AssertingVH<llvm::PHINode>::getValPtr() const llvm/include/llvm/IR/ValueHandle.h:212:39
#1 0x25cea20 in llvm::AssertingVH<llvm::PHINode>::operator=(llvm::AssertingVH<llvm::PHINode> const&) llvm/include/llvm/IR/ValueHandle.h:234:19
#2 0x25d0092 in llvm::DenseMapBase<llvm::DenseMap<llvm::AssertingVH<llvm::PHINode>, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::AssertingVH<llvm::PHINode> >, llvm::detail::DenseSetPair<llvm::AssertingVH<llvm::PHINode> > >, llvm::AssertingVH<llvm::PHINode>, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::AssertingVH<llvm::PHINode> >, llvm::detail::DenseSetPair<llvm::AssertingVH<llvm::PHINode> > >::clear() llvm/include/llvm/ADT/DenseMap.h:113:23
llvm-svn: 289602
Anna Thomas [Tue, 13 Dec 2016 21:05:21 +0000 (21:05 +0000)]
[IRCE] Avoid loop optimizations on pre and post loops
Summary:
This patch will add loop metadata on the pre and post loops generated by IRCE.
Currently, we have metadata for disabling optimizations such as vectorization,
unrolling, loop distribution and LICM versioning (and confirmed that these
optimizations check for the metadata before proceeding with the transformation).
The pre and post loops generated by IRCE need not go through loop opts (since
these are slow paths).
Added two test cases as well.
Reviewers: sanjoy, reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D26806
llvm-svn: 289588
Reid Kleckner [Tue, 13 Dec 2016 20:54:45 +0000 (20:54 +0000)]
Add DLL thunks for new sancov APIs to fix Windows tests
llvm-svn: 289587
Peter Collingbourne [Tue, 13 Dec 2016 20:50:44 +0000 (20:50 +0000)]
CodeGen: Start using inrange annotations on vtable getelementptr.
This annotation allows the optimizer to split vtable groups, as permitted by
a change to the Itanium ABI [1] that prevents compilers from adjusting virtual
table pointers between virtual tables.
[1] https://github.com/MentorEmbedded/cxx-abi/pull/7
Differential Revision: https://reviews.llvm.org/D24431
llvm-svn: 289585
Peter Collingbourne [Tue, 13 Dec 2016 20:40:39 +0000 (20:40 +0000)]
CodeGen: New vtable group representation: struct of vtable arrays.
In a future change, this representation will allow us to use the new inrange
annotation on getelementptr to allow the optimizer to split vtable groups.
Differential Revision: https://reviews.llvm.org/D22296
llvm-svn: 289584
Michael Kuperstein [Tue, 13 Dec 2016 20:38:18 +0000 (20:38 +0000)]
[LV] Don't vectorize when we have a small static bound on trip count
We currently check if the exact trip count is known and is smaller than the
"tiny loop" bound. We should be checking the maximum bound on the trip count
instead.
Differential Revision: https://reviews.llvm.org/D27690
llvm-svn: 289583
Peter Collingbourne [Tue, 13 Dec 2016 20:30:12 +0000 (20:30 +0000)]
ADT: Use delete[] to delete the array owned by OwningArrayRef, as we created it with new[].
llvm-svn: 289582
Bill Seurer [Tue, 13 Dec 2016 20:26:35 +0000 (20:26 +0000)]
[powerpc] deactivate readability-identifier-naming.cpp test on powerpc64le
The test case clang-tidy/readability-identifier-naming.cpp segfaults on
powerpc64 little endian (starting with r288563) when a bootstrap build/test
is done. To get the buildbot running again deactivate the test.
When the issue is resolved reactivate it.
llvm-svn: 289581
Reid Kleckner [Tue, 13 Dec 2016 20:25:47 +0000 (20:25 +0000)]
Fix size_t typdef in new cppcoreguidelines-no-malloc.cpp test
llvm-svn: 289580
Peter Collingbourne [Tue, 13 Dec 2016 20:24:24 +0000 (20:24 +0000)]
ADT: Add OwningArrayRef class.
This is a MutableArrayRef that owns its array.
I plan to use this in D22296.
Differential Revision: https://reviews.llvm.org/D27723
llvm-svn: 289579
Peter Collingbourne [Tue, 13 Dec 2016 20:20:17 +0000 (20:20 +0000)]
Object: Make IRObjectFile own multiple modules and enumerate symbols from all modules.
This implements multi-module support in IRObjectFile.
Differential Revision: https://reviews.llvm.org/D26951
llvm-svn: 289578
Peter Collingbourne [Tue, 13 Dec 2016 20:10:22 +0000 (20:10 +0000)]
Object: Remove module accessors from IRObjectFile, and hide its constructor.
Differential Revision: https://reviews.llvm.org/D27079
llvm-svn: 289577
Peter Collingbourne [Tue, 13 Dec 2016 20:01:58 +0000 (20:01 +0000)]
LTO: Port the legacy LTO API to ModuleSymbolTable.
Differential Revision: https://reviews.llvm.org/D27078
llvm-svn: 289576
Reid Kleckner [Tue, 13 Dec 2016 19:48:32 +0000 (19:48 +0000)]
Align EvalInfo in ExprConstant to avoid PointerUnion assertions
32-bit MSVC doesn't provide more than 4 byte stack alignment by default.
This conflicts with PointerUnion's attempt to make assertions about
alignment. This fixes the problem by explicitly asking the compiler for
8 byte alignment.
llvm-svn: 289575
Peter Collingbourne [Tue, 13 Dec 2016 19:43:49 +0000 (19:43 +0000)]
LTO: Port the new LTO API to ModuleSymbolTable.
Differential Revision: https://reviews.llvm.org/D27077
llvm-svn: 289574
Alina Sbirlea [Tue, 13 Dec 2016 19:32:36 +0000 (19:32 +0000)]
Generalize strided store pattern in interleave access pass
Summary:
This patch aims to generalize matching of the strided store accesses to more general masks.
The more general rule is to have consecutive accesses based on the stride:
[x, y, ... z, x+1, y+1, ...z+1, x+2, y+2, ...z+2, ...]
All elements in the masks need not form a contiguous space, there may be gaps.
As before, undefs are allowed and filled in with adjacent element loads.
Reviewers: HaoLiu, mssimpso
Subscribers: mkuper, delena, llvm-commits
Differential Revision: https://reviews.llvm.org/D23646
llvm-svn: 289573
Kostya Kortchinsky [Tue, 13 Dec 2016 19:31:54 +0000 (19:31 +0000)]
Corrected D27428: Do not use the alignment-rounded-up size with secondary
Summary:
I atually had an integer overflow on 32-bit with D27428 that didn't reproduce
locally, as the test servers would manage allocate addresses in the 0xffffxxxx
range, which led to some issues when rounding addresses.
At this point, I feel that Scudo could benefit from having its own combined
allocator, as we don't get any benefit from the current one, but have to work
around some hurdles (alignment checks, rounding up that is no longer needed,
extraneous code).
Reviewers: kcc, alekseyshl
Subscribers: llvm-commits, kubabrecka
Differential Revision: https://reviews.llvm.org/D27681
llvm-svn: 289572
George Burgess IV [Tue, 13 Dec 2016 19:22:56 +0000 (19:22 +0000)]
[Sema] Prefer SmallVector over `new`ed memory blocks. NFC.
llvm-svn: 289571
Matthias Braun [Tue, 13 Dec 2016 19:08:17 +0000 (19:08 +0000)]
Revert "AArch64CollectLOH: Rewrite as block-local analysis."
This is not always behaving as expected as it turns out block live-in
lists are only correct most of the time. Still waiting for reviews on
https://reviews.llvm.org/D27559 to have them correct all of the time.
See also http://llvm.org/PR31361, rdar://
25117107
This reverts commit r288567.
This reverts commit r288561.
llvm-svn: 289570
Alexei Starovoitov [Tue, 13 Dec 2016 19:07:08 +0000 (19:07 +0000)]
[bpf] change llvm-objdump to print dec instead of hex
since bpf instruction stream is multiple of 8 change llvm-objdump
to print decimal instruction number instead of hex address, so that
users don't have to do this math manually to match kernel verifier output
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 289569
Reid Kleckner [Tue, 13 Dec 2016 19:01:41 +0000 (19:01 +0000)]
Fix warning for noreturn function
llvm-svn: 289568
Reid Kleckner [Tue, 13 Dec 2016 18:58:09 +0000 (18:58 +0000)]
__uuidof() and declspec(uuid("...")) should be allowed on enumeration types
Although not specifically mentioned in the documentation, MSVC accepts
__uuidof(…) and declspec(uuid("…")) attributes on enumeration types in
addition to structs/classes. This is meaningful, as such types *do* have
associated UUIDs in ActiveX typelibs, and such attributes are included
by default in the wrappers generated by their #import construct, so they
are not particularly unusual.
clang currently rejects the declspec with a –Wignored-attributes
warning, and errors on __uuidof() with “cannot call operator __uuidof on
a type with no GUID” (because it rejected the uuid attribute, and
therefore finds no value). This is causing problems for us while trying
to use clang-tidy on a codebase that makes heavy use of ActiveX.
I believe I have found the relevant places to add this functionality,
this patch adds this case to clang’s implementation of these MS
extensions. patch is against r285994 (or actually the git mirror
80464680ce).
Both include an update to test/Parser/MicrosoftExtensions.cpp to
exercise the new functionality.
This is my first time contributing to LLVM, so if I’ve missed anything
else needed to prepare this for review just let me know!
__uuidof: https://msdn.microsoft.com/en-us/library/zaah6a61.aspx
declspec(uuid("…")): https://msdn.microsoft.com/en-us/library/3b6wkewa.aspx
#import: https://msdn.microsoft.com/en-us/library/8etzzkb6.aspx
Reviewers: aaron.ballman, majnemer, rnk
Differential Revision: https://reviews.llvm.org/D26846
llvm-svn: 289567
Tim Northover [Tue, 13 Dec 2016 18:25:38 +0000 (18:25 +0000)]
GlobalISel: fix GOT accesses on AArch64.
We were using the correct pseudo-instruction, but because the operand's flags
weren't set correctly we still ended up emitting incorrect relocations during
MC lowering.
llvm-svn: 289566
Greg Clayton [Tue, 13 Dec 2016 18:25:19 +0000 (18:25 +0000)]
Make a DWARFDIE class that can help avoid using the wrong DWARFUnit when extracting attributes
Many places pass around a DWARFDebugInfoEntryMinimal and a DWARFUnit. It is easy to get things wrong by using the wrong DWARFUnit with a DWARFDebugInfoEntryMinimal. This patch creates a DWARFDie class that contains the DWARFUnit and DWARFDebugInfoEntryMinimal objects so that they can't get out of sync. All attribute extraction has been moved out of DWARFDebugInfoEntryMinimal and into DWARFDie. DWARFDebugInfoEntryMinimal was also renamed to DWARFDebugInfoEntry.
DWARFDie objects are temporary objects that are used by clients and contain 2 pointers that you always need to have anyway. Keeping them grouped will avoid errors and simplify many of the attribute extracting APIs by not having to pass in a DWARFUnit.
Differential Revision: https://reviews.llvm.org/D27634
llvm-svn: 289565
Marcos Pividori [Tue, 13 Dec 2016 17:46:48 +0000 (17:46 +0000)]
[libFuzzer] Add missing header needed for Windows.
llvm-svn: 289564
Marcos Pividori [Tue, 13 Dec 2016 17:46:40 +0000 (17:46 +0000)]
[libFuzzer] Avoid name collision with Windows API.
Windows uses some macros to replace DeleteFile() by DeleteFileA() or
DeleteFileW(). This was causing an error at link time.
DeleteFile was renamed to RemoveFile().
Differential Revision: https://reviews.llvm.org/D27577
llvm-svn: 289563
Marcos Pividori [Tue, 13 Dec 2016 17:46:32 +0000 (17:46 +0000)]
[libFuzzer] Implement DirName() for Windows.
Implement DirName from scratch to avoid dependencies on external libraries.
It's based on MSDN documentation for Naming Files, Paths, and Namespaces.
The algorithm can't simply start from the end and look backwards for the
first separator, because we need to preserve the prefix that represent
the root location. We shouldn't remove anything there. In Windows we
have many different options, like:
\\Server\Share\ , \ , C: , C:\ , \\?\C:\ , \\?\UNC\Server\Share\
We remove the last separator in the rest of the path, if it exists.
It was implemented to have a similar behaviour to dirname() in linux,
removing trailing separators, returning "." when the path doesn't
contain separators, etc.
Differential Revision: https://reviews.llvm.org/D27579
llvm-svn: 289562
Marcos Pividori [Tue, 13 Dec 2016 17:46:25 +0000 (17:46 +0000)]
[libFuzzer] Fix bug in detecting timeouts when input string is empty.
I added a new flag RunningCB to know if the Fuzzer's main thread is
running the CB function, instead of using (!CurrentUnitSize).
(!CurrentUnitSize) doesn't work properly. For example, in FuzzerLoop.cpp,
inside ShuffleAndMinimize() function, we execute the callback with an
empty string (size=0). Previous implementation failed to detect timeouts
in that execution.
Also, I add a regression test for that case.
Differential Revision: https://reviews.llvm.org/D27433
llvm-svn: 289561
Marcos Pividori [Tue, 13 Dec 2016 17:46:11 +0000 (17:46 +0000)]
[libFuzzer] Clean up headers and file formatting of LibFuzzer files.
Reorganize #includes to follow LLVM Coding Standards.
Include some missing headers. Required to use `Printf()`.
Aside from that, this patch contains no functional change.
It is purely a re-organization.
Differential Revision: https://reviews.llvm.org/D27363
llvm-svn: 289560
Marcos Pividori [Tue, 13 Dec 2016 17:45:53 +0000 (17:45 +0000)]
[libFuzzer] Properly use unsigned for workers, jobs and NumberOfCpuCores.
std::thread::hardware_concurrency() returns an unsigned, so I modify
NumberOfCpuCores() to return unsigned too.
The number of cpus is used to define the number of workers, so I decided
to update the worker and jobs flags to be declared as unsigned too.
Differential Revision: https://reviews.llvm.org/D27685
llvm-svn: 289559
Marcos Pividori [Tue, 13 Dec 2016 17:45:44 +0000 (17:45 +0000)]
[libFuzzer] Properly use unsigned for Process ID.
Use unsigned for PID instead of signed int. GetCurrentProcessId() returns
an unsigned (DWORD) so we must be sure we can deal with all possible values.
I use a long unsigned to be sure it can hold a 32 bit unsigned (DWORD).
Differential Revision: https://reviews.llvm.org/D27281
llvm-svn: 289558
Marcos Pividori [Tue, 13 Dec 2016 17:45:20 +0000 (17:45 +0000)]
[libFuzzer] Improve Signal Handler interface.
Add new flags to FuzzingOptions to represent the different conditions
on the signal handling. These options are passed when calling
SetSignalHandler().
This changes simplify the implementation of Windows's exception
handling. Now we can define a unique handler for all the exceptions.
Differential Revision: https://reviews.llvm.org/D27238
llvm-svn: 289557
Rong Xu [Tue, 13 Dec 2016 17:34:29 +0000 (17:34 +0000)]
Fix the test cases committed in r289521.
llvm-svn: 289556
Simon Pilgrim [Tue, 13 Dec 2016 17:22:39 +0000 (17:22 +0000)]
[X86][SSE] Regenerate vector of pointers tests
llvm-svn: 289555
Artem Dergachev [Tue, 13 Dec 2016 17:19:18 +0000 (17:19 +0000)]
[analyzer] Detect ObjC properties that are both (copy) and Mutable.
When an Objective-C property has a (copy) attribute, the default setter
for this property performs a -copy on the object assigned.
Calling -copy on a mutable NS object such as NSMutableString etc.
produces an immutable object, NSString in our example.
Hence the getter becomes type-incorrect.
rdar://problem/
21022397
Differential Revision: https://reviews.llvm.org/D27535
llvm-svn: 289554
Zachary Turner [Tue, 13 Dec 2016 17:10:16 +0000 (17:10 +0000)]
Update for clang after llvm::StringLiteral.
llvm-svn: 289553
Neil Hickey [Tue, 13 Dec 2016 17:04:33 +0000 (17:04 +0000)]
Fixing build failure by adding triple option to new test condition.
Adding -triple option to ensure target supports double for fpmath test.
llvm-svn: 289552
Zachary Turner [Tue, 13 Dec 2016 17:03:49 +0000 (17:03 +0000)]
[ADT] Add llvm::StringLiteral.
StringLiteral is a wrapper around a string literal useful for
replacing global tables of char arrays with global tables of
StringRefs that can initialized in a constexpr context, avoiding
the invocation of a global constructor.
Differential Revision: https://reviews.llvm.org/D27686
llvm-svn: 289551
Rafael Espindola [Tue, 13 Dec 2016 16:59:19 +0000 (16:59 +0000)]
Refactor duplicated expression. NFC.
llvm-svn: 289550
Alexander Kornienko [Tue, 13 Dec 2016 16:49:10 +0000 (16:49 +0000)]
Fix sphinx build.
llvm-svn: 289549
David Callahan [Tue, 13 Dec 2016 16:42:18 +0000 (16:42 +0000)]
[ADCE] Add code to remove dead branches
Summary:
This is last in of a series of patches to evolve ADCE.cpp to support
removing of unnecessary control flow.
This patch adds the code to update the control and data flow graphs
to remove the dead control flow.
Also update unit tests to test the capability to remove dead,
may-be-infinite loop which is enabled by the switch
-adce-remove-loops.
Previous patches:
D23824 [ADCE] Add handling of PHI nodes when removing control flow
D23559 [ADCE] Add control dependence computation
D23225 [ADCE] Modify data structures to support removing control flow
D23065 [ADCE] Refactor anticipating new functionality (NFC)
D23102 [ADCE] Refactoring for new functionality (NFC)
Reviewers: dberlin, majnemer, nadav, mehdi_amini
Subscribers: llvm-commits, david2050, freik, twoh
Differential Revision: https://reviews.llvm.org/D24918
llvm-svn: 289548
Alexander Kornienko [Tue, 13 Dec 2016 16:38:45 +0000 (16:38 +0000)]
Remove trailing whitespace in docs and clang-tidy sources.
llvm-svn: 289547
Alexander Kornienko [Tue, 13 Dec 2016 16:38:18 +0000 (16:38 +0000)]
[Clang-tidy] check for malloc, realloc and free calls
Summary:
This checker flags the use of C-style memory management functionality and notes about modern alternatives.
In an earlier revision it tried to autofix some kind of patterns, but that was a bad idea. Since memory management can be so widespread in a program, manual updating is most likely necessary.
Maybe for special cases, there could be later additions to this basic checker.
This is the first checker I wrote and I never did something with clang (only compiling programs). So whenever I missed conventions or did plain retarded stuff, feel free to point it out! I am willing to fix them and write a better checker.
I hope the patch does work, I never did this either. On a testapply in my repository it did, but I am pretty unconfident in my patching skills :)
Reviewers: aaron.ballman, hokein, alexfh, malcolm.parsons
Subscribers: cfe-commits, JDevlieghere, nemanjai, Eugene.Zelenko, Prazek, mgorny, modocache
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D26167
Patch by Jonas Toth!
llvm-svn: 289546
Artur Pilipenko [Tue, 13 Dec 2016 16:26:15 +0000 (16:26 +0000)]
Use more detailed assertion messages in the code introduced by r289538
llvm-svn: 289545
Neil Hickey [Tue, 13 Dec 2016 16:22:50 +0000 (16:22 +0000)]
Improve handling of floating point literals in OpenCL to only use double precision if the target supports fp64.
This change makes sure single-precision floating point types are used if the
cl_fp64 extension is not supported by the target.
Also removed the check to see whether the OpenCL version is >= 1.2, as this has
been incorporated into the extension setting code.
Differential Revision: https://reviews.llvm.org/D24235
llvm-svn: 289544
Alexander Kornienko [Tue, 13 Dec 2016 16:19:34 +0000 (16:19 +0000)]
Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}
llvm-svn: 289543
Alexander Kornienko [Tue, 13 Dec 2016 16:19:19 +0000 (16:19 +0000)]
Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}
llvm-svn: 289542
Haojian Wu [Tue, 13 Dec 2016 15:35:47 +0000 (15:35 +0000)]
[clang-move] Fix incorrect EndLoc for declarations in macros.
Reviewers: ioeric
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D27713
llvm-svn: 289541
Artur Pilipenko [Tue, 13 Dec 2016 14:55:31 +0000 (14:55 +0000)]
Fix a buildbot failure introduced by r289538
Build failed because of unused variable in product mode.
llvm-svn: 289540
Ulrich Weigand [Tue, 13 Dec 2016 14:44:25 +0000 (14:44 +0000)]
[sancov] Disable failing test on SystemZ as well
This doesn't work at all on big-endian systems, even just reading in the
magic bytes in the binary .sancov file header gets byte order wrong.
llvm-svn: 289539
Artur Pilipenko [Tue, 13 Dec 2016 14:21:14 +0000 (14:21 +0000)]
[DAGCombiner] Match load by bytes idiom and fold it into a single load
Match a pattern where a wide type scalar value is loaded by several narrow loads and combined by shifts and ors. Fold it into a single load or a load and a bswap if the targets supports it.
Assuming little endian target:
i8 *a = ...
i32 val = a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24)
=>
i32 val = *((i32)a)
i8 *a = ...
i32 val = (a[0] << 24) | (a[1] << 16) | (a[2] << 8) | a[3]
=>
i32 val = BSWAP(*((i32)a))
This optimization was discussed on llvm-dev some time ago in "Load combine pass" thread. We came to the conclusion that we want to do this transformation late in the pipeline because in presence of atomic loads load widening is irreversible transformation and it might hinder other optimizations.
Eventually we'd like to support folding patterns like this where the offset has a variable and a constant part:
i32 val = a[i] | (a[i + 1] << 8) | (a[i + 2] << 16) | (a[i + 3] << 24)
Matching the pattern above is easier at SelectionDAG level since address reassociation has already happened and the fact that the loads are adjacent is clear. Understanding that these loads are adjacent at IR level would have involved looking through geps/zexts/adds while looking at the addresses.
The general scheme is to match OR expressions by recursively calculating the origin of individual bits which constitute the resulting OR value. If all the OR bits come from memory verify that they are adjacent and match with little or big endian encoding of a wider value. If so and the load of the wider type (and bswap if needed) is allowed by the target generate a load and a bswap if needed.
Reviewed By: hfinkel, RKSimon, filcab
Differential Revision: https://reviews.llvm.org/D26149
llvm-svn: 289538
Artur Pilipenko [Tue, 13 Dec 2016 14:16:02 +0000 (14:16 +0000)]
Move BaseIndexOffset in DAGCombiner.cpp so it will be available for the upcoming user
llvm-svn: 289537
Egor Churaev [Tue, 13 Dec 2016 14:07:23 +0000 (14:07 +0000)]
[OpenCL] Improve address space diagnostics.
Reviewers: Anastasia
Subscribers: bader, yaxunl, cfe-commits
Differential Revision: https://reviews.llvm.org/D27671
llvm-svn: 289536
Egor Churaev [Tue, 13 Dec 2016 14:02:35 +0000 (14:02 +0000)]
[OpenCL] Enable unroll hint for OpenCL 1.x.
Summary: Although the feature was introduced only in OpenCL C v2.0 spec., it's useful for OpenCL 1.x too and doesn't require HW support.
Reviewers: Anastasia
Subscribers: yaxunl, cfe-commits, bader
Differential Revision: https://reviews.llvm.org/D27453
llvm-svn: 289535
Simon Pilgrim [Tue, 13 Dec 2016 13:36:27 +0000 (13:36 +0000)]
[SelectionDAG] computeKnownBits - simplified knownbits sign extension. NFCI.
We don't need to extract+test the sign bit of the known ones/zeros, we can use sext which will handle all of this.
llvm-svn: 289534
Tobias Grosser [Tue, 13 Dec 2016 12:44:00 +0000 (12:44 +0000)]
Adjust clang-format formatting to r289531
clang-format has been updated in r289531 to keep labels and values on
the same line. This change updates Polly to the new formatting style.
llvm-svn: 289533
Simon Dardis [Tue, 13 Dec 2016 11:39:18 +0000 (11:39 +0000)]
[mips][rtdyld] Move MIPS relocation resolution to a subclass and implement N32 relocations
N32 relocations are only correct for individual relocations at the moment.
Support for relocation composition will follow in a later patch.
Patch By: Daniel Sanders
Reviwers: vkalintiris, atanasyan
Differential Revision: https://reviews.llvm.org/D27467
llvm-svn: 289532
Daniel Jasper [Tue, 13 Dec 2016 11:16:42 +0000 (11:16 +0000)]
clang-format: Keep string-literal-label + value pairs on a line.
We have previously done that for <<-operators. This patch also adds
this logic for "," and "+".
Before:
string v = "
aaaaaaaaaaaaaaaa: " +
aaaaaaaaaaaaaaaa + "
aaaaaaaaaaaaaaaa: " +
aaaaaaaaaaaaaaaa + "
aaaaaaaaaaaaaaaa: " +
aaaaaaaaaaaaaaaa;
string v = StrCat("
aaaaaaaaaaaaaaaa: ",
aaaaaaaaaaaaaaaa, "
aaaaaaaaaaaaaaaa: ",
aaaaaaaaaaaaaaaa, "
aaaaaaaaaaaaaaaa: ",
aaaaaaaaaaaaaaaa);
After:
string v = "
aaaaaaaaaaaaaaaa: " +
aaaaaaaaaaaaaaaa +
"
aaaaaaaaaaaaaaaa: " +
aaaaaaaaaaaaaaaa +
"
aaaaaaaaaaaaaaaa: " +
aaaaaaaaaaaaaaaa;
string v = StrCat("
aaaaaaaaaaaaaaaa: ",
aaaaaaaaaaaaaaaa,
"
aaaaaaaaaaaaaaaa: ",
aaaaaaaaaaaaaaaa,
"
aaaaaaaaaaaaaaaa: ",
aaaaaaaaaaaaaaaa);
llvm-svn: 289531